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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user