|
@@ -4,7 +4,6 @@ import (
|
|
|
"encoding/json"
|
|
|
"hongze/hongze_mobile_admin/models/request/admin"
|
|
|
admin3 "hongze/hongze_mobile_admin/models/response/admin"
|
|
|
- admin2 "hongze/hongze_mobile_admin/models/tables/admin"
|
|
|
"hongze/hongze_mobile_admin/models/tables/h5_admin_session"
|
|
|
"hongze/hongze_mobile_admin/services"
|
|
|
"hongze/hongze_mobile_admin/utils"
|
|
@@ -36,38 +35,22 @@ func (this *AdminCommon) Login() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- sysUser, err := admin2.CheckAdmin(req.Username, req.Password)
|
|
|
- if err != nil {
|
|
|
- if err.Error() == utils.ErrNoRow() {
|
|
|
- this.FailWithMessage("登录失败,账号或密码错误", "登录失败,账号或密码错误,Err:"+err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- this.FailWithMessage("登录失败,账号或密码错误", "登录失败,Err:"+err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- if sysUser == nil {
|
|
|
- this.FailWithMessage("登录失败,账号或密码错误", "登录失败,admin_wx is nil")
|
|
|
- return
|
|
|
- }
|
|
|
- if sysUser.Enabled == 0 {
|
|
|
- this.FailWithMessage("您的账号已被禁用,如需登录,请联系管理员", "您的账号已被禁用,如需登录,请联系管理员")
|
|
|
- return
|
|
|
- }
|
|
|
- err = h5_admin_session.UpdateSession(this.Session.SessionId, sysUser.AdminId, time.Now().AddDate(0, 0, 90))
|
|
|
+ adminWx, err := services.BindWxUser(this.Session.OpenId, req.Username, req.Password, utils.WxPlatform)
|
|
|
+ err = h5_admin_session.UpdateSession(this.Session.SessionId, adminWx.AdminId, time.Now().AddDate(0, 0, 90))
|
|
|
if err != nil {
|
|
|
this.FailWithMessage("登录失败", "变更session信息失败,Err:"+err.Error())
|
|
|
return
|
|
|
}
|
|
|
resp := admin3.LoginResp{
|
|
|
- RealName: sysUser.RealName,
|
|
|
- AdminName: sysUser.AdminName,
|
|
|
- RoleName: sysUser.RoleName,
|
|
|
- RoleTypeCode: sysUser.RoleTypeCode,
|
|
|
+ RealName: adminWx.RealName,
|
|
|
+ AdminName: adminWx.AdminName,
|
|
|
+ RoleName: adminWx.RoleName,
|
|
|
+ RoleTypeCode: adminWx.RoleTypeCode,
|
|
|
}
|
|
|
|
|
|
- resp.AdminId = sysUser.AdminId
|
|
|
+ resp.AdminId = adminWx.AdminId
|
|
|
var productName string
|
|
|
- productId := services.GetProductId(sysUser.RoleTypeCode)
|
|
|
+ productId := services.GetProductId(adminWx.RoleTypeCode)
|
|
|
|
|
|
if productId == 1 {
|
|
|
productName = utils.COMPANY_PRODUCT_FICC_NAME
|
|
@@ -77,6 +60,6 @@ func (this *AdminCommon) Login() {
|
|
|
productName = "admin"
|
|
|
}
|
|
|
resp.ProductName = productName
|
|
|
- resp.Authority = sysUser.Authority
|
|
|
+ resp.Authority = adminWx.Authority
|
|
|
this.OkDetailed(resp, "登录成功")
|
|
|
}
|