1
0
mirror of synced 2026-10-13 10:36:46 +08:00

🎨 #4131 【企业微信】支持客服事件 rejectSwitch 字段解析

This commit is contained in:
Copilot
2026-10-10 09:45:31 +08:00
committed by GitHub
parent f795960ab8
commit b73861bcbc
2 changed files with 15 additions and 0 deletions

View File

@@ -40,4 +40,6 @@ public class WxCpKfEventMsg {
private String msgCode;
@SerializedName("recall_msgid")
private String recallMsgId;
@SerializedName("reject_switch")
private Integer rejectSwitch;
}

View File

@@ -101,6 +101,19 @@ public class WxCpKfKnowledgeTest {
"{}"));
}
@Test
public void testKfMsgListRejectSwitchFromJson() {
String json = "{\"errcode\":0,\"errmsg\":\"ok\",\"msg_list\":[{\"msgid\":\"msg-1\",\"send_time\":1,\"origin\":4,\"msgtype\":\"event\",\"event\":{\"event_type\":\"reject_customer_msg_switch_change\",\"servicer_userid\":\"Zhangsan\",\"open_kfid\":\"wkAJ2GCAAASSm4_FhToWMFea0xAFfd3Q\",\"external_userid\":\"wmAJ2GCAAAme1XQRC-NI-q0_ZM9ukoAw\",\"reject_switch\":1}}]}";
WxCpKfMsgListResp response = WxCpKfMsgListResp.fromJson(json);
assertThat(response.getMsgList()).singleElement().satisfies(item -> {
assertThat(item.getEvent().getEventType()).isEqualTo("reject_customer_msg_switch_change");
assertThat(item.getEvent().getServicerUserId()).isEqualTo("Zhangsan");
assertThat(item.getEvent().getRejectSwitch()).isEqualTo(1);
});
}
private void assertJsonRequests(List<String> actual, List<String> expected) {
assertThat(actual).hasSameSizeAs(expected);
for (int i = 0; i < actual.size(); i++) {