Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
f0fdd9d6
Commit
f0fdd9d6
authored
Nov 22, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改微信配置
parent
55e93835
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
228 additions
and
265 deletions
+228
-265
WxMsgPushController.java
...java/share/web/controller/common/WxMsgPushController.java
+2
-16
WxMaProperties.java
...t/src/main/java/share/web/core/config/WxMaProperties.java
+43
-43
WxMaConfiguration.java
...rc/main/java/share/web/interceptor/WxMaConfiguration.java
+129
-129
application-prod.yml
share-front/src/main/resources/application-prod.yml
+1
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+0
-19
pom.xml
share-system/pom.xml
+0
-5
WxMsgPushConServiceeImpl.java
...a/share/system/service/impl/WxMsgPushConServiceeImpl.java
+53
-53
No files found.
share-front/src/main/java/share/web/controller/common/WxMsgPushController.java
View file @
f0fdd9d6
package
share
.
web
.
controller
.
common
;
package
share
.
web
.
controller
.
common
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.api.WxMaSubscribeService
;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.bean.subscribemsg.TemplateInfo
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.core.domain.AjaxResult
;
import
share.system.service.WxMsgPushConService
;
import
share.system.service.WxMsgPushConService
;
import
share.system.util.WXMsgPushUtils
;
import
share.system.util.WXMsgPushUtils
;
...
@@ -31,8 +23,8 @@ public class WxMsgPushController {
...
@@ -31,8 +23,8 @@ public class WxMsgPushController {
@Value
(
"${wechat.token}"
)
@Value
(
"${wechat.token}"
)
private
String
token
;
private
String
token
;
@Autowired
//
@Autowired
private
WxMsgPushConService
wxMsgPushConService
;
//
private WxMsgPushConService wxMsgPushConService;
...
@@ -62,11 +54,5 @@ public class WxMsgPushController {
...
@@ -62,11 +54,5 @@ public class WxMsgPushController {
return
echostr
;
return
echostr
;
}
}
@GetMapping
(
"/api/zphs/sendZbhsMsg"
)
@ApiOperation
(
"传openId发送微信服务通知"
)
public
AjaxResult
<
Boolean
>
sendMsg
(
String
openID
)
throws
WxErrorException
{
wxMsgPushConService
.
sendSmallMsg
(
openID
);
return
AjaxResult
.
success
(
true
);
}
}
}
share-front/src/main/java/share/web/core/config/WxMaProperties.java
View file @
f0fdd9d6
package
share
.
web
.
core
.
config
;
//
package share.web.core.config;
//
import
lombok.Data
;
//
import lombok.Data;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
//
import org.springframework.boot.context.properties.ConfigurationProperties;
//
import
java.util.List
;
//
import java.util.List;
//
@Data
//
@Data
@ConfigurationProperties
(
prefix
=
"wx.miniapp"
)
//
@ConfigurationProperties(prefix = "wx.miniapp")
public
class
WxMaProperties
{
//
public class WxMaProperties {
//
private
List
<
Config
>
configs
;
//
private List<Config> configs;
//
@Data
//
@Data
public
static
class
Config
{
//
public static class Config {
/**
//
/**
* 设置微信小程序的appid
//
* 设置微信小程序的appid
*/
//
*/
private
String
appid
;
//
private String appid;
//
/**
//
/**
* 设置微信小程序的Secret
//
* 设置微信小程序的Secret
*/
//
*/
private
String
secret
;
//
private String secret;
//
/**
//
/**
* 设置微信小程序消息服务器配置的token
//
* 设置微信小程序消息服务器配置的token
*/
//
*/
private
String
token
;
//
private String token;
//
/**
//
/**
* 设置微信小程序消息服务器配置的EncodingAESKey
//
* 设置微信小程序消息服务器配置的EncodingAESKey
*/
//
*/
private
String
aesKey
;
//
private String aesKey;
//
/**
//
/**
* 消息格式,XML或者JSON
//
* 消息格式,XML或者JSON
*/
//
*/
private
String
msgDataFormat
;
//
private String msgDataFormat;
}
//
}
//
}
//
}
//
share-front/src/main/java/share/web/interceptor/WxMaConfiguration.java
View file @
f0fdd9d6
package
share
.
web
.
interceptor
;
//
package share.web.interceptor;
//
import
cn.binarywang.wx.miniapp.api.WxMaService
;
//
import cn.binarywang.wx.miniapp.api.WxMaService;
import
cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl
;
//
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import
cn.binarywang.wx.miniapp.bean.WxMaKefuMessage
;
//
import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
//
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import
cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl
;
//
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import
cn.binarywang.wx.miniapp.message.WxMaMessageHandler
;
//
import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
import
cn.binarywang.wx.miniapp.message.WxMaMessageRouter
;
//
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
import
com.google.common.collect.Lists
;
//
import com.google.common.collect.Lists;
import
lombok.extern.slf4j.Slf4j
;
//
import lombok.extern.slf4j.Slf4j;
import
me.chanjar.weixin.common.bean.result.WxMediaUploadResult
;
//
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import
me.chanjar.weixin.common.error.WxErrorException
;
//
import me.chanjar.weixin.common.error.WxErrorException;
import
me.chanjar.weixin.common.error.WxRuntimeException
;
//
import me.chanjar.weixin.common.error.WxRuntimeException;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
//
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import
org.springframework.context.annotation.Bean
;
//
import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
//
import org.springframework.context.annotation.Configuration;
import
share.web.core.config.WxMaProperties
;
//
import share.web.core.config.WxMaProperties;
//
import
java.io.File
;
//
import java.io.File;
import
java.util.List
;
//
import java.util.List;
import
java.util.stream.Collectors
;
//
import java.util.stream.Collectors;
//
@Slf4j
//
@Slf4j
@Configuration
//
@Configuration
@EnableConfigurationProperties
(
WxMaProperties
.
class
)
//
@EnableConfigurationProperties(WxMaProperties.class)
public
class
WxMaConfiguration
{
//
public class WxMaConfiguration {
private
final
WxMaProperties
properties
;
//
private final WxMaProperties properties;
//
@Autowired
//
@Autowired
public
WxMaConfiguration
(
WxMaProperties
properties
)
{
//
public WxMaConfiguration(WxMaProperties properties) {
this
.
properties
=
properties
;
//
this.properties = properties;
}
//
}
//
@Bean
//
@Bean
public
WxMaService
wxMaService
()
{
//
public WxMaService wxMaService() {
List
<
WxMaProperties
.
Config
>
configs
=
this
.
properties
.
getConfigs
();
//
List<WxMaProperties.Config> configs = this.properties.getConfigs();
if
(
configs
==
null
)
{
//
if (configs == null) {
throw
new
WxRuntimeException
(
"大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!"
);
//
throw new WxRuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
}
//
}
WxMaService
maService
=
new
WxMaServiceImpl
();
//
WxMaService maService = new WxMaServiceImpl();
maService
.
setMultiConfigs
(
//
maService.setMultiConfigs(
configs
.
stream
()
//
configs.stream()
.
map
(
a
->
{
//
.map(a -> {
WxMaDefaultConfigImpl
config
=
new
WxMaDefaultConfigImpl
();
//
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
// WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool());
//
//
WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool());
// 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常
//
// 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常
config
.
setAppid
(
a
.
getAppid
());
//
config.setAppid(a.getAppid());
config
.
setSecret
(
a
.
getSecret
());
//
config.setSecret(a.getSecret());
config
.
setToken
(
a
.
getToken
());
//
config.setToken(a.getToken());
config
.
setAesKey
(
a
.
getAesKey
());
//
config.setAesKey(a.getAesKey());
config
.
setMsgDataFormat
(
a
.
getMsgDataFormat
());
//
config.setMsgDataFormat(a.getMsgDataFormat());
return
config
;
//
return config;
}).
collect
(
Collectors
.
toMap
(
WxMaDefaultConfigImpl:
:
getAppid
,
a
->
a
,
(
o
,
n
)
->
o
)));
//
}).collect(Collectors.toMap(WxMaDefaultConfigImpl::getAppid, a -> a, (o, n) -> o)));
return
maService
;
//
return maService;
}
//
}
//
@Bean
//
@Bean
public
WxMaMessageRouter
wxMaMessageRouter
(
WxMaService
wxMaService
)
{
//
public WxMaMessageRouter wxMaMessageRouter(WxMaService wxMaService) {
final
WxMaMessageRouter
router
=
new
WxMaMessageRouter
(
wxMaService
);
//
final WxMaMessageRouter router = new WxMaMessageRouter(wxMaService);
router
//
router
.
rule
().
handler
(
logHandler
).
next
()
//
.rule().handler(logHandler).next()
.
rule
().
async
(
false
).
content
(
"订阅消息"
).
handler
(
subscribeMsgHandler
).
end
()
//
.rule().async(false).content("订阅消息").handler(subscribeMsgHandler).end()
.
rule
().
async
(
false
).
content
(
"文本"
).
handler
(
textHandler
).
end
()
//
.rule().async(false).content("文本").handler(textHandler).end()
.
rule
().
async
(
false
).
content
(
"图片"
).
handler
(
picHandler
).
end
()
//
.rule().async(false).content("图片").handler(picHandler).end()
.
rule
().
async
(
false
).
content
(
"二维码"
).
handler
(
qrcodeHandler
).
end
();
//
.rule().async(false).content("二维码").handler(qrcodeHandler).end();
return
router
;
//
return router;
}
//
}
//
private
final
WxMaMessageHandler
subscribeMsgHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
//
private final WxMaMessageHandler subscribeMsgHandler = (wxMessage, context, service, sessionManager) -> {
service
.
getMsgService
().
sendSubscribeMsg
(
WxMaSubscribeMessage
.
builder
()
//
service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder()
.
templateId
(
"此处更换为自己的模板id"
)
//
.templateId("此处更换为自己的模板id")
.
data
(
Lists
.
newArrayList
(
//
.data(Lists.newArrayList(
new
WxMaSubscribeMessage
.
MsgData
(
"keyword1"
,
"339208499"
)))
//
new WxMaSubscribeMessage.MsgData("keyword1", "339208499")))
.
toUser
(
wxMessage
.
getFromUser
())
//
.toUser(wxMessage.getFromUser())
.
build
());
//
.build());
return
null
;
//
return null;
};
//
};
//
private
final
WxMaMessageHandler
logHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
//
private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> {
log
.
info
(
"收到消息:"
+
wxMessage
.
toString
());
//
log.info("收到消息:" + wxMessage.toString());
service
.
getMsgService
().
sendKefuMsg
(
WxMaKefuMessage
.
newTextBuilder
().
content
(
"收到信息为:"
+
wxMessage
.
toJson
())
//
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson())
.
toUser
(
wxMessage
.
getFromUser
()).
build
());
//
.toUser(wxMessage.getFromUser()).build());
return
null
;
//
return null;
};
//
};
//
private
final
WxMaMessageHandler
textHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
//
private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> {
service
.
getMsgService
().
sendKefuMsg
(
WxMaKefuMessage
.
newTextBuilder
().
content
(
"回复文本消息"
)
//
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息")
.
toUser
(
wxMessage
.
getFromUser
()).
build
());
//
.toUser(wxMessage.getFromUser()).build());
return
null
;
//
return null;
};
//
};
//
private
final
WxMaMessageHandler
picHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
//
private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> {
try
{
//
try {
WxMediaUploadResult
uploadResult
=
service
.
getMediaService
()
//
WxMediaUploadResult uploadResult = service.getMediaService()
.
uploadMedia
(
"image"
,
"png"
,
//
.uploadMedia("image", "png",
ClassLoader
.
getSystemResourceAsStream
(
"tmp.png"
));
//
ClassLoader.getSystemResourceAsStream("tmp.png"));
service
.
getMsgService
().
sendKefuMsg
(
//
service.getMsgService().sendKefuMsg(
WxMaKefuMessage
//
WxMaKefuMessage
.
newImageBuilder
()
//
.newImageBuilder()
.
mediaId
(
uploadResult
.
getMediaId
())
//
.mediaId(uploadResult.getMediaId())
.
toUser
(
wxMessage
.
getFromUser
())
//
.toUser(wxMessage.getFromUser())
.
build
());
//
.build());
}
catch
(
WxErrorException
e
)
{
//
} catch (WxErrorException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
//
return
null
;
//
return null;
};
//
};
//
private
final
WxMaMessageHandler
qrcodeHandler
=
(
wxMessage
,
context
,
service
,
sessionManager
)
->
{
//
private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> {
try
{
//
try {
final
File
file
=
service
.
getQrcodeService
().
createQrcode
(
"123"
,
430
);
//
final File file = service.getQrcodeService().createQrcode("123", 430);
WxMediaUploadResult
uploadResult
=
service
.
getMediaService
().
uploadMedia
(
"image"
,
file
);
//
WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file);
service
.
getMsgService
().
sendKefuMsg
(
//
service.getMsgService().sendKefuMsg(
WxMaKefuMessage
//
WxMaKefuMessage
.
newImageBuilder
()
//
.newImageBuilder()
.
mediaId
(
uploadResult
.
getMediaId
())
//
.mediaId(uploadResult.getMediaId())
.
toUser
(
wxMessage
.
getFromUser
())
//
.toUser(wxMessage.getFromUser())
.
build
());
//
.build());
}
catch
(
WxErrorException
e
)
{
//
} catch (WxErrorException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
//
return
null
;
//
return null;
};
//
};
//
}
//
}
share-front/src/main/resources/application-prod.yml
View file @
f0fdd9d6
...
@@ -21,6 +21,7 @@ wechat:
...
@@ -21,6 +21,7 @@ wechat:
mchId
:
1658895429
mchId
:
1658895429
signKey
:
ZEKu56XCezuESfNEdM4zVZEN3cz2PuHz
signKey
:
ZEKu56XCezuESfNEdM4zVZEN3cz2PuHz
certPath
:
/Users/project/pseer/apiclient_cert.p12
certPath
:
/Users/project/pseer/apiclient_cert.p12
token
:
coujio
wx
:
wx
:
miniapp
:
miniapp
:
configs
:
configs
:
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
f0fdd9d6
...
@@ -51,11 +51,6 @@ public class RedisTask {
...
@@ -51,11 +51,6 @@ public class RedisTask {
@Autowired
@Autowired
private
ISOrderService
isOrderService
;
private
ISOrderService
isOrderService
;
@Value
(
"${wechat.appid}"
)
private
String
appid
;
@Value
(
"${wechat.secret}"
)
private
String
secret
;
public
void
AuToReceiptCode
()
{
public
void
AuToReceiptCode
()
{
//获取redis中所有以tuangou.receipt.prepare开头的key
//获取redis中所有以tuangou.receipt.prepare开头的key
...
@@ -93,20 +88,6 @@ public class RedisTask {
...
@@ -93,20 +88,6 @@ public class RedisTask {
}
}
}
}
public
void
AutoWXAccessToken
()
throws
IOException
{
Boolean
b
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
ACCESS_TOKEN_KEY
.
getValue
());
if
(!
b
)
{
String
url
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
+
appid
+
"&secret="
+
secret
;
HttpClient
httpClient
=
HttpClients
.
createDefault
();
HttpGet
httpGet
=
new
HttpGet
(
url
);
HttpResponse
response
=
httpClient
.
execute
(
httpGet
);
HttpEntity
entity
=
response
.
getEntity
();
String
strEntity
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
JSONObject
jsonObject
=
new
JSONObject
(
strEntity
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ACCESS_TOKEN_KEY
.
getValue
(),
jsonObject
.
getStr
(
"access_token"
),
Long
.
valueOf
(
jsonObject
.
getInt
(
"expires_in"
)
-
60
*
30
),
TimeUnit
.
SECONDS
);
}
}
//自动添加保洁记录
//自动添加保洁记录
public
void
AutoAddSCleanRecords
()
{
public
void
AutoAddSCleanRecords
()
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
"*"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
"*"
);
...
...
share-system/pom.xml
View file @
f0fdd9d6
...
@@ -129,11 +129,6 @@
...
@@ -129,11 +129,6 @@
<artifactId>
spring-integration-mqtt
</artifactId>
<artifactId>
spring-integration-mqtt
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
weixin-java-miniapp
</artifactId>
<version>
4.5.0
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<artifactId>
junit
</artifactId>
</dependency>
</dependency>
...
...
share-system/src/main/java/share/system/service/impl/WxMsgPushConServiceeImpl.java
View file @
f0fdd9d6
package
share
.
system
.
service
.
impl
;
//
package share.system.service.impl;
//
import
cn.binarywang.wx.miniapp.api.WxMaService
;
//
import cn.binarywang.wx.miniapp.api.WxMaService;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
//
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import
cn.hutool.core.date.LocalDateTimeUtil
;
//
import cn.hutool.core.date.LocalDateTimeUtil;
import
lombok.RequiredArgsConstructor
;
//
import lombok.RequiredArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
//
import lombok.extern.slf4j.Slf4j;
import
me.chanjar.weixin.common.error.WxErrorException
;
//
import me.chanjar.weixin.common.error.WxErrorException;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Repository
;
//
import org.springframework.stereotype.Repository;
import
org.springframework.stereotype.Service
;
//
import org.springframework.stereotype.Service;
import
share.system.service.WxMsgPushConService
;
//
import share.system.service.WxMsgPushConService;
//
import
javax.annotation.Resource
;
//
import javax.annotation.Resource;
import
java.time.LocalDateTime
;
//
import java.time.LocalDateTime;
import
java.util.HashMap
;
//
import java.util.HashMap;
import
java.util.Map
;
//
import java.util.Map;
//
@Slf4j
//
@Slf4j
@Service
//
@Service
public
class
WxMsgPushConServiceeImpl
implements
WxMsgPushConService
{
//
public class WxMsgPushConServiceeImpl implements WxMsgPushConService {
@Autowired
// @Resource
private
WxMaService
wxMaService
;
//
private WxMaService wxMaService;
/**
//
/**
* 跳转的小程序页面
//
* 跳转的小程序页面
*/
//
*/
private
static
final
String
PAGES_ZP
=
"pages/draft-review/list/list"
;
//
private static final String PAGES_ZP = "pages/draft-review/list/list";
//
@Override
//
@Override
public
void
sendSmallMsg
(
String
openID
)
{
//
public void sendSmallMsg(String openID) {
Map
<
String
,
String
>
map
=
new
HashMap
<>();
//
Map<String, String> map = new HashMap<>();
map
.
put
(
"thing4"
,
"预约门店"
);
//
map.put("thing4", "预约门店");
map
.
put
(
"thing7"
,
"服务名称"
);
//
map.put("thing7", "服务名称");
map
.
put
(
"date3"
,
LocalDateTimeUtil
.
format
(
LocalDateTime
.
now
(),
"yyyy-MM-dd HH:mm:ss"
));
//
map.put("date3", LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
map
.
put
(
"thing5"
,
"地址"
);
//
map.put("thing5", "地址");
WxMaSubscribeMessage
wxMaSubscribeMessage
=
WxMaSubscribeMessage
.
builder
()
//
WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder()
.
toUser
(
openID
)
//
.toUser(openID)
.
templateId
(
"oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8"
)
//
.templateId("oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8")
.
page
(
PAGES_ZP
)
//
.page(PAGES_ZP)
.
build
();
//
.build();
// 设置将推送的消息
//
// 设置将推送的消息
map
.
forEach
((
k
,
v
)
->
{
//
map.forEach((k, v) -> {
wxMaSubscribeMessage
.
addData
(
new
WxMaSubscribeMessage
.
MsgData
(
k
,
v
));
//
wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, v));
});
//
});
try
{
//
try {
log
.
info
(
"开始发送消息!!!!"
);
//
log.info("开始发送消息!!!!");
wxMaService
.
getMsgService
().
sendSubscribeMsg
(
wxMaSubscribeMessage
);
//
wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
log
.
info
(
"消息发送成功!!!!"
);
//
log.info("消息发送成功!!!!");
}
catch
(
WxErrorException
e
)
{
//
} catch (WxErrorException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
}
//
}
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