syntax = "v1" info ( title: "type title here" desc: "type desc here" author: "type author here" email: "type email here" version: "type version here" ) type ( VerifyCodeReq { //验证码类型 VerifyCodeType uint8 `json:"verifyCodeType,optional"` // 账户注册类型:手机或邮箱 AccountType uint8 `json:"accountType,optional"` // 手机号或邮箱地址 Value string `json:"value,optional"` } VerifyCodeResp { // 验证码 CaptchaCode string `json:"captchaCode,optional"` // 过期时间 ExpireTime uint32 `json:"expireTime,optional"` } RegisterReq { // 账户注册类型:手机或邮箱 AccountType uint8 `json:"accountType,optional"` // 手机号或邮箱地址注册 Value string `json:"value,optional"` // 昵称 NickName string `json:"nickName,optional"` // 性别 Sex uint8 `json:"sex,optional"` //生日 Birthday uint32 `json:"birthday,optional"` // 密码加密后的值 PasswordHash *string `json:"passwordHash,optional"` //验证码 Captcha string `json:"captcha,optional"` // 验证码ID CaptchaId string `json:"captchaId,optional"` //VerificationType 类型 1 手机 2 邮箱 VerificationType *uint32 `json:"verificationType,optional"` // Gender male or female or other , 男,女,其他 Gender *string `json:"gender,optional"` // 注册来源 app,pc RegisterSource *string `json:"registerSource,optional"` } RegisterResp{ // token信息 AuthToken *AuthToken `json:"authToken,optional"` User *UserInfo `json:"userInfo,optional"` } AuthToken{ // access_token AccessToken string `json:"accessToken,optional"` // refresh_token RefreshToken string `json:"refreshToken,optional"` // token_type 类型 TokenType string `json:"tokenType,optional"` //access_token_expires AccessTokenExpires int64 `json:"accessTokenExpires,optional"` //refresh_token_expires RefreshTokenExpires int64 `json:"refreshTokenExpires,optional"` } UserInfo{ // 用户ID Id uint64 `json:"id,optional"` // 昵称 NickName string `json:"nickName,optional"` //生日 Birthday int64 `json:"birthday,optional"` // 头像 Avatar string `json:"avatar,optional"` // Gender male or female or other , 男,女,其他 Gender *string `json:"gender,optional"` // 账户注册类型: // 1 手机 2 邮箱 RegisterType *uint32 `json:"registerType,optional"` // 手机号 Mobile *string `json:"mobile,optional"` // 用户名 Username string `json:"username,optional"` //邮箱 Email *string `json:"email,optional"` } LoginReq{ // UserName or Email or Mobile UserName string `json:"userName"` // Password Password string `json:"password"` // ClientIP ClientIP string `json:"clientIp"` // 登录方式 LoginType string `json:"loginType"` // 登录系统 LoginPlatform string `json:"loginPlatform"` } LoginResp{ BaseMsgResp AuthToken *AuthToken UserInfo *UserInfo } ) @server ( jwt: Auth group: user middleware: Authority ) service App { // GetVerifyCode | 获取验证码 @handler getVerifyCode post /get/verifyCode (VerifyCodeReq) returns (VerifyCodeResp) // Register | 注册 @handler register post /register (RegisterReq) returns (RegisterResp) // Login | 登录 @handler login post /login (LoginReq) returns (LoginResp) }