|
@@ -89,15 +89,30 @@ func getLoginAccount(userName string, password string) (loginaccount *accountMod
|
|
|
// 通过手机号码查询,需要AES加密
|
|
// 通过手机号码查询,需要AES加密
|
|
|
key, _ := hex.DecodeString(utils.AESSecretKey)
|
|
key, _ := hex.DecodeString(utils.AESSecretKey)
|
|
|
if mobileEncrypted, _ := utils.AESEncrypt([]byte(userName), key); mobileEncrypted != nil {
|
|
if mobileEncrypted, _ := utils.AESEncrypt([]byte(userName), key); mobileEncrypted != nil {
|
|
|
- loginaccount = &accountModel.Loginaccount{
|
|
|
|
|
- MOBILE: string(mobileEncrypted),
|
|
|
|
|
|
|
+ // 从三方表获取LoginID
|
|
|
|
|
+ userauthinfo := &accountModel.Userauthinfo{
|
|
|
|
|
+ AUTHID: string(mobileEncrypted),
|
|
|
|
|
+ AUTHTYPE: 3,
|
|
|
}
|
|
}
|
|
|
- if has, _ := global.M2A_DB.Get(loginaccount); has {
|
|
|
|
|
- // 构建数据库存储的密码
|
|
|
|
|
- if loginaccount.PASSWORD == utils.EncoderSha256(fmt.Sprintf("%d%s", loginaccount.LOGINID, pwd)) {
|
|
|
|
|
|
|
+ if has, _ := global.M2A_DB.Get(&userauthinfo); has {
|
|
|
|
|
+ loginaccount = &accountModel.Loginaccount{
|
|
|
|
|
+ LOGINID: userauthinfo.LOGINID,
|
|
|
|
|
+ PASSWORD: utils.EncoderSha256(fmt.Sprintf("%s%s", userName, pwd)), // 构建数据库存储的密码
|
|
|
|
|
+ }
|
|
|
|
|
+ if has, _ := global.M2A_DB.Get(loginaccount); has {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // loginaccount = &accountModel.Loginaccount{
|
|
|
|
|
+ // MOBILE: string(mobileEncrypted),
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if has, _ := global.M2A_DB.Get(loginaccount); has {
|
|
|
|
|
+ // // 构建数据库存储的密码
|
|
|
|
|
+ // if loginaccount.PASSWORD == utils.EncoderSha256(fmt.Sprintf("%d%s", loginaccount.LOGINID, pwd)) {
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
err = errors.New("错误的用户名或密码")
|
|
err = errors.New("错误的用户名或密码")
|