代码优化
This commit is contained in:
+10
-14
@@ -26,26 +26,22 @@ func AccLogin(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
accInfo, err := srv_mwacc.AccLogin(c, req.Acc, req.Pwd, req.Code)
|
||||
accInfo, err := srv_mwacc.AccLogin(c, req.Acc, req.Pwd)
|
||||
if err != nil || accInfo == nil {
|
||||
common.ServerJSON(c, err.Code, err.Msg)
|
||||
return
|
||||
}
|
||||
|
||||
resp := MainWebLoginResp{}
|
||||
// 成功保存token
|
||||
if ok, _ := mwacc.SaveToken(c, accInfo.Id, accInfo.Token); ok != true {
|
||||
common.ServerJSON(c, srvdef.GenerateTokenFailed, srvdef.GenerateTokenFailed.Msg())
|
||||
}
|
||||
|
||||
if len(accInfo.Qurl) != 0 {
|
||||
resp.Qurl = accInfo.Qurl
|
||||
} else {
|
||||
// 成功保存token
|
||||
if ok, _ := mwacc.SaveToken(c, accInfo.Id, accInfo.Token); ok != true {
|
||||
common.ServerJSON(c, srvdef.GenerateTokenFailed, srvdef.GenerateTokenFailed.Msg())
|
||||
}
|
||||
|
||||
resp.AccId = accInfo.Id
|
||||
resp.Acc = accInfo.Acc
|
||||
resp.RoleId = accInfo.RoleId
|
||||
resp.Token = accInfo.Token
|
||||
resp := MainWebLoginResp{
|
||||
AccId: accInfo.Id,
|
||||
Acc: accInfo.Acc,
|
||||
RoleId: accInfo.RoleId,
|
||||
Token: accInfo.Token,
|
||||
}
|
||||
common.ServerJSON(c, srvdef.Success, resp)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user