bug修改

This commit is contained in:
周鹏 committed 2026-09-06 11:39:21 +08:00
1 parent a9237a1b38
commit ee47e3a94c
5 files changed
+21 -19

No files matched your search

@@ -57,10 +57,15 @@ public class AppAuthController {
}
@GetMapping("/airline-check")
@Operation(summary = "航空账号会话校验(禁用/过期/设备不匹配则失败)")
@Operation(summary = "航空账号会话校验(免登录,按手机号+渠道+设备识别号核对账号)")
@Parameter(name = "mobile", description = "手机号", required = true)
@Parameter(name = "deviceId", description = "设备唯一识别号", required = true)
public CommonResult<Boolean> airlineCheck(@RequestParam("deviceId") String deviceId) {
authService.airlineCheck(getLoginUserId(), deviceId);
@Parameter(name = "channel", description = "品牌渠道(CZ/MU/HU)", required = true)
@PermitAll
public CommonResult<Boolean> airlineCheck(@RequestParam("mobile") String mobile,
@RequestParam("deviceId") String deviceId,
@RequestParam("channel") String channel) {
authService.airlineCheck(mobile, deviceId, channel);
return success(true);
}
@@ -34,9 +34,9 @@ public interface MemberAirlineAccountService {
MemberAirlineAccountDO authenticateAndBindDevice(String mobile, String password, String deviceId, String channel);
/**
* 会话校验:已登录用户打开 App 时检查账号是否禁用/过期/设备不匹配。
* 注意:accountId 为登录 Token 中的 userId,即航空账号自身编号(不再是 member_user 编号)。
* 会话校验(免登录):按 手机号+渠道 定位账号,校验存在/禁用/有效期/设备绑定。
* 不依赖任何 Token,App 每次打开直接核对账号表。
*/
void validateAirlineSession(Long accountId, String deviceId);
void validateAirlineSession(String mobile, String deviceId, String channel);
}
@@ -123,12 +123,9 @@ public class MemberAirlineAccountServiceImpl implements MemberAirlineAccountServ
}
@Override
public void validateAirlineSession(Long accountId, String deviceId) {
if (accountId == null) {
throw exception(AIRLINE_ACCOUNT_NOT_EXISTS);
}
// 登录签发的 Token 中 userId 即航空账号自身编号
MemberAirlineAccountDO account = airlineAccountMapper.selectById(accountId);
public void validateAirlineSession(String mobile, String deviceId, String channel) {
// 按 手机号+渠道 定位账号(免 Token 校验,直接核对账号表)
MemberAirlineAccountDO account = airlineAccountMapper.selectByMobileAndChannel(mobile, channel);
if (account == null) {
throw exception(AIRLINE_ACCOUNT_NOT_EXISTS);
}
@@ -142,9 +139,8 @@ public class MemberAirlineAccountServiceImpl implements MemberAirlineAccountServ
if (account.getEndTime() != null && now.isAfter(account.getEndTime())) {
throw exception(AIRLINE_ACCOUNT_EXPIRED);
}
String boundDeviceId = account.getDeviceId();
if (StrUtil.isNotBlank(boundDeviceId) && StrUtil.isNotBlank(deviceId)
&& !StrUtil.equals(boundDeviceId, deviceId)) {
// 设备必须与登录时绑定的设备一致(未绑定/绑定其他手机都不放行)
if (StrUtil.isBlank(account.getDeviceId()) || !StrUtil.equals(account.getDeviceId(), deviceId)) {
throw exception(AIRLINE_ACCOUNT_DEVICE_BOUND);
}
}
@@ -116,8 +116,9 @@ public interface MemberAuthService {
AppAuthLoginRespVO airlineLogin(@Valid AppAuthAirlineLoginReqVO reqVO);
/**
* 航空账号会话校验(已登录):禁用/过期/设备不匹配时抛业务异常
* 航空账号会话校验(免登录):按 手机号+渠道+设备识别号 定位账号,
* 校验账号存在、未禁用、在有效期内、设备绑定匹配。不依赖任何 Token。
*/
void airlineCheck(Long userId, String deviceId);
void airlineCheck(String mobile, String deviceId, String channel);
}
@@ -453,8 +453,8 @@ public class MemberAuthServiceImpl implements MemberAuthService {
}
@Override
public void airlineCheck(Long userId, String deviceId) {
airlineAccountService.validateAirlineSession(userId, deviceId);
public void airlineCheck(String mobile, String deviceId, String channel) {
airlineAccountService.validateAirlineSession(mobile, deviceId, channel);
}
private void createLogoutLog(Long userId) {