first
This commit is contained in:
16
app/user/cmd/api/desc/auth/auth.api
Normal file
16
app/user/cmd/api/desc/auth/auth.api
Normal 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"`
|
||||
}
|
||||
)
|
||||
|
||||
58
app/user/cmd/api/desc/user.api
Normal file
58
app/user/cmd/api/desc/user.api
Normal file
@@ -0,0 +1,58 @@
|
||||
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: user/v1
|
||||
group: user
|
||||
)
|
||||
service user {
|
||||
@doc "register"
|
||||
@handler register
|
||||
post /user/register (RegisterReq) returns (RegisterResp)
|
||||
|
||||
@doc "login"
|
||||
@handler login
|
||||
post /user/login (LoginReq) returns (LoginResp)
|
||||
}
|
||||
|
||||
//need login
|
||||
@server (
|
||||
prefix: user/v1
|
||||
group: user
|
||||
jwt: JwtAuth
|
||||
)
|
||||
service user {
|
||||
@doc "get user info"
|
||||
@handler detail
|
||||
post /user/detail (UserInfoReq) returns (UserInfoResp)
|
||||
|
||||
@doc "wechat mini auth"
|
||||
@handler wxMiniAuth
|
||||
post /user/wxMiniAuth (WXMiniAuthReq) returns (WXMiniAuthResp)
|
||||
}
|
||||
|
||||
//============================> auth v1 <============================
|
||||
@server (
|
||||
prefix: auth/v1
|
||||
group: auth
|
||||
)
|
||||
service user {
|
||||
@doc "get mobile verify code"
|
||||
@handler sendSms
|
||||
post /auth/sendSms (sendSmsReq)
|
||||
}
|
||||
|
||||
58
app/user/cmd/api/desc/user/user.api
Normal file
58
app/user/cmd/api/desc/user/user.api
Normal file
@@ -0,0 +1,58 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "用户实例"
|
||||
desc: "用户实例"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
)
|
||||
|
||||
type User {
|
||||
Id int64 `json:"id"`
|
||||
Mobile string `json:"mobile"`
|
||||
}
|
||||
|
||||
type (
|
||||
RegisterReq {
|
||||
Mobile string `json:"mobile" validate:"required,mobile"`
|
||||
Password string `json:"password" validate:"required"`
|
||||
}
|
||||
RegisterResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
LoginReq {
|
||||
Mobile string `json:"mobile"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
LoginResp {
|
||||
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 (
|
||||
UserInfoReq {}
|
||||
UserInfoResp {
|
||||
UserInfo User `json:"userInfo"`
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user