记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
c6100def
Commit
c6100def
authored
Aug 13, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跳转小程序
parent
48835b64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
SweetWechatTemplateServiceImpl.java
...ce/sweet/service/impl/SweetWechatTemplateServiceImpl.java
+21
-3
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetWechatTemplateServiceImpl.java
View file @
c6100def
...
...
@@ -22,7 +22,6 @@ import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import
me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -126,7 +125,7 @@ public class SweetWechatTemplateServiceImpl {
sweetRemindMapper
.
update
(
remindUpdate
,
Wrappers
.
lambdaUpdate
(
SweetRemind
.
class
)
.
in
(
SweetRemind:
:
getRemindId
,
remindIdList
)
.
in
(
SweetRemind:
:
getRemindId
,
remindIdList
)
);
}
}
...
...
@@ -136,7 +135,8 @@ public class SweetWechatTemplateServiceImpl {
public
void
subscribeSend
(
SweetWechatUser
sweetWechatUser
)
{
String
templateId
=
"y-j82V1TYhlTH1j8QscuDPcPQtNiDtENb7N5IZMBvqU"
;
try
{
WxMpTemplateMessage
templateMessage
=
getTemplateMessage
(
templateId
,
sweetWechatUser
.
getOpenId
(),
""
);
// WxMpTemplateMessage templateMessage = getTemplateMessage(templateId, sweetWechatUser.getOpenId(), "");
WxMpTemplateMessage
templateMessage
=
getTemplateMessage
(
templateId
,
sweetWechatUser
.
getOpenId
(),
appid
,
"pages/webview?query=active"
);
// 添加模板数据
templateMessage
.
addData
(
new
WxMpTemplateData
(
"first"
,
"感谢关注「正在现场」服务号。我们是草莓音乐节演出官方票务平台。"
))
.
addData
(
new
WxMpTemplateData
(
"keyword1"
,
"您已成功关注「正在现场」服务号"
))
...
...
@@ -168,6 +168,24 @@ public class SweetWechatTemplateServiceImpl {
return
templateMessage
;
}
private
WxMpTemplateMessage
getTemplateMessage
(
String
templateId
,
String
openId
,
String
appid
,
String
pagePath
)
{
//配置小程序信息
WxMpTemplateMessage
.
MiniProgram
miniProgram
=
new
WxMpTemplateMessage
.
MiniProgram
();
miniProgram
.
setAppid
(
appid
);
//小程序appid
miniProgram
.
setUsePath
(
true
);
miniProgram
.
setPagePath
(
pagePath
);
//用户点击时需要跳转的小程序页面
WxMpTemplateMessage
templateMessage
=
WxMpTemplateMessage
.
builder
()
// 接收者openid
.
toUser
(
openId
)
// 模板id
.
templateId
(
templateId
)
// 模板跳转链接
.
miniProgram
(
miniProgram
)
.
build
();
return
templateMessage
;
}
/**
* 发送消息
*
...
...
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