Skip to content

Instantly share code, notes, and snippets.

View OMGZui's full-sized avatar
:octocat:
Focusing

omgzui OMGZui

:octocat:
Focusing
  • DXY
  • HangZhou, China
View GitHub Profile
@OMGZui
OMGZui / 1.sql
Last active January 3, 2023 14:38
CREATE TABLE `hospital_statistics_data` (
`pk_id` bigint unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(36) COLLATE utf8mb4_general_ci NOT NULL,
`hospital_code` varchar(36) COLLATE utf8mb4_general_ci NOT NULL,
`biz_type` tinyint NOT NULL,
`item_code` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`item_name` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
`item_value` varchar(36) COLLATE utf8mb4_general_ci DEFAULT NULL,
`is_deleted` tinyint DEFAULT NULL,
PRIMARY KEY (`pk_id`)
public Response test(Session session){
UserInfo user = UserDao.queryByUserId(session.getUserId());
if(user==null){
reutrn new Response();
}
return do(session.getUserId());
}
public Response test(Session session){
UserInfo user = UserDao.queryByUserId(session.getUserId());
if(user==null){
reutrn new Response();
}
return do(session.getUserId());
}
public void transfer(TransferDTO transferDTO){
log.info("invoke tranfer begin");
log.info("invoke tranfer,paramters:{}",transferDTO);
try {
res= transferService.transfer(transferDTO);
}catch(Exception e){
log.error("transfer fail,account:{}",
transferDTO.getAccount())
log.error("transfer fail,exception:{}",e);
}
// Factory.php
class Factory extends Model
{
public function workers()
{
return $this->hasMany(Worker::class);
}
}
// Worker.php
@OMGZui
OMGZui / 7.ts
Created November 18, 2022 09:42
interface IcompressSvga {
(path: string, source: Buffer): () => Promise<Idetail>
}
let compressSvga: IcompressSvga
compressSvga = (path, source) => {
return async () => {
const result = {
input: 0,
output: 0,
ratio: 0,
@OMGZui
OMGZui / 6.ts
Created November 18, 2022 09:42
interface IcompressImg {
(payload: imageType): () => Promise<Idetail>
}
let compressImg: IcompressImg
compressImg = ({ path, file }: imageType) => {
return async () => {
const result = {
input: 0,
output: 0,
ratio: 0,
@OMGZui
OMGZui / 5.ts
Created November 18, 2022 09:41
process.on('message', (tasks: imageType[]) => {
;(async () => {
const data = tasks
.filter(({ path }: { path: string }) => /\.(jpe?g|png)$/.test(path))
.map(ele => {
return compressImg({ ...ele, file: Buffer.from(ele.file) })
})
const svgaData = tasks
.filter(({ path }: { path: string }) => /\.(svga)$/.test(path))
@OMGZui
OMGZui / 4.ts
Created November 18, 2022 09:41
interface Idownload {
(path: string): Promise<string>
}
export let download: Idownload
download = (path: string) => {
const header = new Url.URL(path)
return new Promise((resolve, reject) => {
const req = Https.request(header, res => {
let content = ''
res.setEncoding('binary')
@OMGZui
OMGZui / 3.ts
Created November 18, 2022 09:40
interface Iupload {
(file: Buffer): Promise<DataUploadType>
}
export let upload: Iupload
upload = (file: Buffer) => {
const header = randomHeader()
return new Promise((resolve, reject) => {
const req = Https.request(header, res => {
res.on('data', data => {
try {