Files
ycc-proxy-server/app/main/api/desc/front/user.api
2026-02-25 16:38:58 +08:00

212 lines
5.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "v1"
info (
title: "用户中心服务"
desc: "用户中心服务"
version: "v1"
)
//============================> user v1 <============================
// 用户基本类型定义
type User {
Id string `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 "unified auth"
@handler auth
post /user/auth (AuthReq) returns (AuthResp)
@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 getSignature
post /wechat/getSignature (GetSignatureReq) returns (GetSignatureResp)
}
type (
AuthReq {
Platform string `json:"platform"` // browser|wxh5|wxmini
Code string `json:"code,optional"`
}
AuthResp {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
UserType int64 `json:"userType"`
HasMobile bool `json:"hasMobile"`
IsAgent bool `json:"isAgent"`
}
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 (
GetSignatureReq {
Url string `json:"url"`
}
GetSignatureResp {
AppId string `json:"appId"`
Timestamp int64 `json:"timestamp"`
NonceStr string `json:"nonceStr"`
Signature string `json:"signature"`
}
)
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"`
IsAgent bool `json:"is_agent,optional"` // 该手机号已是代理时为 true前端可据此自动进入代理中心
}
)
//============================> 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 agentApply realName bindMobile"`
CaptchaVerifyParam string `json:"captchaVerifyParam,optional"` // 阿里云滑块验证码参数
}
)
//============================> captcha v1 <============================
@server (
prefix: api/v1
group: captcha
)
service main {
@doc "get encrypted scene id for aliyun captcha"
@handler getEncryptedSceneId
post /captcha/encryptedSceneId returns (GetEncryptedSceneIdResp)
}
type (
GetEncryptedSceneIdResp {
EncryptedSceneId string `json:"encryptedSceneId"`
}
)
//============================> 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"` // 总记录数
}
)