修改登录,新增openid判断
This commit is contained in:
parent
0a88515bc6
commit
1e3bc3b3dc
@ -32,7 +32,7 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.OpenId == "" && req.Mobile == "" {
|
if req.Mobile == "" {
|
||||||
responses.FailWithMessage("登陆失败", c)
|
responses.FailWithMessage("登陆失败", c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -78,17 +78,7 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
// 检测用户信息
|
// 检测用户信息
|
||||||
userDao := dao.UserDao{}
|
userDao := dao.UserDao{}
|
||||||
maps := make(map[string]interface{})
|
maps := make(map[string]interface{})
|
||||||
if req.OpenId != "" {
|
|
||||||
maps["open_id"] = req.OpenId
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Mobile != "" {
|
|
||||||
maps["mobile"] = req.Mobile
|
maps["mobile"] = req.Mobile
|
||||||
}
|
|
||||||
|
|
||||||
if req.Uuid != "" {
|
|
||||||
maps["app_iden"] = req.Uuid
|
|
||||||
}
|
|
||||||
user, _ := userDao.GetUser(maps)
|
user, _ := userDao.GetUser(maps)
|
||||||
// 新用户处理方式
|
// 新用户处理方式
|
||||||
if user == nil {
|
if user == nil {
|
||||||
@ -164,6 +154,21 @@ func (r *Login) Login(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理用户openid
|
||||||
|
if req.OpenId != "" {
|
||||||
|
userData := make(map[string]interface{})
|
||||||
|
if req.OpenId != user.OpenId {
|
||||||
|
userData["open_id"] = req.OpenId
|
||||||
|
}
|
||||||
|
|
||||||
|
err := userDao.EditUserById(tx, user.UserId, userData)
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 处理app用户数据
|
// 处理app用户数据
|
||||||
userService := service.UserService{}
|
userService := service.UserService{}
|
||||||
err = userService.GetAppUserInfo(tx, user, userInfo)
|
err = userService.GetAppUserInfo(tx, user, userInfo)
|
||||||
|
|||||||
@ -219,6 +219,7 @@ func (r *User) GetUserCheck(c *gin.Context) {
|
|||||||
|
|
||||||
if user.Mobile != "" {
|
if user.Mobile != "" {
|
||||||
g.MobileStatus = 1
|
g.MobileStatus = 1
|
||||||
|
g.Mobile = user.Mobile
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.OpenId != "" {
|
if user.OpenId != "" {
|
||||||
|
|||||||
@ -33,6 +33,7 @@ type UserDto struct {
|
|||||||
type UserCheckDto struct {
|
type UserCheckDto struct {
|
||||||
WxStatus int `json:"wx_status"` // 微信绑定状态(0:否 1:是)
|
WxStatus int `json:"wx_status"` // 微信绑定状态(0:否 1:是)
|
||||||
MobileStatus int `json:"mobile_status"` // 手机号绑定状态(0:否 1:是)
|
MobileStatus int `json:"mobile_status"` // 手机号绑定状态(0:否 1:是)
|
||||||
|
Mobile string `json:"mobile"` // 手机号
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserDto 详情
|
// GetUserDto 详情
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user