成为主播指纹校验修改

This commit is contained in:
tianfeng 2026-02-26 18:30:44 +08:00
parent c376c42efe
commit e8075d5384
4 changed files with 36 additions and 4 deletions

View File

@ -109,13 +109,21 @@ public interface LatestMobileDeviceService extends BaseService<LatestMobileDevic
Set<Long> getImeiUserId(Long userId);
/**
* 获取用户设备指纹旧版
* 获取用户设备指纹 IP段
*
* @param userId 用户ID
* @return 设备指纹字符串
*/
String getDeviceFingerprintByUserId(Long userId);
/**
* 获取用户设备指纹 全IP
*
* @param userId 用户ID
* @return 设备指纹字符串
*/
String getDeviceFingerprintAndIPByUserId(Long userId);
/**
* 获取用户设备指纹增强版
* 包含手机型号 + 系统版本 + IP段 + 编译版本

View File

@ -300,6 +300,30 @@ public class LatestMobileDeviceServiceImpl extends
);
}
@Override
public String getDeviceFingerprintAndIPByUserId(Long userId) {
if (userId == null) {
return "";
}
LatestMobileDevice device = query()
.eq(LatestMobileDevice::getUserId, userId)
.last(PageConstant.LIMIT_ONE)
.getOne();
if (device == null) {
return "";
}
if (StringUtils.isBlank(device.getRequestClient())
|| StringUtils.isBlank(device.getPhoneModel())
|| StringUtils.isBlank(device.getIp())) {
return "";
}
return device.getRequestClient() + "|" + device.getPhoneModel() + "|" + device.getIp();
}
@Override
public String getEnhancedDeviceFingerprintByUserId(Long userId) {
if (userId == null) {
@ -386,7 +410,7 @@ public class LatestMobileDeviceServiceImpl extends
.select(LatestMobileDevice::getUserId)
.eq(LatestMobileDevice::getRequestClient, requestClient)
.eq(LatestMobileDevice::getPhoneModel, phoneModel)
.likeRight(LatestMobileDevice::getIp, ipPrefix) // 前缀匹配
.eq(LatestMobileDevice::getIp, ipPrefix) // 前缀匹配
.eq(LatestMobileDevice::getSysOrigin, sysOrigin)
.last(PageConstant.formatLimit(500))
.list())

View File

@ -93,7 +93,7 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway {
return false;
}
String fingerprint = latestMobileDeviceService.getDeviceFingerprintByUserId(userId);
String fingerprint = latestMobileDeviceService.getDeviceFingerprintAndIPByUserId(userId);
if (StringUtils.isBlank(fingerprint)) {
return false;
}

View File

@ -252,7 +252,7 @@ public class RegisterDeviceClientServiceImpl implements RegisterDeviceClientServ
return false;
}
String fingerprint = latestMobileDeviceService.getDeviceFingerprintByUserId(userId);
String fingerprint = latestMobileDeviceService.getDeviceFingerprintAndIPByUserId(userId);
if (StringUtils.isBlank(fingerprint)) {
return false;
}