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
be920fef
Commit
be920fef
authored
Oct 27, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
im回调与当前环境不同的信息不记录
parent
7818e75d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/IMCallbackController.java
...rc/main/java/com/wwdz/ch/wx/api/IMCallbackController.java
+10
-0
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
+5
-5
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/IMCallbackController.java
View file @
be920fef
...
@@ -32,6 +32,10 @@ public class IMCallbackController {
...
@@ -32,6 +32,10 @@ public class IMCallbackController {
@Autowired
@Autowired
ImRecordService
imRecordService
;
ImRecordService
imRecordService
;
@Value
(
"${dts.im.prefix}"
)
private
String
PREFIX
;
@Autowired
@Autowired
IMUtil
imUtil
;
IMUtil
imUtil
;
...
@@ -51,11 +55,16 @@ public class IMCallbackController {
...
@@ -51,11 +55,16 @@ public class IMCallbackController {
logger
.
info
(
">>>>>>>>>>> IM回调sdkappid 不一致 <<<<<<<<<<<"
);
logger
.
info
(
">>>>>>>>>>> IM回调sdkappid 不一致 <<<<<<<<<<<"
);
return
false
;
return
false
;
}
}
String
jsonStr
=
JsonUtils
.
from
(
jsonObject
);
String
jsonStr
=
JsonUtils
.
from
(
jsonObject
);
logger
.
info
(
"消息发送之后的回调推送原文 -> {}"
,
jsonStr
);
logger
.
info
(
"消息发送之后的回调推送原文 -> {}"
,
jsonStr
);
ImRecord
imRecord
=
new
ImRecord
();
ImRecord
imRecord
=
new
ImRecord
();
//发送消息后回调信息处理
//发送消息后回调信息处理
String
fromAccount
=
JsonUtils
.
getValueByPath
(
jsonStr
,
"From_Account"
);
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"
);
String
toAccount
=
JsonUtils
.
getValueByPath
(
jsonStr
,
"To_Account"
);
long
msgTime
=
Long
.
valueOf
(
JsonUtils
.
getValueByPath
(
jsonStr
,
"MsgTime"
));
long
msgTime
=
Long
.
valueOf
(
JsonUtils
.
getValueByPath
(
jsonStr
,
"MsgTime"
));
String
msgKey
=
JsonUtils
.
getValueByPath
(
jsonStr
,
"MsgKey"
);
String
msgKey
=
JsonUtils
.
getValueByPath
(
jsonStr
,
"MsgKey"
);
...
@@ -117,5 +126,6 @@ public class IMCallbackController {
...
@@ -117,5 +126,6 @@ public class IMCallbackController {
System
.
out
.
println
(
"contentJsonStr = "
+
contentJsonStr
);
System
.
out
.
println
(
"contentJsonStr = "
+
contentJsonStr
);
String
content
=
JsonUtils
.
toMap
(
contentJsonStr
).
get
(
"Text"
).
toString
();
String
content
=
JsonUtils
.
toMap
(
contentJsonStr
).
get
(
"Text"
).
toString
();
System
.
out
.
println
(
"content = "
+
content
);
System
.
out
.
println
(
"content = "
+
content
);
}
}
}
}
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
View file @
be920fef
...
@@ -53,7 +53,7 @@ public class ChatApiTest {
...
@@ -53,7 +53,7 @@ public class ChatApiTest {
@Test
@Test
public
void
chatWithModel
()
{
public
void
chatWithModel
()
{
String
question
=
"
伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟伟小伟伟
"
;
String
question
=
"
什么是站洋
"
;
chatApi
.
chatWithModel
(
question
);
chatApi
.
chatWithModel
(
question
);
}
}
...
@@ -104,12 +104,12 @@ public class ChatApiTest {
...
@@ -104,12 +104,12 @@ public class ChatApiTest {
@Test
@Test
public
void
sendChatMsg
()
{
public
void
sendChatMsg
()
{
SendChatMsgRequestDto
sendChatMsgRequestDto
=
new
SendChatMsgRequestDto
();
SendChatMsgRequestDto
sendChatMsgRequestDto
=
new
SendChatMsgRequestDto
();
sendChatMsgRequestDto
.
setToAccount
(
"2
69
"
);
sendChatMsgRequestDto
.
setToAccount
(
"2
57
"
);
sendChatMsgRequestDto
.
setFromAccount
(
"
ai10000
"
);
sendChatMsgRequestDto
.
setFromAccount
(
"
238
"
);
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
long
timestamp
=
System
.
currentTimeMillis
();
long
timestamp
=
System
.
currentTimeMillis
();
// String msgContent = timestamp + " >> ai
测试消息的数据, 是否可以接收到";
String
msgContent
=
timestamp
+
" >>
测试消息的数据, 是否可以接收到"
;
String
msgContent
=
"Hi,欢迎来到老猫的世界"
;
//
String msgContent = "Hi,欢迎来到老猫的世界";
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
Result
<
String
>
result
=
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
Result
<
String
>
result
=
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
String
msgKey
=
result
.
getData
();
String
msgKey
=
result
.
getData
();
...
...
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