|
@@ -2,6 +2,7 @@ package com.qs.mp.framework.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.qs.mp.admin.domain.Marketing;
|
|
|
+import com.qs.mp.common.enums.AppSourceEnum;
|
|
|
import com.qs.mp.common.utils.LogUtil;
|
|
|
import com.qs.mp.common.utils.StringUtils;
|
|
|
import com.qs.mp.common.utils.http.HttpUtils;
|
|
@@ -57,10 +58,14 @@ public class WxSubscribeMessageImpl implements IWxSubscribeMessage {
|
|
|
@Override
|
|
|
public void sendMarketingHelp(Long userId, Marketing marketing) {
|
|
|
String openId = getOpenIdByUserId(userId);
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(userId);
|
|
|
+ if (sysUser != null) {
|
|
|
+ openId = sysUser.getMsdqOpenId();
|
|
|
+ }
|
|
|
if (StringUtils.isBlank(openId)) {
|
|
|
return;
|
|
|
}
|
|
|
- WxSubscribeMessage wxSubscribeMessage = new WxSubscribeMessage(userAppId, openId, state);
|
|
|
+ WxSubscribeMessage wxSubscribeMessage = new WxSubscribeMessage(AppSourceEnum.MSDQ.getAppId(), openId, state);
|
|
|
wxSubscribeMessage.buildMarketingHelpSuccessMessage(marketing);
|
|
|
this.sendNotify(userId, marketing.getId().toString(), wxSubscribeMessage);
|
|
|
}
|
|
@@ -68,10 +73,14 @@ public class WxSubscribeMessageImpl implements IWxSubscribeMessage {
|
|
|
@Override
|
|
|
public boolean sendMarketingLottery(Long userId, Marketing marketing) {
|
|
|
String openId = getOpenIdByUserId(userId);
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(userId);
|
|
|
+ if (sysUser != null) {
|
|
|
+ openId = sysUser.getMsdqOpenId();
|
|
|
+ }
|
|
|
if (StringUtils.isBlank(openId)) {
|
|
|
return true;
|
|
|
}
|
|
|
- WxSubscribeMessage wxSubscribeMessage = new WxSubscribeMessage(userAppId, openId, state);
|
|
|
+ WxSubscribeMessage wxSubscribeMessage = new WxSubscribeMessage(AppSourceEnum.MSDQ.getAppId(), openId, state);
|
|
|
wxSubscribeMessage.buildMarketingLotterySuccessMessage(marketing);
|
|
|
return this.sendNotify(userId, marketing.getId().toString(), wxSubscribeMessage);
|
|
|
}
|
|
@@ -83,7 +92,7 @@ public class WxSubscribeMessageImpl implements IWxSubscribeMessage {
|
|
|
|
|
|
private boolean sendNotify(Long userId, String bizId, WxSubscribeMessage message) {
|
|
|
// 获取access_token
|
|
|
- String accessToken = appTokenService.getAccessToken(userAppId);
|
|
|
+ String accessToken = appTokenService.getAccessToken(AppSourceEnum.MSDQ.getAppId());
|
|
|
String res = HttpUtils.sendPost(
|
|
|
"https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken,
|
|
|
JSON.toJSONString(message));
|