119 lines
4.5 KiB
Plaintext
119 lines
4.5 KiB
Plaintext
syntax = "v1"
|
||
|
||
info (
|
||
title: // TODO: add title
|
||
desc: // TODO: add description
|
||
author: ""
|
||
email: ""
|
||
)
|
||
|
||
import "basic.api"
|
||
|
||
service upload {
|
||
@handler UploadUpFileHandler
|
||
get /api/upload/up-file(RequestUpFile) returns (response);
|
||
|
||
@handler UploadFileFrontendHandler
|
||
post /api/upload/upload-file-frontend(RequestUploadFileFrontend) returns (response);
|
||
|
||
@handler UploadFileBackendHandler
|
||
post /api/upload/upload-file-backend(UploadFileBackendReq) returns (response);
|
||
//生成二维码
|
||
@handler UploadQrcodeHandler
|
||
post /api/upload/qrcode(UploadQrcodeReq) returns (response);
|
||
|
||
// 上传文件发起--单个文件--后端上传
|
||
@handler UploadFilesBackendHandler
|
||
post /api/upload/upload-files-backend(UploadFilesReq) returns (response);
|
||
|
||
// 上传文件发起--多个文件--前端上传
|
||
@handler UploadFilesFrontendHandler
|
||
post /api/upload/upload-files-frontend(UploadFilesReq) returns (response);
|
||
|
||
// 上传文件回调
|
||
@handler UploadCallbackHandler
|
||
post /api/upload/upload-callback(UploadCallbackReq) returns (response);
|
||
|
||
// 上传LOGO
|
||
@handler UploadLogoHandler
|
||
post /api/upload/up-logo(UploadLogoReq) returns (response);
|
||
|
||
// 上传文件发起--base64
|
||
@handler UploadFileBaseHandler
|
||
post /api/upload/upload-file-base(UploadFileBaseReq) returns (response);
|
||
|
||
}
|
||
|
||
type (
|
||
UploadFileBaseReq {
|
||
ApiType int64 `form:"api_type,options=[1,2],default=1"` // 调用类型:1=对外,2=对内
|
||
FileKey string `form:"file_key"` // 上传唯一标识信息
|
||
FileData string `form:"file_data"` // 上传文件额外信息
|
||
Metadata string `form:"meta_data,optional"` // 上传文件额外信息
|
||
UserId int64 `form:"user_id,optional"` // 上传文件额外信息
|
||
GuestId int64 `form:"guest_id,optional"` // 上传文件额外信息
|
||
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
||
}
|
||
)
|
||
|
||
type (
|
||
UploadLogoReq {
|
||
ResourceId string `form:"resource_id"` // 资源ID
|
||
ResourceUrl string `form:"resource_url"` // 资源URL
|
||
IsRemoveBg int64 `form:"is_remove_bg,optional"` // 是否要去掉背景
|
||
Proportion int64 `form:"proportion,default=60"` // 贴图在模型面板上的比例
|
||
SkuId int64 `form:"sku_id,default=0"` // 模板ID
|
||
}
|
||
)
|
||
|
||
type (
|
||
UploadFileBackendReq {
|
||
ApiType int64 `form:"api_type,options=[1,2],default=1"` // 调用类型:1=对外,2=对内
|
||
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
||
FileKey string `form:"file_key"` // 上传唯一标识信息
|
||
FileSize int64 `form:"file_size,optional"` // 上传唯一标识信息
|
||
Metadata string `form:"meta_data,optional"` // 上传文件额外信息
|
||
}
|
||
|
||
UploadFilesReq {
|
||
ApiType int64 `form:"api_type,options=[1,2],default=1"` // 调用类型:1=对外,2=对内
|
||
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
||
UploadInfo string `form:"upload_info"` // 上传信息 json
|
||
}
|
||
UploadCallbackReq {
|
||
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
||
ResourceId string `form:"resource_id"` // 资源ID
|
||
ResourceType string `form:"resource_type"` // 资源类型
|
||
ResourceUrl string `form:"resource_url"` // 资源URL
|
||
Metadata string `form:"metadata,optional"` // 元数据,json格式,存储图像分率
|
||
ApiType int64 `form:"api_type,options=[1,2],default=1"` // 调用类型:1=对外,2=对内
|
||
}
|
||
)
|
||
|
||
type RequestUpFile {
|
||
UpFile string `form:"upfile"`
|
||
IsCut string `form:"is_cut"` // 是否裁剪
|
||
}
|
||
|
||
type RequestUploadFileFrontend {
|
||
FileName string `json:"file_name"` // 文件名
|
||
FileType string `json:"file_type"` // Image / fbx / hdr
|
||
FileSize int64 `json:"file_size"` // 文件大小
|
||
Category string `json:"category"` // 类别
|
||
}
|
||
|
||
type RequestUploadFileBackend {
|
||
File File `file:"file"` // 文件名
|
||
FileType string `form:"file_type"` // Image / fbx / hdr
|
||
Category string `form:"category"` // 类别
|
||
}
|
||
|
||
//生成二维码
|
||
type UploadQrcodeReq {
|
||
Url string `json:"url"`
|
||
QRcodeType int64 `json:"QRcodeType"`
|
||
}
|
||
type UploadQrcodeRsp {
|
||
Link string `json:"link"`
|
||
Data string `json:"d"`
|
||
} |