推送绑定逻辑 fix bug

This commit is contained in:
Jack 2025-08-15 11:07:26 +08:00
parent 240c5a5888
commit 826af239e6
4 changed files with 13 additions and 12 deletions

View File

@ -261,7 +261,7 @@ public class LoginController extends BaseControllerImpl {
} }
String cid = paramJSON.getStr("cid"); String cid = paramJSON.getStr("cid");
String osType = paramJSON.getStr("osType"); String osType = paramJSON.getStr("os_type");
return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, cid, osType); return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, cid, osType);
} }
@ -297,7 +297,7 @@ public class LoginController extends BaseControllerImpl {
return accountUserBaseService.doMerchSmsRegisterAndLogin(paramJSON.getStr("user_mobile"), return accountUserBaseService.doMerchSmsRegisterAndLogin(paramJSON.getStr("user_mobile"),
paramJSON.getStr("rand_key"), paramJSON.getStr("rand_key"),
paramJSON.getStr("verify_code"), paramJSON.getStr("verify_code"),
paramJSON.getStr("cid"), paramJSON.getStr("osType")); paramJSON.getStr("cid"), paramJSON.getStr("os_type"));
} }
@ApiOperation("退出登录") @ApiOperation("退出登录")

View File

@ -151,7 +151,7 @@ public class AccountUserBaseController extends BaseControllerImpl {
@RequestParam(name = "verify_code") String verificationCode, @RequestParam(name = "verify_code") String verificationCode,
@RequestParam(name = "verify_token") String verify_token, @RequestParam(name = "verify_token") String verify_token,
@RequestParam(name = "cid", required = false) String cid, @RequestParam(name = "cid", required = false) String cid,
@RequestParam(name = "osType", required = false) String osType) { @RequestParam(name = "os_type", required = false) String osType) {
if (StringUtils.isAnyBlank(user_account, user_password)) { if (StringUtils.isAnyBlank(user_account, user_password)) {
return CommonResult.failed(I18nUtil._("用户名或密码不能为空!")); return CommonResult.failed(I18nUtil._("用户名或密码不能为空!"));
} }
@ -203,7 +203,7 @@ public class AccountUserBaseController extends BaseControllerImpl {
if (StrUtil.isNotBlank(cid)) { if (StrUtil.isNotBlank(cid)) {
params.put("cid", cid); // 个推客户端Id params.put("cid", cid); // 个推客户端Id
params.put("osType", osType);// 个推客系统类别 1-Android2-iOS;3-微信小程序 params.put("os_type", osType);// 个推客系统类别 1-Android2-iOS;3-微信小程序
} }
return accountUserBaseService.login(params); return accountUserBaseService.login(params);

View File

@ -3132,7 +3132,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
params.put("verify_pwd", StrUtil.isBlank(password) ? "1001" : "1002"); // 是否验证密码 1001不验证1002验证内部登录没有用户明文密码只能不验证 params.put("verify_pwd", StrUtil.isBlank(password) ? "1001" : "1002"); // 是否验证密码 1001不验证1002验证内部登录没有用户明文密码只能不验证
params.put("username", user_base_row.getUser_account()); params.put("username", user_base_row.getUser_account());
params.put("password", password); params.put("password", password);
params.put("osType", getParameter("osType")); params.put("os_type", getParameter("os_type"));
return login(params); return login(params);
} else { } else {
// 手机号码未绑定的情况, 直接抛出异常 // 手机号码未绑定的情况, 直接抛出异常
@ -3201,7 +3201,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
if (StrUtil.isNotBlank(cid)) { if (StrUtil.isNotBlank(cid)) {
params.put("cid", cid); // 个推客户端Id params.put("cid", cid); // 个推客户端Id
params.put("osType", osType);// 个推客系统类别 1-Android2-iOS;3-微信小程序 params.put("os_type", osType);// 个推客系统类别 1-Android2-iOS;3-微信小程序
// logger.info("推送参数2 cid:{} osType{}", cid, osType); // logger.info("推送参数2 cid:{} osType{}", cid, osType);
} }

View File

@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -30,24 +31,23 @@ public class AccountUserBindGeTuiServiceImpl extends BaseServiceImpl<UserDeviceB
// 检查参数是否有效 // 检查参数是否有效
if (ObjectUtil.isNull(accountUserBindGeTui) || if (ObjectUtil.isNull(accountUserBindGeTui) ||
StrUtil.isBlank(accountUserBindGeTui.getCid()) || StrUtil.isBlank(accountUserBindGeTui.getCid()) ||
CheckUtil.isEmpty(accountUserBindGeTui.getUserId()) CheckUtil.isEmpty(accountUserBindGeTui.getUserId())) {
|| CheckUtil.isEmpty(accountUserBindGeTui.getUserType())) { log.error("缺少必要参数cid={}, userId={}",
log.error("缺少必要参数cid={}, userId={}, userType={}",
accountUserBindGeTui != null ? accountUserBindGeTui.getCid() : null, accountUserBindGeTui != null ? accountUserBindGeTui.getCid() : null,
accountUserBindGeTui != null ? accountUserBindGeTui.getUserId() : null, accountUserBindGeTui != null ? accountUserBindGeTui.getUserId() : null);
accountUserBindGeTui != null ? accountUserBindGeTui.getUserType() : null);
return false; return false;
} }
// 获取操作系统类型默认为1 手机系统类型 1-Android2-iOS3-微信小程序 // 获取操作系统类型默认为1 手机系统类型 1-Android2-iOS3-微信小程序
Integer osType = accountUserBindGeTui.getOsType() != null ? accountUserBindGeTui.getOsType() : 1; Integer osType = accountUserBindGeTui.getOsType() != null ? accountUserBindGeTui.getOsType() : 1;
Integer userType = accountUserBindGeTui.getUserType() != null ? accountUserBindGeTui.getOsType() : CommonConstant.USER_TYPE_MCH;
// 构建查询条件 组合健用户IDCID用户类型手机系统类型 (同一个账号同一个系统需要同时收到推送所以增加了 cid 条件) // 构建查询条件 组合健用户IDCID用户类型手机系统类型 (同一个账号同一个系统需要同时收到推送所以增加了 cid 条件)
QueryWrapper<AccountUserBindGeTui> wrapper = new QueryWrapper<AccountUserBindGeTui>() QueryWrapper<AccountUserBindGeTui> wrapper = new QueryWrapper<AccountUserBindGeTui>()
.eq("user_id", accountUserBindGeTui.getUserId()) .eq("user_id", accountUserBindGeTui.getUserId())
.eq("cid", accountUserBindGeTui.getCid()) .eq("cid", accountUserBindGeTui.getCid())
.eq("os_type", osType) .eq("os_type", osType)
.eq("user_type", accountUserBindGeTui.getUserType()) .eq("user_type", userType)
.eq("status", CommonConstant.Enable) .eq("status", CommonConstant.Enable)
.orderByDesc("id"); .orderByDesc("id");
@ -59,6 +59,7 @@ public class AccountUserBindGeTuiServiceImpl extends BaseServiceImpl<UserDeviceB
// 更新记录 // 更新记录
accountUserBindGeTui.setId(existAccountUserBindGeTui.getId()); accountUserBindGeTui.setId(existAccountUserBindGeTui.getId());
accountUserBindGeTui.setUpdatedAt(new Date());
return this.updateById(accountUserBindGeTui); return this.updateById(accountUserBindGeTui);
} catch (Exception e) { } catch (Exception e) {
// 捕获异常并记录错误日志 // 捕获异常并记录错误日志