fix(im): 修复addGroupMember时memberName因@JsonIgnore在Feign传输中丢失

移除MemberListDTO.memberName上的@JsonIgnore注解,确保名称能通过Feign跨服务传输。
改为在发送腾讯IM API前手动移除memberName字段,避免发送IM不接受的字段。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-20 17:21:41 +08:00
co-authored by Claude
parent b5c5251913
commit 32d8ad3652
2 changed files with 7 additions and 5 deletions
@@ -548,9 +548,13 @@ public class TencentCloudImUtil {
String httpsUrl = getHttpsUrl(TencentCloudImApiConstant.GroupManage.ADD_GROUP_MEMBER, random);
String jsonString = objectMapper.writeValueAsString(dto);
JSONObject jsonObject = JSONObject.parseObject(jsonString);
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("GroupId", dto.getGroupId());
// jsonObject.put("MemberList", dto.getMemberList());
// 移除 memberName 字段,腾讯IM API 不接受此字段
JSONArray memberList = jsonObject.getJSONArray("MemberList");
if (memberList != null) {
for (int i = 0; i < memberList.size(); i++) {
memberList.getJSONObject(i).remove("memberName");
}
}
log.info("腾讯云im添加群成员,请求参数:{}", jsonObject);
String result = HttpUtil.doPost(httpsUrl, jsonObject);
log.info("腾讯云im添加群成员,返回结果:{}", result);