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 { BaseIDInfo // 昵称 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,optional"` // Password Password string `json:"password"` // ClientIP ClientIP string `json:"clientIp"` // 登录方式 LoginType string `json:"loginType"` // 登录系统 LoginPlatform string `json:"loginPlatform"` } LoginResp { BaseMsgResp AuthToken *AuthToken UserInfo *UserInfo } UserInfoResp { BaseIDInfo // UserInfo information | UserInfo信息数据 Data UserInfo `json:"data"` } UserListReq { // Page PageInfo // UserName or Email or Mobile UserName *string `json:"userName,optional"` // Email or Mobile Email *string `json:"email,optional"` // Mobile Mobile *string `json:"mobile,optional"` // Status 1: normal 2: ban | 状态 1 正常 2 禁用 Status *string `json:"status,optional"` } // The response data of user list | User信息列表数据 UserListResp { BaseDataInfo // The device list data | USer信息列表数据 Data UserListInfo `json:"data"` } // The device list data | User信息列表数据 UserListInfo { BaseListInfo // The device list data | User信息列表数据 Data []UserInfo `json:"data"` } OauthAuthorizeReq {} OauthAuthorizeResp { BaseMsgResp } PassWordResetReq { // UserName or Email or Mobile UserName string `json:"userName,optional"` // Password Password string `json:"password"` } ) @server ( group: user_public ) 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) } @server ( group: user middleware: Authority ) service App { // Get userInfo detail by ID | 获取用户信息 @handler getUserInfoById post /user (IDReq) returns (UserInfo) // Get UserInfo detail By Token | 获取用户信息 @handler getUserInfoByToken post /user/info returns (UserInfo) //List userInfo | 获取用户列表 @handler listUserInfo post /user/list (UserListReq) returns (UserListResp) //Update userInfo | 更新用户信息 @handler updateUserInfo post /user/update (UserInfo) returns (BaseMsgResp) // Logout | 退出登录 不传参数,默认使用请求头的token @handler logout post /user/logout returns (BaseMsgResp) // PassWordReset | 修改密码 @handler passWordReset post /user/passWordReset (PassWordResetReq) returns (BaseDataInfo) // CheckLogin | 检测登录状态 @handler checkLogin post /user/checkLogin (IDReq) returns (BaseDataInfo) //OauthAuthorize | 第三方登录接口 @handler oauthAuthorize post /user/oauthAuthorize (OauthAuthorizeReq) returns (OauthAuthorizeResp) }