feat(emergency): searchExpert接口返回ConDoctor专家数据 + 修复IM UserSig缓存key未区分secretKey的问题
1. searchExpert新增ConDoctor专家字段:
- 新增ConDoctorMapper直接查询qh_con_doctor表(同库,避免跨模块依赖)
- EmergencyProfessionUser新增17个@TableField(exist=false)字段承载专家数据
- searchExpert方法中批量查询ConDoctor并逐字段填充
- 用户非专家时ConDoctor字段为null
- 更新API文档-移动端接口.md
2. IM签名缓存优化:
- TencentCloudImUtil新增secretKey注入
- Redis key从 silence:im_user_sig:{sdkAppId}:{id}
改为 silence:im_user_sig:{hash(sdkAppId+secretKey)}:{id}
- 解决secretKey变更时旧缓存签名仍被命中导致IM请求失败的问题
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,8 @@ public class TencentCloudImUtil {
|
||||
|
||||
@Value("${IMConfig.sdkAppId}")
|
||||
private long sdkAppId;
|
||||
@Value("${IMConfig.secretKey}")
|
||||
private String secretKey;
|
||||
|
||||
@Autowired
|
||||
private TximUtil tximUtil;
|
||||
@@ -73,8 +75,16 @@ public class TencentCloudImUtil {
|
||||
return System.currentTimeMillis() + "" + StrUtil.subSuf(Math.random() + "", 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取IM配置指纹,用于区分不同配置的缓存
|
||||
* 当 sdkAppId 或 secretKey 变更时指纹变化,旧缓存自动失效
|
||||
*/
|
||||
private String getConfigFingerprint() {
|
||||
return Integer.toHexString(Objects.hash(sdkAppId, secretKey));
|
||||
}
|
||||
|
||||
private String buildUserSigKey(String identifier) {
|
||||
return REDIS_IM_USER_SIG_PREFIX + sdkAppId + ":" + identifier;
|
||||
return REDIS_IM_USER_SIG_PREFIX + getConfigFingerprint() + ":" + identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user