|
|
@@ -89,7 +89,7 @@ func FastLoginUserExist(c *gin.Context, r *md.LoginResponse, requestBody *md.Fas |
|
|
|
_ = logx.Warn(err) |
|
|
|
return e.NewErr(400000, "数据不完整") |
|
|
|
} |
|
|
|
token := CheckUserToken(c, user.Uid, user.Username, user.Phone, appName) |
|
|
|
token := CheckUserToken(c, user, appName) |
|
|
|
r.Token = token |
|
|
|
r.UserID = utils.IntToStr(user.Uid) |
|
|
|
r.UserName = requestBody.Mobile |
|
|
@@ -108,12 +108,17 @@ func FastLoginUserExist(c *gin.Context, r *md.LoginResponse, requestBody *md.Fas |
|
|
|
} |
|
|
|
return nil |
|
|
|
} |
|
|
|
func CheckUserToken(c *gin.Context, uid int, username, phone, appName string) string { |
|
|
|
profile, err := db.UserProfileFindByID(db.DBs[c.GetString("mid")], uid) |
|
|
|
func CheckUserToken(c *gin.Context, user *model.User, appName string) string { |
|
|
|
profile, err := db.UserProfileFindByID(db.DBs[c.GetString("mid")], user.Uid) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
|
return "" |
|
|
|
} |
|
|
|
token := profile.ArkidToken |
|
|
|
// parts[1]是token |
|
|
|
_, err = utils.ParseToken(token) |
|
|
|
if err != nil { |
|
|
|
token, _ = utils.GenToken(user.Uid, user.Username, user.Phone, appName, "", "") |
|
|
|
} |
|
|
|
return token |
|
|
|
} |