|
|
|
@ -12,8 +12,10 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.YshopException; |
|
|
|
|
import co.yixiang.constant.ShopConstants; |
|
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
|
import co.yixiang.modules.mp.config.BxgConstans; |
|
|
|
|
import co.yixiang.modules.mp.config.WxMpConfiguration; |
|
|
|
|
import co.yixiang.modules.mp.domain.YxWechatTemplate; |
|
|
|
|
import co.yixiang.modules.shop.service.YxSystemConfigService; |
|
|
|
|
import co.yixiang.modules.user.domain.YxUser; |
|
|
|
|
import co.yixiang.modules.user.service.YxUserService; |
|
|
|
|
import co.yixiang.modules.user.service.dto.WechatUserDto; |
|
|
|
@ -49,8 +51,8 @@ public class WeixinTemplateService {
|
|
|
|
|
@Autowired |
|
|
|
|
private YxWechatTemplateService yxWechatTemplateService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private YxSystemConfigService systemConfigService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 充值成功通知 |
|
|
|
@ -73,7 +75,7 @@ public class WeixinTemplateService {
|
|
|
|
|
map.put("remark", ShopConstants.ZSW_WECHAT_PUSH_REMARK); |
|
|
|
|
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, BxgConstans.SITE_URL +"/user/account",map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -100,7 +102,7 @@ public class WeixinTemplateService {
|
|
|
|
|
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK); |
|
|
|
|
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, BxgConstans.SITE_URL+"/order/detail/"+orderId,map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -119,13 +121,13 @@ public class WeixinTemplateService {
|
|
|
|
|
map.put("keyword2",price); |
|
|
|
|
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK); |
|
|
|
|
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue()); |
|
|
|
|
String appId=redisUtils.getY(ShopKeyUtils.getWxAppAppId()); |
|
|
|
|
String appId=systemConfigService.getData(ShopKeyUtils.getWxAppAppId()); |
|
|
|
|
if(StrUtil.isNotBlank(tempId)) { |
|
|
|
|
if(StrUtil.isBlank(appId)){ |
|
|
|
|
this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map); |
|
|
|
|
this.sendWxMpTemplateMessage( openId,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map); |
|
|
|
|
}else{ |
|
|
|
|
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram(); |
|
|
|
|
miniProgram.setAppid(redisUtils.getY(ShopKeyUtils.getWxAppAppId())); |
|
|
|
|
miniProgram.setAppid(systemConfigService.getData(ShopKeyUtils.getWxAppAppId())); |
|
|
|
|
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId); |
|
|
|
|
this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map); |
|
|
|
|
} |
|
|
|
@ -160,7 +162,7 @@ public class WeixinTemplateService {
|
|
|
|
|
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK); |
|
|
|
|
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, BxgConstans.SITE_URL+"/order/detail/"+orderId,map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -181,13 +183,13 @@ public class WeixinTemplateService {
|
|
|
|
|
map.put("keyword3", time); |
|
|
|
|
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK); |
|
|
|
|
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue()); |
|
|
|
|
String appId=redisUtils.getY(ShopKeyUtils.getWxAppAppId()); |
|
|
|
|
String appId=systemConfigService.getData(ShopKeyUtils.getWxAppAppId()); |
|
|
|
|
if(StrUtil.isNotBlank(tempId)) { |
|
|
|
|
if(StrUtil.isBlank(appId)){ |
|
|
|
|
this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map); |
|
|
|
|
this.sendWxMpTemplateMessage( openId,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map); |
|
|
|
|
}else{ |
|
|
|
|
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram(); |
|
|
|
|
miniProgram.setAppid(redisUtils.getY(ShopKeyUtils.getWxAppAppId())); |
|
|
|
|
miniProgram.setAppid(systemConfigService.getData(ShopKeyUtils.getWxAppAppId())); |
|
|
|
|
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId); |
|
|
|
|
this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map); |
|
|
|
|
} |
|
|
|
@ -218,7 +220,7 @@ public class WeixinTemplateService {
|
|
|
|
|
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK); |
|
|
|
|
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, BxgConstans.SITE_URL+"/order/detail/"+orderId,map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -292,17 +294,6 @@ public class WeixinTemplateService {
|
|
|
|
|
return yxWechatTemplate.getTempid(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 返回H5 url |
|
|
|
|
* @return url |
|
|
|
|
*/ |
|
|
|
|
private String getSiteUrl(){ |
|
|
|
|
String apiUrl = redisUtils.getY(ShopKeyUtils.getSiteUrl()); |
|
|
|
|
if(StrUtil.isBlank(apiUrl)){ |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
return apiUrl; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取openid |
|
|
|
|