1
0
mirror of synced 2026-10-15 03:36:21 +08:00

支持客服事件 rejectSwitch 字段解析

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-09-26 07:18:02 +00:00
committed by GitHub
parent 9720f7a4c7
commit 53424342a5
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++) {