登录fix bug

This commit is contained in:
Jack 2025-09-04 10:23:07 +08:00
parent 3837f9e787
commit 2156332b34
3 changed files with 7 additions and 8 deletions

View File

@ -260,7 +260,7 @@ public class LoginController extends BaseControllerImpl {
return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, cid, osType); return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, cid, osType);
} }
@ApiOperation(value = "微信用户一键登录注册") @ApiOperation(value = "微信用户一键登录注册")
@RequestMapping(value = "/doWxUserRegisterAndLogin", method = RequestMethod.POST) @RequestMapping(value = "/doWxUserRegisterAndLogin", method = RequestMethod.POST)
public CommonResult doWxUserRegisterAndLogin(@RequestBody WxUserInfoReq wxUserInfoReq) { public CommonResult doWxUserRegisterAndLogin(@RequestBody WxUserInfoReq wxUserInfoReq) {
return accountUserBaseService.doWxUserRegisterAndLogin(wxUserInfoReq); return accountUserBaseService.doWxUserRegisterAndLogin(wxUserInfoReq);

View File

@ -2429,7 +2429,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
* 根据账号和账号类型获取一条记录 * 根据账号和账号类型获取一条记录
* *
* @param userAccount 用户账号 * @param userAccount 用户账号
* @param userIsAdmin 用户类型: null-普通用户; 1-管理员; 2-入驻商家; * @param userIsAdmin 用户类型: null or 0-普通用户; 1-管理员; 2-入驻商家;
* @return AccountUserBase 用户基础信息如果未找到则返回null * @return AccountUserBase 用户基础信息如果未找到则返回null
*/ */
public AccountUserBase getByAccountAndType(String userAccount, Integer userIsAdmin) { public AccountUserBase getByAccountAndType(String userAccount, Integer userIsAdmin) {
@ -3019,7 +3019,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
// 检查输入字符是不是包含 sql 注入特征如果包含不给以通过 // 检查输入字符是不是包含 sql 注入特征如果包含不给以通过
if (!CommonService.isValidInput(wxUserInfoReq.getPhoneNumber(), wxUserInfoReq.getOpenId())) { if (!CommonService.isValidInput(wxUserInfoReq.getPhoneNumber(), wxUserInfoReq.getOpenId())) {
// new ApiException(ResultCode.VALIDATE_INPUTS);
return CommonResult.failed(ResultCode.VALIDATE_INPUTS); return CommonResult.failed(ResultCode.VALIDATE_INPUTS);
} }
@ -3061,7 +3060,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
accountUserBase.setRights_group_id("0");// 店铺管理员,店铺 权限 accountUserBase.setRights_group_id("0");// 店铺管理员,店铺 权限
if (!saveOrUpdate(accountUserBase)) { if (!saveOrUpdate(accountUserBase)) {
return CommonResult.failed(_("用户注册失败!")); return CommonResult.failed(_("微信注册账号失败!"));
} }
Integer userId = accountUserBase.getUser_id(); Integer userId = accountUserBase.getUser_id();
@ -3153,7 +3152,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.getBindByBindId(mobile, BindCode.MOBILE, CommonConstant.USER_TYPE_NORMAL); AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.getBindByBindId(mobile, BindCode.MOBILE, CommonConstant.USER_TYPE_NORMAL);
if (accountUserBindConnect == null || !Objects.equals(accountUserBase.getUser_id(), accountUserBindConnect.getUser_id())) { if (accountUserBindConnect == null || !Objects.equals(accountUserBase.getUser_id(), accountUserBindConnect.getUser_id())) {
// 先绑定手机号 // 先绑定手机号
if (accountUserBindConnectService.bindMobileAndOpenId(wxUserInfoReq, accountUserBase.getUser_id(), accountUserBase.getUser_is_admin()) == null) { if (accountUserBindConnectService.bindMobileAndOpenId(wxUserInfoReq, accountUserBase.getUser_id(), CommonConstant.USER_TYPE_NORMAL) == null) {
return CommonResult.failed(_("账号绑定失败!")); return CommonResult.failed(_("账号绑定失败!"));
} }
} }
@ -3163,7 +3162,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
params.put("client_id", AuthConstant.MOBILE_CLIENT_ID); params.put("client_id", AuthConstant.MOBILE_CLIENT_ID);
params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET); params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET);
params.put("grant_type", "password"); params.put("grant_type", "password");
params.put("verify_pwd", "1001"); // 是否验证密码 1001不验证1002验证内部登录没有用户明文密码只能不验证 params.put("verify_pwd", "1001"); // 是否验证密码 1001-不验证1002-验证内部登录没有用户明文密码只能不验证
params.put("username", mobile); params.put("username", mobile);
params.put("password", ""); params.put("password", "");
params.put("user_mobile", mobile); params.put("user_mobile", mobile);

View File

@ -397,7 +397,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
.eq("bind_active", CommonConstant.Enable) .eq("bind_active", CommonConstant.Enable)
.orderByAsc("bind_time"); .orderByAsc("bind_time");
AccountUserBindConnect accountUserBindConnect = findOne(queryWrapper); AccountUserBindConnect accountUserBindConnect = getOne(queryWrapper);
if (accountUserBindConnect != null) { if (accountUserBindConnect != null) {
return accountUserBindConnect; return accountUserBindConnect;
} }
@ -411,7 +411,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
record.setBind_openid(wxUserInfoReq.getOpenId()); record.setBind_openid(wxUserInfoReq.getOpenId());
record.setBind_unionid(wxUserInfoReq.getUnionId()); record.setBind_unionid(wxUserInfoReq.getUnionId());
record.setBind_gender(wxUserInfoReq.getGender()); record.setBind_gender(wxUserInfoReq.getGender());
record.setBind_nickname(wxUserInfoReq.getNickName()); record.setBind_nickname(wxUserInfoReq.getNickName() + mobile);
record.setBind_icon(wxUserInfoReq.getAvatarUrl()); record.setBind_icon(wxUserInfoReq.getAvatarUrl());
record.setBind_country(wxUserInfoReq.getCountry()); record.setBind_country(wxUserInfoReq.getCountry());
record.setBind_province(wxUserInfoReq.getProvince()); record.setBind_province(wxUserInfoReq.getProvince());