qnc-server-tob/app/user/cmd/api/desc/user.api

233 lines
5.9 KiB
Plaintext
Raw Normal View History

2025-01-10 00:09:25 +08:00
syntax = "v1"
info (
title: "用户中心服务"
desc: "用户中心服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
//============================> user v1 <============================
2025-03-17 15:59:09 +08:00
// 用户基本类型定义
type User {
Id int64 `json:"id"`
Mobile string `json:"mobile"`
NickName string `json:"nickName"`
}
2025-01-10 00:09:25 +08:00
//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)
2025-03-07 03:48:59 +08:00
@doc "agent mobile code login"
@handler agentMobileCodeLogin
post /user/agent_mobile_code_login (MobileCodeLoginReq) returns (MobileCodeLoginResp)
2025-01-10 00:09:25 +08:00
@doc "wechat mini auth"
@handler wxMiniAuth
post /user/wxMiniAuth (WXMiniAuthReq) returns (WXMiniAuthResp)
@doc "wechat h5 auth"
@handler wxH5Auth
post /user/wxh5Auth (WXH5AuthReq) returns (WXH5AuthResp)
}
2025-03-17 15:59:09 +08:00
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"`
IV string `json:"iv"`
EncryptedData string `json:"encryptedData"`
}
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"`
}
)
2025-01-10 00:09:25 +08:00
//need login
@server (
prefix: api/v1
group: user
jwt: JwtAuth
)
service main {
@doc "get user info"
@handler detail
2025-03-07 03:48:59 +08:00
get /user/detail returns (UserInfoResp)
2025-01-10 00:09:25 +08:00
2025-03-07 03:48:59 +08:00
@doc "get new token"
@handler getToken
post /user/getToken returns (MobileCodeLoginResp)
2025-03-15 01:33:31 +08:00
@handler cancelOut
post /user/cancelOut
2025-05-10 02:10:11 +08:00
@doc "绑定手机号"
@handler bindMobile
post /user/bindMobile (BindMobileReq) returns (BindMobileResp)
2025-01-10 00:09:25 +08:00
}
2025-03-17 15:59:09 +08:00
type (
UserInfoResp {
UserInfo User `json:"userInfo"`
}
2025-05-10 02:10:11 +08:00
BindMobileReq {
Mobile string `json:"mobile" validate:"required,mobile"`
Code string `json:"code" validate:"required"`
}
BindMobileResp {
}
2025-03-17 15:59:09 +08:00
)
2025-01-10 00:09:25 +08:00
//============================> auth v1 <============================
@server (
2025-05-24 14:26:20 +08:00
prefix: api/v1/auth
2025-01-10 00:09:25 +08:00
group: auth
)
service main {
@doc "get mobile verify code"
@handler sendSms
2025-05-24 14:26:20 +08:00
post /sendSms (sendSmsReq)
@doc "发起人脸认证"
@handler initFaceVerify
post /face/init (InitFaceVerifyReq) returns (InitFaceVerifyResp)
@doc "查询人脸认证结果"
@handler getFaceVerifyResult
post /face/result (GetFaceVerifyResultReq) returns (GetFaceVerifyResultResp)
@doc "第三方拒绝授权"
@handler rejectAuthorization
post /rejectAuthorization (RejectAuthorizationReq) returns (RejectAuthorizationResp)
2025-01-10 00:09:25 +08:00
}
2025-03-17 15:59:09 +08:00
type (
sendSmsReq {
Mobile string `json:"mobile" validate:"required,mobile"`
2025-05-24 14:26:20 +08:00
ActionType string `json:"actionType" validate:"required,oneof=login register query agentApply bindMobile realName"`
}
// 发起人脸认证请求
InitFaceVerifyReq {
MetaInfo string `json:"meta_info" validate:"required"` // H5端获取的MetaInfoJSON格式
OrderNo string `json:"order_no" validate:"required"` // 订单号
AuthType int64 `json:"auth_type" validate:"required"` // 认证类型
2025-03-17 15:59:09 +08:00
}
2025-05-24 14:26:20 +08:00
// 发起人脸认证响应
InitFaceVerifyResp {
CertifyId string `json:"certify_id"` // 认证ID
CertifyUrl string `json:"certify_url"` // 跳转认证页面URL
}
// 查询人脸认证结果请求
GetFaceVerifyResultReq {
CertifyId string `json:"certify_id" validate:"required"` // 认证ID
}
// 查询人脸认证结果响应
GetFaceVerifyResultResp {
Passed bool `json:"passed"` // 是否通过
OrderID int64 `json:"order_id"`
AuthType int64 `json:"auth_type"`
}
RejectAuthorizationReq {
OrderNo string `json:"order_no" validate:"required"` // 订单号
}
RejectAuthorizationResp {
}
)
2025-01-10 00:09:25 +08:00
//============================> notification v1 <============================
@server (
prefix: api/v1
group: notification
)
service main {
@doc "get notifications"
@handler getNotifications
get /notification/list returns (GetNotificationsResp)
2025-03-07 03:48:59 +08:00
}
2025-03-17 15:59:09 +08:00
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"` // 总记录数
}
)