This commit is contained in:
2025-04-27 12:17:18 +08:00
parent b60f6ffb3e
commit 2aea96db2c
128 changed files with 396 additions and 222 deletions

View File

@@ -0,0 +1,16 @@
syntax = "v1"
info (
title: "认证服务"
desc: "认证服务"
author: "Liangzai"
email: "2440983361@qq.com"
)
type (
sendSmsReq {
Mobile string `json:"mobile" validate:"required,mobile"`
ActionType string `json:"actionType" validate:"required,oneof=login register query"`
}
)

View File

@@ -0,0 +1,45 @@
syntax = "v1"
info (
title: "支付服务"
desc: "支付服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
import (
"pay/pay.api"
)
@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: SourceInterceptor
)
service main {
// 支付
@handler Payment
post /pay/payment (PaymentReq) returns (PaymentResp)
@handler IapCallback
post /pay/iap_callback (IapCallbackReq)
}

View File

@@ -0,0 +1,28 @@
syntax = "v1"
info (
title: "产品支付服务"
desc: "产品支付服务"
author: "Liangzai"
email: "2440983361@qq.com"
)
type (
PaymentReq {
Id string `json:"id"`
PayMethod string `json:"pay_method"`
}
PaymentResp {
prepayData interface{} `json:"prepay_data"`
prepayId string `json:"prepay_id"`
OrderID int64 `json:"order_id"`
}
)
type (
IapCallbackReq {
OrderID int64 `json:"order_id" validate:"required"`
TransactionReceipt string `json:"transaction_receipt" validate:"required"`
}
)

View File

@@ -0,0 +1,35 @@
syntax = "v1"
info (
title: "产品服务"
desc: "产品服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
import (
"product/product.api"
)
@server (
prefix: api/v1/product
group: product
jwt: JwtAuth
)
service main {
@handler GetProductByID
get /:id (GetProductByIDRequest) returns (ProductResponse)
@handler GetProductByEn
get /en/:product_en (GetProductByEnRequest) returns (ProductResponse)
}
@server (
prefix: api/v1/product
group: product
middleware: SourceInterceptor
)
service main {
@handler GetProductRenderList
get /render_list/:module (GetProductRenderListRequest) returns (GetProductRenderListResponse)
}

View File

@@ -0,0 +1,43 @@
syntax = "v1"
info (
title: "产品查询服务"
desc: "产品查询服务"
author: "Liangzai"
email: "2440983361@qq.com"
)
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"` // 关联功能列表
}
type Feature {
ID int64 `json:"id"` // 功能ID
ApiID string `json:"api_id"` // API标识
Name string `json:"name"` // 功能描述
}
type GetProductByIDRequest {
Id int64 `path:"id"`
}
type GetProductByEnRequest {
ProductEn string `path:"product_en"`
}
type ProductResponse {
Product
}
type GetProductRenderListRequest{
module string `path:"module"`
}
type GetProductRenderListResponse {
Product []Product
}

View File

@@ -0,0 +1,74 @@
syntax = "v1"
info (
title: "产品查询服务"
desc: "产品查询服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
import (
"query/query.api"
)
//============================> query v1 <============================
@server (
prefix: api/v1
group: query
jwt: JwtAuth
)
service main {
@doc "query service"
@handler queryService
post /query/service/:product (QueryServiceReq) returns (QueryServiceResp)
}
@server (
prefix: api/v1
group: query
jwt: JwtAuth
)
service main {
@doc "获取查询临时订单"
@handler queryProvisionalOrder
get /query/provisional_order/:id (QueryProvisionalOrderReq) returns (QueryProvisionalOrderResp)
@doc "查询示例"
@handler queryExample
get /query/example (QueryExampleReq) returns (QueryExampleResp)
@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 queryDetail
get /query/:id (QueryDetailReq) returns (QueryDetailResp)
@doc "重试查询"
@handler queryRetry
post /query/retry/:id (QueryRetryReq) returns (QueryRetryResp)
}
@server (
prefix: api/v1
group: query
)
service main {
@handler querySingleTest
post /query/single/test (QuerySingleTestReq) returns (QuerySingleTestResp)
@doc "更新查询数据"
@handler updateQueryData
post /query/update_data (UpdateQueryDataReq) returns (UpdateQueryDataResp)
}

View File

@@ -0,0 +1,128 @@
syntax = "v1"
info (
title: "产品查询服务"
desc: "产品查询服务"
author: "Liangzai"
email: "2440983361@qq.com"
)
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"`
}
QueryServiceResp {
id string `json:"id"`
}
)
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 (
QueryProvisionalOrderReq {
Id string `path:"id"`
}
QueryProvisionalOrderResp {
QueryParams map[string]interface{} `json:"query_params"`
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 (
QueryDetailReq {
Id int64 `path:"id"`
}
QueryDetailResp {
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 {}
)
type QuerySingleTestReq {
params map[string]interface{} `json:"params"`
Api string `json:"api"`
}
type QuerySingleTestResp {
Data interface{} `json:"data"`
Api string `json:"api"`
}
type (
UpdateQueryDataReq {
Id int64 `json:"id"` // 查询ID
QueryData string `json:"query_data"` // 查询数据(未加密的JSON)
}
UpdateQueryDataResp {
Id int64 `json:"id"`
UpdatedAt string `json:"updated_at"` // 更新时间
}
)

View File

@@ -0,0 +1,85 @@
syntax = "v1"
info (
title: "用户中心服务"
desc: "用户中心服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
import (
"user/user.api"
"auth/auth.api"
)
//============================> user v1 <============================
//no need login
@server (
prefix: api/v1
group: user
)
service main {
@doc "register"
@handler register
post /user/register (RegisterReq) returns (RegisterResp)
@doc "mobile login"
@handler mobileLogin
post /user/mobileLogin (MobileLoginReq) returns (MobileLoginResp)
@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)
@handler DecryptMobile
post /user/decryptMobile
}
//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)
}
//============================> auth v1 <============================
@server (
prefix: api/v1
group: auth
)
service main {
@doc "get mobile verify code"
@handler sendSms
post /auth/sendSms (sendSmsReq)
}
//============================> notification v1 <============================
@server (
prefix: api/v1
group: notification
)
service main {
@doc "get notifications"
@handler getNotifications
get /notification/list returns (GetNotificationsResp)
}

View File

@@ -0,0 +1,95 @@
syntax = "v1"
info (
title: "用户实例"
desc: "用户实例"
author: "Liangzai"
email: "2440983361@qq.com"
)
type User {
Id int64 `json:"id"`
Mobile string `json:"mobile"`
NickName string `json:"nickName"`
}
type (
RegisterReq {
Mobile string `json:"mobile" validate:"required,mobile"`
Password string `json:"password" validate:"required,min=11,max=11,password"`
Code string `json:"code" validate:"required"`
}
RegisterResp {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
)
type (
MobileLoginReq {
Mobile string `json:"mobile" validate:"required,mobile"`
Password string `json:"password" validate:"required"`
}
MobileLoginResp {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
)
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"`
}
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"`
}
)
type (
UserInfoResp {
UserInfo User `json:"userInfo"`
}
)
//============================> notification v1 <============================
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"` // 总记录数
}
)