Commit be920fef authored by shiyu's avatar shiyu

im回调与当前环境不同的信息不记录

parent 7818e75d
......@@ -32,6 +32,10 @@ public class IMCallbackController {
@Autowired
ImRecordService imRecordService;
@Value("${dts.im.prefix}")
private String PREFIX;
@Autowired
IMUtil imUtil;
......@@ -51,11 +55,16 @@ public class IMCallbackController {
logger.info(">>>>>>>>>>> IM回调sdkappid 不一致 <<<<<<<<<<<");
return false;
}
String jsonStr = JsonUtils.from(jsonObject);
logger.info("消息发送之后的回调推送原文 -> {}", jsonStr);
ImRecord imRecord = new ImRecord();
//发送消息后回调信息处理
String fromAccount = JsonUtils.getValueByPath(jsonStr, "From_Account");
if ((fromAccount.contains("dev") && !PREFIX.contains("dev")) || (!fromAccount.contains("dev") && PREFIX.contains("dev"))) {
logger.info(">>>>>>>>>>> 回调信息中账号信息与当前环境不一致, 不存入对应环境的数据库中 <<<<<<<<<<<");
return false;
}
String toAccount = JsonUtils.getValueByPath(jsonStr, "To_Account");
long msgTime = Long.valueOf(JsonUtils.getValueByPath(jsonStr, "MsgTime"));
String msgKey = JsonUtils.getValueByPath(jsonStr, "MsgKey");
......@@ -117,5 +126,6 @@ public class IMCallbackController {
System.out.println("contentJsonStr = " + contentJsonStr);
String content = JsonUtils.toMap(contentJsonStr).get("Text").toString();
System.out.println("content = " + content);
}
}
......@@ -53,7 +53,7 @@ public class ChatApiTest {
@Test
public void chatWithModel() {
String question = "伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟小伟伟";
String question = "什么是站洋";
chatApi.chatWithModel(question);
}
......@@ -104,12 +104,12 @@ public class ChatApiTest {
@Test
public void sendChatMsg() {
SendChatMsgRequestDto sendChatMsgRequestDto = new SendChatMsgRequestDto();
sendChatMsgRequestDto.setToAccount("269");
sendChatMsgRequestDto.setFromAccount("ai10000");
sendChatMsgRequestDto.setToAccount("257");
sendChatMsgRequestDto.setFromAccount("238");
sendChatMsgRequestDto.setMsgType(IMEnum.MsgTypeEnum.TIMTextElem.getCode());
long timestamp = System.currentTimeMillis();
// String msgContent = timestamp + " >> ai测试消息的数据, 是否可以接收到";
String msgContent = "Hi,欢迎来到老猫的世界";
String msgContent = timestamp + " >> 测试消息的数据, 是否可以接收到";
// String msgContent = "Hi,欢迎来到老猫的世界";
sendChatMsgRequestDto.setMsgContent(msgContent);
Result<String> result = conversationApi.sendChatMsg(sendChatMsgRequestDto);
String msgKey = result.getData();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment