first commit
This commit is contained in:
39
app/main/api/desc/front/app.api
Normal file
39
app/main/api/desc/front/app.api
Normal file
@@ -0,0 +1,39 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "APP服务"
|
||||
desc: "APP服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: app
|
||||
)
|
||||
service main {
|
||||
@doc(
|
||||
summary: "心跳检测接口"
|
||||
)
|
||||
@handler healthCheck
|
||||
get /health/check returns (HealthCheckResp)
|
||||
|
||||
@handler getAppVersion
|
||||
get /app/version returns (getAppVersionResp)
|
||||
}
|
||||
|
||||
type (
|
||||
// 心跳检测响应
|
||||
HealthCheckResp {
|
||||
Status string `json:"status"` // 服务状态
|
||||
Message string `json:"message"` // 状态信息
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
getAppVersionResp {
|
||||
Version string `json:"version"`
|
||||
WgtUrl string `json:"wgtUrl"`
|
||||
}
|
||||
)
|
||||
73
app/main/api/desc/front/pay.api
Normal file
73
app/main/api/desc/front/pay.api
Normal file
@@ -0,0 +1,73 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "支付服务"
|
||||
desc: "支付服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: pay
|
||||
)
|
||||
service main {
|
||||
// 微信支付回调
|
||||
@handler WechatPayCallback
|
||||
post /pay/wechat/callback
|
||||
|
||||
// 支付宝支付回调
|
||||
@handler AlipayCallback
|
||||
post /pay/alipay/callback
|
||||
|
||||
// 微信退款回调
|
||||
@handler WechatPayRefundCallback
|
||||
post /pay/wechat/refund_callback
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: pay
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
|
||||
)
|
||||
service main {
|
||||
// 支付
|
||||
@handler Payment
|
||||
post /pay/payment (PaymentReq) returns (PaymentResp)
|
||||
|
||||
@handler IapCallback
|
||||
post /pay/iap_callback (IapCallbackReq)
|
||||
|
||||
@handler PaymentCheck
|
||||
post /pay/check (PaymentCheckReq) returns (PaymentCheckResp)
|
||||
}
|
||||
|
||||
type (
|
||||
PaymentReq {
|
||||
Id string `json:"id"`
|
||||
PayMethod string `json:"pay_method"`
|
||||
PayType string `json:"pay_type" validate:"required,oneof=query"`
|
||||
}
|
||||
PaymentResp {
|
||||
PrepayData interface{} `json:"prepay_data"`
|
||||
PrepayId string `json:"prepay_id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
}
|
||||
PaymentCheckReq {
|
||||
OrderNo string `json:"order_no" validate:"required"`
|
||||
}
|
||||
PaymentCheckResp {
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
IapCallbackReq {
|
||||
OrderID int64 `json:"order_id" validate:"required"`
|
||||
TransactionReceipt string `json:"transaction_receipt" validate:"required"`
|
||||
}
|
||||
)
|
||||
59
app/main/api/desc/front/product.api
Normal file
59
app/main/api/desc/front/product.api
Normal file
@@ -0,0 +1,59 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "产品服务"
|
||||
desc: "产品服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
type Feature {
|
||||
ID int64 `json:"id"` // 功能ID
|
||||
ApiID string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 功能描述
|
||||
}
|
||||
// 产品基本类型定义
|
||||
type Product {
|
||||
ProductName string `json:"product_name"`
|
||||
ProductEn string `json:"product_en"`
|
||||
Description string `json:"description"`
|
||||
Notes string `json:"notes,optional"`
|
||||
SellPrice float64 `json:"sell_price"`
|
||||
Features []Feature `json:"features"` // 关联功能列表
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1/product
|
||||
group: product
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
|
||||
)
|
||||
service main {
|
||||
@handler GetProductByID
|
||||
get /:id (GetProductByIDRequest) returns (ProductResponse)
|
||||
|
||||
@handler GetProductByEn
|
||||
get /en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
||||
}
|
||||
|
||||
type GetProductByIDRequest {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
|
||||
type GetProductByEnRequest {
|
||||
ProductEn string `path:"product_en"`
|
||||
}
|
||||
|
||||
type ProductResponse {
|
||||
Product
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1/product
|
||||
group: product
|
||||
)
|
||||
service main {
|
||||
@handler GetProductAppByEn
|
||||
get /app_en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
||||
}
|
||||
224
app/main/api/desc/front/query.api
Normal file
224
app/main/api/desc/front/query.api
Normal file
@@ -0,0 +1,224 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "产品查询服务"
|
||||
desc: "产品查询服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
//============================> query v1 <============================
|
||||
// 查询基本类型定义
|
||||
type Query {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
UserId int64 `json:"user_id"` // 用户ID
|
||||
ProductName string `json:"product_name"` // 产品ID
|
||||
QueryParams map[string]interface{} `json:"query_params"`
|
||||
QueryData []QueryItem `json:"query_data"`
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
QueryState string `json:"query_state"` // 查询状态
|
||||
}
|
||||
|
||||
|
||||
type QueryItem {
|
||||
Feature interface{} `json:"feature"`
|
||||
Data interface{} `json:"data"` // 这里可以是 map 或 具体的 struct
|
||||
}
|
||||
|
||||
|
||||
type (
|
||||
QueryReq {
|
||||
Data string `json:"data" validate:"required"`
|
||||
}
|
||||
QueryResp {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
QueryServiceReq {
|
||||
Product string `path:"product"`
|
||||
Data string `json:"data" validate:"required"`
|
||||
App bool `json:"app,optional"`
|
||||
}
|
||||
QueryServiceResp {
|
||||
Id string `json:"id"`
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: query
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
|
||||
)
|
||||
service main {
|
||||
@doc "query service"
|
||||
@handler queryService
|
||||
post /query/service/:product (QueryServiceReq) returns (QueryServiceResp)
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: query
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
|
||||
)
|
||||
service main {
|
||||
@doc "获取查询临时订单"
|
||||
@handler queryProvisionalOrder
|
||||
get /query/provisional_order/:id (QueryProvisionalOrderReq) returns (QueryProvisionalOrderResp)
|
||||
|
||||
@doc "查询列表"
|
||||
@handler queryList
|
||||
get /query/list (QueryListReq) returns (QueryListResp)
|
||||
|
||||
@doc "查询详情 按订单号 付款查询时"
|
||||
@handler queryDetailByOrderId
|
||||
get /query/orderId/:order_id (QueryDetailByOrderIdReq) returns (QueryDetailByOrderIdResp)
|
||||
|
||||
@doc "查询详情 按订单号"
|
||||
@handler queryDetailByOrderNo
|
||||
get /query/orderNo/:order_no (QueryDetailByOrderNoReq) returns (QueryDetailByOrderNoResp)
|
||||
|
||||
@doc "重试查询"
|
||||
@handler queryRetry
|
||||
post /query/retry/:id (QueryRetryReq) returns (QueryRetryResp)
|
||||
|
||||
@doc "更新查询数据"
|
||||
@handler updateQueryData
|
||||
post /query/update_data (UpdateQueryDataReq) returns (UpdateQueryDataResp)
|
||||
|
||||
@doc "生成分享链接"
|
||||
@handler QueryGenerateShareLink
|
||||
post /query/generate_share_link (QueryGenerateShareLinkReq) returns (QueryGenerateShareLinkResp)
|
||||
}
|
||||
|
||||
type (
|
||||
QueryGenerateShareLinkReq {
|
||||
OrderId *int64 `json:"order_id,optional"`
|
||||
OrderNo *string `json:"order_no,optional"`
|
||||
}
|
||||
QueryGenerateShareLinkResp {
|
||||
ShareLink string `json:"share_link"`
|
||||
}
|
||||
)
|
||||
|
||||
// 获取查询临时订单
|
||||
type (
|
||||
QueryProvisionalOrderReq {
|
||||
Id string `path:"id"`
|
||||
}
|
||||
QueryProvisionalOrderResp {
|
||||
Name string `json:"name"`
|
||||
IdCard string `json:"id_card"`
|
||||
Mobile string `json:"mobile"`
|
||||
Product Product `json:"product"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
QueryListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"page_size"` // 每页数据量
|
||||
}
|
||||
QueryListResp {
|
||||
Total int64 `json:"total"` // 总记录数
|
||||
List []Query `json:"list"` // 查询列表
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
QueryExampleReq {
|
||||
Feature string `form:"feature"`
|
||||
}
|
||||
QueryExampleResp {
|
||||
Query
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
type (
|
||||
QueryDetailByOrderIdReq {
|
||||
OrderId int64 `path:"order_id"`
|
||||
}
|
||||
QueryDetailByOrderIdResp {
|
||||
Query
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
QueryDetailByOrderNoReq {
|
||||
OrderNo string `path:"order_no"`
|
||||
}
|
||||
QueryDetailByOrderNoResp {
|
||||
Query
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
QueryRetryReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
QueryRetryResp {
|
||||
Query
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
type (
|
||||
UpdateQueryDataReq {
|
||||
Id int64 `json:"id"` // 查询ID
|
||||
QueryData string `json:"query_data"` // 查询数据(未加密的JSON)
|
||||
}
|
||||
UpdateQueryDataResp {
|
||||
Id int64 `json:"id"`
|
||||
UpdatedAt string `json:"updated_at"` // 更新时间
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: query
|
||||
)
|
||||
service main {
|
||||
@handler querySingleTest
|
||||
post /query/single/test (QuerySingleTestReq) returns (QuerySingleTestResp)
|
||||
|
||||
@doc "查询详情"
|
||||
@handler queryShareDetail
|
||||
get /query/share/:id (QueryShareDetailReq) returns (QueryShareDetailResp)
|
||||
|
||||
@doc "查询示例"
|
||||
@handler queryExample
|
||||
get /query/example (QueryExampleReq) returns (QueryExampleResp)
|
||||
|
||||
}
|
||||
type (
|
||||
QueryShareDetailReq {
|
||||
Id string `path:"id"`
|
||||
}
|
||||
QueryShareDetailResp {
|
||||
Status string `json:"status"`
|
||||
Query
|
||||
}
|
||||
)
|
||||
|
||||
type QuerySingleTestReq {
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Api string `json:"api"`
|
||||
}
|
||||
|
||||
type QuerySingleTestResp {
|
||||
Data interface{} `json:"data"`
|
||||
Api string `json:"api"`
|
||||
}
|
||||
|
||||
164
app/main/api/desc/front/user.api
Normal file
164
app/main/api/desc/front/user.api
Normal file
@@ -0,0 +1,164 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "用户中心服务"
|
||||
desc: "用户中心服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
//============================> user v1 <============================
|
||||
// 用户基本类型定义
|
||||
type User {
|
||||
Id int64 `json:"id"`
|
||||
Mobile string `json:"mobile"`
|
||||
NickName string `json:"nickName"`
|
||||
UserType int64 `json:"userType"`
|
||||
}
|
||||
|
||||
//no need login
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: user
|
||||
)
|
||||
service main {
|
||||
@doc "mobile code login"
|
||||
@handler mobileCodeLogin
|
||||
post /user/mobileCodeLogin (MobileCodeLoginReq) returns (MobileCodeLoginResp)
|
||||
|
||||
@doc "wechat mini auth"
|
||||
@handler wxMiniAuth
|
||||
post /user/wxMiniAuth (WXMiniAuthReq) returns (WXMiniAuthResp)
|
||||
|
||||
@doc "wechat h5 auth"
|
||||
@handler wxH5Auth
|
||||
post /user/wxh5Auth (WXH5AuthReq) returns (WXH5AuthResp)
|
||||
}
|
||||
|
||||
type (
|
||||
MobileCodeLoginReq {
|
||||
Mobile string `json:"mobile"`
|
||||
Code string `json:"code" validate:"required"`
|
||||
}
|
||||
MobileCodeLoginResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
WXMiniAuthReq {
|
||||
Code string `json:"code"`
|
||||
Platform string `json:"platform,optional,default=tyc"`
|
||||
}
|
||||
WXMiniAuthResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
WXH5AuthReq {
|
||||
Code string `json:"code"`
|
||||
}
|
||||
WXH5AuthResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
)
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: user
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@doc "绑定手机号"
|
||||
@handler bindMobile
|
||||
post /user/bindMobile (BindMobileReq) returns (BindMobileResp)
|
||||
}
|
||||
|
||||
//need login
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: user
|
||||
jwt: JwtAuth
|
||||
)
|
||||
service main {
|
||||
@doc "get user info"
|
||||
@handler detail
|
||||
get /user/detail returns (UserInfoResp)
|
||||
|
||||
@doc "get new token"
|
||||
@handler getToken
|
||||
post /user/getToken returns (MobileCodeLoginResp)
|
||||
|
||||
@handler cancelOut
|
||||
post /user/cancelOut
|
||||
}
|
||||
|
||||
type (
|
||||
UserInfoResp {
|
||||
UserInfo User `json:"userInfo"`
|
||||
}
|
||||
|
||||
BindMobileReq {
|
||||
Mobile string `json:"mobile" validate:"required,mobile"`
|
||||
Code string `json:"code" validate:"required"`
|
||||
}
|
||||
BindMobileResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
)
|
||||
|
||||
//============================> auth v1 <============================
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: auth
|
||||
)
|
||||
service main {
|
||||
@doc "get mobile verify code"
|
||||
@handler sendSms
|
||||
post /auth/sendSms (sendSmsReq)
|
||||
}
|
||||
|
||||
type (
|
||||
sendSmsReq {
|
||||
Mobile string `json:"mobile" validate:"required,mobile"`
|
||||
ActionType string `json:"actionType" validate:"required,oneof=login register query realName bindMobile"`
|
||||
}
|
||||
)
|
||||
|
||||
//============================> notification v1 <============================
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: notification
|
||||
)
|
||||
service main {
|
||||
@doc "get notifications"
|
||||
@handler getNotifications
|
||||
get /notification/list returns (GetNotificationsResp)
|
||||
}
|
||||
|
||||
type Notification {
|
||||
Title string `json:"title"` // 通知标题
|
||||
Content string `json:"content"` // 通知内容 (富文本)
|
||||
NotificationPage string `json:"notificationPage"` // 通知页面
|
||||
StartDate string `json:"startDate"` // 通知开始日期,格式 "YYYY-MM-DD"
|
||||
EndDate string `json:"endDate"` // 通知结束日期,格式 "YYYY-MM-DD"
|
||||
StartTime string `json:"startTime"` // 每天通知开始时间,格式 "HH:MM:SS"
|
||||
EndTime string `json:"endTime"` // 每天通知结束时间,格式 "HH:MM:SS"
|
||||
}
|
||||
|
||||
type (
|
||||
// 获取通知响应体(分页)
|
||||
GetNotificationsResp {
|
||||
Notifications []Notification `json:"notifications"` // 通知列表
|
||||
Total int64 `json:"total"` // 总记录数
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user