1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import "../base.api"
- type (
- // The log in information | 登陆返回的数据信息
- LoginInfo {
- // User's UUID | 用户的UUID
- UserId string `json:"userId"`
- // Token for authorization | 验证身份的token
- Token string `json:"token"`
- // Expire timestamp | 过期时间戳
- Expire uint64 `json:"expire"`
- }
- // The permission code for front end permission control | 权限码: 用于前端权限控制
- PermCodeResp {
- BaseDataInfo
- // Permission code data | 权限码数据
- Data []string `json:"data"`
- }
- // Login request | 登录参数
- LoginReq {
- // User Name | 用户名
- Username string `json:"username" validate:"required,alphanum,max=20"`
- // Password | 密码
- Password string `json:"password" validate:"required,max=30,min=6"`
- // Captcha ID which store in redis | 验证码编号, 存在redis中
- CaptchaId string `json:"captchaId" validate:"required,len=20"`
- // The Captcha which users input | 用户输入的验证码
- Captcha string `json:"captcha" validate:"required,len=5"`
- }
- // Log in by email request | 邮箱登录参数
- LoginByEmailReq {
- // The user's email address | 用户的邮箱
- Email string `json:"email" validate:"required,email,max=100"`
- // The Captcha which users input | 用户输入的验证码
- Captcha string `json:"captcha,optional" validate:"omitempty,len=5"`
- }
- // Log in by SMS request | 短信登录参数
- LoginBySmsReq {
- // The user's mobile phone number | 用户的手机号码
- PhoneNumber string `json:"phoneNumber" validate:"required,numeric,max=20"`
- // The Captcha which users input | 用户输入的验证码
- Captcha string `json:"captcha,optional" validate:"omitempty,len=5"`
- }
- // The log in response data | 登录返回数据
- LoginResp {
- BaseDataInfo
- // The log in information | 登陆返回的数据信息
- Data LoginInfo `json:"data"`
- }
- )
- @server(
- group: auth
- )
- service Wechat {
- // Log in | 登录
- @handler login
- post /user/login (LoginReq) returns (LoginResp)
- // Log in by email | 邮箱登录
- @handler loginByEmail
- post /user/login_by_email (LoginByEmailReq) returns (LoginResp)
- // Log in by SMS | 短信登录
- @handler loginBySms
- post /user/login_by_sms (LoginBySmsReq) returns (LoginResp)
- }
|