Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
ee7f85ea
Commit
ee7f85ea
authored
Oct 23, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ai会话,聊天用户id格式化修改
parent
2baadf77
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
4 deletions
+60
-4
ch-core/src/main/java/com/wwdz/ch/core/util/IMUtil.java
ch-core/src/main/java/com/wwdz/ch/core/util/IMUtil.java
+6
-0
ch-core/src/main/resources/application-dev.yml
ch-core/src/main/resources/application-dev.yml
+1
-1
ch-core/src/main/resources/application-prod.yml
ch-core/src/main/resources/application-prod.yml
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/IMCallbackController.java
...rc/main/java/com/wwdz/ch/wx/api/IMCallbackController.java
+52
-2
No files found.
ch-core/src/main/java/com/wwdz/ch/core/util/IMUtil.java
View file @
ee7f85ea
...
...
@@ -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
;
}
...
...
ch-core/src/main/resources/application-dev.yml
View file @
ee7f85ea
...
...
@@ -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
ch-core/src/main/resources/application-prod.yml
View file @
ee7f85ea
...
...
@@ -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
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/IMCallbackController.java
View file @
ee7f85ea
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"
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment