登录时设置手机号和openid为必填
This commit is contained in:
parent
f66d50d142
commit
d68fab94cd
@ -32,18 +32,6 @@ func (r *Login) Login(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.OpenId == "" && req.Mobile == "" {
|
||||
responses.FailWithMessage("登陆失败", c)
|
||||
return
|
||||
}
|
||||
|
||||
if req.Source == 1 {
|
||||
if req.Mobile != "" {
|
||||
responses.FailWithMessage("登陆失败", c)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
|
||||
@ -6,10 +6,10 @@ type LoginRequest struct {
|
||||
|
||||
// Login 登录
|
||||
type Login struct {
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号" validate:"required"`
|
||||
Code string `json:"code" form:"code" label:"验证码"`
|
||||
Source int `json:"source" form:"source" label:"来源" validate:"required"` // (1:app 2:公众号)
|
||||
OpenId string `json:"openid" form:"openid" label:"openid"`
|
||||
OpenId string `json:"openid" form:"openid" label:"openid" validate:"required"`
|
||||
Nickname string `json:"nickname" form:"nickname" label:"用户昵称"`
|
||||
HeadImgUrl string `json:"headimgurl" form:"headimgurl" label:"头像"`
|
||||
UnionId string `json:"unionid" form:"unionid" label:"unionid"`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user