Skip to content

Commit

Permalink
升级WxJava版本
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoubo9 committed Mar 2, 2020
1 parent 0955ac7 commit facfc2e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

<java.version>1.8</java.version>
<logback.version>1.2.3</logback.version>
<weixin-java-mp.version>3.6.0</weixin-java-mp.version>
<weixin-java-cp.version>3.6.0</weixin-java-cp.version>
<weixin-java-miniapp.version>3.6.0</weixin-java-miniapp.version>
<weixin-java-mp.version>3.7.0</weixin-java-mp.version>
<weixin-java-cp.version>3.7.0</weixin-java-cp.version>
<weixin-java-miniapp.version>3.7.0</weixin-java-miniapp.version>
<emoji-java.version>4.0.0</emoji-java.version>
<hutool-all.version>4.6.2</hutool-all.version>
<opencsv.version>4.6</opencsv.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.fangxuele.tool.push.logic.msgmaker;

import cn.binarywang.wx.miniapp.bean.WxMaSubscribeData;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import com.fangxuele.tool.push.bean.TemplateData;
import com.fangxuele.tool.push.ui.form.msg.MaSubscribeMsgForm;
Expand Down Expand Up @@ -68,12 +67,11 @@ public WxMaSubscribeMessage makeMsg(String[] msgData) {
String templateUrlEvaluated = TemplateUtil.evaluate(templateUrl, velocityContext);
wxMaSubscribeMessage.setPage(templateUrlEvaluated);

WxMaSubscribeData wxMaSubscribeData;
WxMaSubscribeMessage.Data wxMaSubscribeData;
for (TemplateData templateData : templateDataList) {
wxMaSubscribeData = new WxMaSubscribeData();
wxMaSubscribeData = new WxMaSubscribeMessage.Data();
wxMaSubscribeData.setName(templateData.getName());
wxMaSubscribeData.setValue(TemplateUtil.evaluate(templateData.getValue(), velocityContext));
wxMaSubscribeData.setColor(templateData.getColor());
wxMaSubscribeMessage.addData(wxMaSubscribeData);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.fangxuele.tool.push.App;
Expand Down Expand Up @@ -38,14 +39,14 @@ public SendResult send(String[] msgData) {

try {
String openId = msgData[0];
WxMaTemplateMessage wxMaTemplateMessage = wxMaTemplateMsgMaker.makeMsg(msgData);
wxMaTemplateMessage.setToUser(openId);
wxMaTemplateMessage.setFormId(msgData[1]);
WxMaSubscribeMessage wxMaSubscribeMessage = new WxMaSubscribeMessage();
wxMaSubscribeMessage.setToUser(openId);
wxMaSubscribeMessage.setTemplateId(msgData[1]);
if (PushControl.dryRun) {
sendResult.setSuccess(true);
return sendResult;
} else {
wxMaService.getMsgService().sendTemplateMsg(wxMaTemplateMessage);
wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
}
} catch (Exception e) {
sendResult.setSuccess(false);
Expand Down

0 comments on commit facfc2e

Please sign in to comment.