修改了登录增加了app登录方式
This commit is contained in:
+13
-2
@@ -37,6 +37,13 @@ func (r *Login) Login(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.Source == 1 {
|
||||
if req.Mobile != "" {
|
||||
responses.FailWithMessage("登陆失败", c)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
@@ -59,11 +66,15 @@ func (r *Login) Login(c *gin.Context) {
|
||||
if req.Mobile != "" {
|
||||
maps["mobile"] = req.Mobile
|
||||
}
|
||||
|
||||
if req.Uuid != "" {
|
||||
maps["app_iden"] = req.Uuid
|
||||
}
|
||||
user, _ := userDao.GetUser(maps)
|
||||
// 新用户处理方式
|
||||
if user == nil {
|
||||
// 检测验证码
|
||||
if req.Mobile != "" {
|
||||
if req.Source == 1 {
|
||||
if config.C.Env != "dev" {
|
||||
code, _ := global.Redis.Get(c, "login_code_count_"+req.Mobile).Result()
|
||||
if code == "" {
|
||||
@@ -94,7 +105,7 @@ func (r *Login) Login(c *gin.Context) {
|
||||
// 新增用户
|
||||
user = &model.User{
|
||||
UserName: req.Nickname,
|
||||
AppIden: "",
|
||||
AppIden: req.Uuid,
|
||||
Mobile: req.Mobile,
|
||||
RegisterSource: req.Source,
|
||||
OpenId: req.OpenId,
|
||||
|
||||
Reference in New Issue
Block a user