Commit ee7f85ea authored by shiyu's avatar shiyu

ai会话,聊天用户id格式化修改

parent 2baadf77
......@@ -35,6 +35,9 @@ public class IMUtil {
* @return
*/
public String formatUserId(String userId) {
if (userId.contains(PREFIX)) {
return userId;
}
return PREFIX + userId;
}
......@@ -45,6 +48,9 @@ public class IMUtil {
* @return
*/
public String revertAppletUserId(String userId) {
if (!userId.contains(PREFIX)) {
return userId;
}
String appletUserId = userId.split("_")[1];
return appletUserId;
}
......
......@@ -201,4 +201,4 @@ server:
avatar-url: https://cdn.wanwudezhi.com/static/web-static/image/b888cc6cb9c004dc342f573653e38ebd_690x690.png
chat:
model-url: http://172.16.122.190:7861/chat
\ No newline at end of file
model-url: https://xiaobai-fastapi.wanwudezhi.com/chat
\ No newline at end of file
......@@ -197,4 +197,4 @@ server:
avatar-url: https://cdn.wanwudezhi.com/static/web-static/image/b888cc6cb9c004dc342f573653e38ebd_690x690.png
chat:
model-url: http://172.16.122.190:7861/chat
\ No newline at end of file
model-url: https://xiaobai-fastapi.wanwudezhi.com/chat
\ No newline at end of file
package com.wwdz.ch.wx.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.wwdz.ch.wx.service.ImRecordService;
import com.xxdxxs.utils.JsonUtils;
import com.xxdxxs.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/imCallback")
public class IMCallbackController {
private static final Logger logger = LoggerFactory.getLogger(OfficialAccountCallbackController.class);
@Value("${dts.im.SDKAppID}")
private Long SDKAppID;
@Autowired
ImRecordService imRecordService;
/**
* OptPlatform,对应不同的平台类型,可能的取值有:RESTAPI(使用 REST API 发送请求)
* 、Web(使用 Web SDK 发送请求)、Android、iOS、Windows、Mac、iPad、Unknown(使用未知类型的设备发送请求)
* @return
*/
@RequestMapping(value ="/getCallbackInfo/{appid}")
public Object getCallbackInfo(@PathVariable String appid,
@RequestParam(required = false, name = "SdkAppid") String sdkAppid,
@RequestParam(required = false, name = "OptPlatform") String optPlatform,
@RequestParam(required = false, name = "CallbackCommand") String callbackCommand,
@RequestBody(required = false) String jsonStr) {
try {
logger.info("接收推送信息校验 -> SdkAppid: {}, OptPlatform:{}, CallbackCommand:{}", sdkAppid, optPlatform, callbackCommand);
if (!sdkAppid.equals(String.valueOf(SDKAppID))) {
logger.info(">>>>>>>>>>> IM回调sdkappid 不一致 <<<<<<<<<<<");
return false;
}
logger.info("回调推送的消息原文 -> {}", jsonStr);
//发送消息后回调信息处理
String fromAccount = JsonUtils.getValueByPath(jsonStr, "From_Account");
String toAccount = JsonUtils.getValueByPath(jsonStr, "From_Account");
String MsgTime = JsonUtils.getValueByPath(jsonStr, "MsgTime");
String MsgKey = JsonUtils.getValueByPath(jsonStr, "MsgKey");
String OnlineOnlyFlag = JsonUtils.getValueByPath(jsonStr, "OnlineOnlyFlag");
String SendMsgResult = JsonUtils.getValueByPath(jsonStr, "SendMsgResult");
String ErrorInfo = JsonUtils.getValueByPath(jsonStr, "ErrorInfo");
//消息体
String msgBody = JsonUtils.getValueByPath(jsonStr, "MsgBody");
JsonUtils.toMapList(msgBody);
} catch (Exception e) {
logger.error("视频号回调推送error : {}", e);
}
return "success";
}
}
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