first commit
This commit is contained in:
161
app/main/api/desc/front/user.api
Normal file
161
app/main/api/desc/front/user.api
Normal file
@@ -0,0 +1,161 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "用户中心服务"
|
||||
desc: "用户中心服务"
|
||||
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"`
|
||||
}
|
||||
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 agentApply 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