f
This commit is contained in:
19
app/main/api/desc/front/tianyuan.api
Normal file
19
app/main/api/desc/front/tianyuan.api
Normal file
@@ -0,0 +1,19 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "天远异步回调"
|
||||
desc: "天远车辆类接口异步回调入口"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
// 该服务只提供第三方回调入口,不依赖登录态
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: tianyuan
|
||||
)
|
||||
service main {
|
||||
@doc "天远车辆类接口异步回调"
|
||||
@handler vehicleCallback
|
||||
post /tianyuan/vehicle/callback
|
||||
}
|
||||
|
||||
39
app/main/api/desc/front/upload.api
Normal file
39
app/main/api/desc/front/upload.api
Normal file
@@ -0,0 +1,39 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "上传"
|
||||
desc: "图片上传,用于行驶证等需 URL 的接口"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
type (
|
||||
UploadImageReq {
|
||||
ImageBase64 string `json:"image_base64" validate:"required"` // 图片 base64(不含 data URL 前缀)
|
||||
}
|
||||
UploadImageResp {
|
||||
Url string `json:"url"` // 可公网访问的图片 URL
|
||||
}
|
||||
ServeUploadedFileReq {
|
||||
FileName string `path:"fileName"` // 文件名,如 uuid.jpg
|
||||
}
|
||||
// 实际由 Handler 根据 FilePath/ContentType 写文件流,不返回 JSON
|
||||
ServeUploadedFileResp {
|
||||
FilePath string `json:"-"` // 内部:本地文件路径
|
||||
ContentType string `json:"-"` // 内部:Content-Type
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: upload
|
||||
)
|
||||
service main {
|
||||
@doc "上传图片,返回可访问 URL(如行驶证);限制 3MB"
|
||||
@handler UploadImage
|
||||
post /upload/image (UploadImageReq) returns (UploadImageResp)
|
||||
|
||||
@doc "访问已上传文件(供第三方或前端通过返回的 URL 拉取)"
|
||||
@handler ServeUploadedFile
|
||||
get /upload/file/:fileName (ServeUploadedFileReq) returns (ServeUploadedFileResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user