feat: add toolbox query, upload module, update config and gitignore
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
app/main/api/desc/front/toolbox.api
Normal file
29
app/main/api/desc/front/toolbox.api
Normal file
@@ -0,0 +1,29 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "工具箱服务"
|
||||
desc: "免费工具箱(天行聚合等)"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
//============================> toolbox v1 <============================
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: toolbox
|
||||
)
|
||||
service main {
|
||||
@doc "工具箱统一查询"
|
||||
@handler toolboxQuery
|
||||
post /toolbox/query (ToolboxQueryReq) returns (ToolboxQueryResp)
|
||||
}
|
||||
|
||||
type (
|
||||
ToolboxQueryReq {
|
||||
ToolKey string `json:"tool_key"`
|
||||
Params map[string]interface{} `json:"params,optional"`
|
||||
}
|
||||
ToolboxQueryResp {
|
||||
ToolKey string `json:"tool_key"`
|
||||
Result map[string]interface{} `json:"result"`
|
||||
}
|
||||
)
|
||||
44
app/main/api/desc/front/upload.api
Normal file
44
app/main/api/desc/front/upload.api
Normal file
@@ -0,0 +1,44 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "上传服务"
|
||||
desc: "图片 Base64 上传与文件访问"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
//============================> upload v1 <============================
|
||||
// 访问已上传图片(直接输出二进制,无 JSON 包装)
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: upload
|
||||
)
|
||||
service main {
|
||||
@doc "访问已上传图片"
|
||||
@handler serveUpload
|
||||
get /upload/file/:name (ServeUploadFileReq)
|
||||
}
|
||||
|
||||
type ServeUploadFileReq {
|
||||
Name string `path:"name"`
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: upload
|
||||
jwt: JwtAuth
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@doc "图片 Base64 上传"
|
||||
@handler uploadImage
|
||||
post /upload/image (UploadImageReq) returns (UploadImageResp)
|
||||
}
|
||||
|
||||
type (
|
||||
UploadImageReq {
|
||||
ImageBase64 string `json:"image_base64"`
|
||||
}
|
||||
UploadImageResp {
|
||||
Url string `json:"url"`
|
||||
}
|
||||
)
|
||||
@@ -14,6 +14,8 @@ import "./front/product.api"
|
||||
import "./front/agent.api"
|
||||
import "./front/app.api"
|
||||
import "./front/authorization.api"
|
||||
import "./front/toolbox.api"
|
||||
import "./front/upload.api"
|
||||
// 后台
|
||||
import "./admin/auth.api"
|
||||
import "./admin/menu.api"
|
||||
@@ -29,3 +31,6 @@ import "./admin/admin_query.api"
|
||||
import "./admin/admin_agent.api"
|
||||
import "./admin/admin_api.api"
|
||||
import "./admin/admin_role_api.api"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user