优化模板消息与订阅消息
This commit is contained in:
@ -5,6 +5,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.api.YshopException;
|
import co.yixiang.api.YshopException;
|
||||||
import co.yixiang.constant.ShopConstants;
|
import co.yixiang.constant.ShopConstants;
|
||||||
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
||||||
import co.yixiang.modules.user.domain.YxUser;
|
import co.yixiang.modules.user.domain.YxUser;
|
||||||
import co.yixiang.modules.user.service.YxUserService;
|
import co.yixiang.modules.user.service.YxUserService;
|
||||||
@ -50,8 +51,10 @@ public class WeiXinSubscribeService {
|
|||||||
map.put("keyword3",price);
|
map.put("keyword3",price);
|
||||||
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendSubscribeMsg( openid, tempId, "/user/account",map);
|
this.sendSubscribeMsg( openid, tempId, "/user/account",map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,8 +77,10 @@ public class WeiXinSubscribeService {
|
|||||||
map.put("time4",simpleDateFormat.format(new Date()));
|
map.put("time4",simpleDateFormat.format(new Date()));
|
||||||
map.put("thing5","yshop购买商品");
|
map.put("thing5","yshop购买商品");
|
||||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款成功通知
|
* 退款成功通知
|
||||||
@ -100,8 +105,10 @@ public class WeiXinSubscribeService {
|
|||||||
map.put("keyword3", time);
|
map.put("keyword3", time);
|
||||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发货成功通知
|
* 发货成功通知
|
||||||
@ -126,8 +133,10 @@ public class WeiXinSubscribeService {
|
|||||||
map.put("keyword3",deliveryId);
|
map.put("keyword3",deliveryId);
|
||||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,6 +175,9 @@ public class WeiXinSubscribeService {
|
|||||||
if (yxWechatTemplate == null) {
|
if (yxWechatTemplate == null) {
|
||||||
throw new YshopException("请后台配置key:" + key + "订阅消息id");
|
throw new YshopException("请后台配置key:" + key + "订阅消息id");
|
||||||
}
|
}
|
||||||
|
if(ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return yxWechatTemplate.getTempid();
|
return yxWechatTemplate.getTempid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ package co.yixiang.modules.mp.service;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.api.YshopException;
|
import co.yixiang.api.YshopException;
|
||||||
import co.yixiang.constant.ShopConstants;
|
import co.yixiang.constant.ShopConstants;
|
||||||
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
import co.yixiang.modules.mp.config.WxMpConfiguration;
|
import co.yixiang.modules.mp.config.WxMpConfiguration;
|
||||||
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
||||||
import co.yixiang.modules.user.domain.YxUser;
|
import co.yixiang.modules.user.domain.YxUser;
|
||||||
@ -68,8 +69,10 @@ public class WeixinTemplateService {
|
|||||||
map.put("keyword3",price);
|
map.put("keyword3",price);
|
||||||
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendWxMpTemplateMessage( openid, tempId, this.getSiteUrl()+"/user/account",map);
|
this.sendWxMpTemplateMessage( openid, tempId, this.getSiteUrl()+"/user/account",map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,8 +96,10 @@ public class WeixinTemplateService {
|
|||||||
map.put("keyword2",price);
|
map.put("keyword2",price);
|
||||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款成功通知
|
* 退款成功通知
|
||||||
@ -119,8 +124,10 @@ public class WeixinTemplateService {
|
|||||||
map.put("keyword3", time);
|
map.put("keyword3", time);
|
||||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发货成功通知
|
* 发货成功通知
|
||||||
@ -145,8 +152,10 @@ public class WeixinTemplateService {
|
|||||||
map.put("keyword3",deliveryId);
|
map.put("keyword3",deliveryId);
|
||||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
||||||
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,6 +197,10 @@ public class WeixinTemplateService {
|
|||||||
throw new YshopException("请后台配置key:" + key + "模板消息id");
|
throw new YshopException("请后台配置key:" + key + "模板消息id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
return yxWechatTemplate.getTempid();
|
return yxWechatTemplate.getTempid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user