Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-notice
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-notice
Commits
7aeea4f7
Commit
7aeea4f7
authored
Jun 23, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
77e7749c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
yd-notice-service/src/main/java/com/yd/notice/service/send/MiniprogramMessageSender.java
+13
-8
No files found.
yd-notice-service/src/main/java/com/yd/notice/service/send/MiniprogramMessageSender.java
View file @
7aeea4f7
...
@@ -76,19 +76,24 @@ public class MiniprogramMessageSender implements MessageSender {
...
@@ -76,19 +76,24 @@ public class MiniprogramMessageSender implements MessageSender {
List
<
WxMaSubscribeMessage
.
MsgData
>
dataList
=
new
ArrayList
<>();
List
<
WxMaSubscribeMessage
.
MsgData
>
dataList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
contentJson
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
contentJson
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
key
=
entry
.
getKey
();
String
value
=
entry
.
getValue
()
!=
null
?
entry
.
getValue
().
toString
()
:
""
;
Object
obj
=
entry
.
getValue
();
String
value
=
""
;
if
(
obj
instanceof
JSONObject
)
{
value
=
((
JSONObject
)
obj
).
getString
(
"value"
);
}
else
{
value
=
obj
!=
null
?
obj
.
toString
()
:
""
;
}
dataList
.
add
(
new
WxMaSubscribeMessage
.
MsgData
(
key
,
value
));
dataList
.
add
(
new
WxMaSubscribeMessage
.
MsgData
(
key
,
value
));
}
}
log
.
info
(
"进入小程序消息发送器=>构建微信订阅消息数据结构List<MsgData>:{}"
,
JSON
.
toJSONString
(
dataList
));
log
.
info
(
"进入小程序消息发送器=>构建微信订阅消息数据结构List<MsgData>:{}"
,
JSON
.
toJSONString
(
dataList
));
// 5. 构建消息体
// 5. 构建消息体
WxMaSubscribeMessage
message
=
new
WxMaSubscribeMessage
();
WxMaSubscribeMessage
message
=
WxMaSubscribeMessage
.
builder
()
message
.
setToUser
(
task
.
getReceiver
());
.
toUser
(
task
.
getReceiver
())
message
.
setTemplateId
(
wxTemplateId
);
.
templateId
(
wxTemplateId
)
message
.
setData
(
dataList
);
// 现在参数类型匹配
.
data
(
dataList
)
if
(
StringUtils
.
hasText
(
page
))
{
.
page
(
page
)
// 如果 page 为空,builder 也会处理
message
.
setPage
(
page
);
.
build
();
}
// log.info("进入小程序消息发送器=>构建消息体WxMaSubscribeMessage:{}", JSON.toJSONString(message));
// log.info("进入小程序消息发送器=>构建消息体WxMaSubscribeMessage:{}", JSON.toJSONString(message));
// 6. 调用微信 SDK 发送
// 6. 调用微信 SDK 发送
...
...
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