|
|
|
@ -11,9 +11,11 @@ import com.hai.common.utils.RedisUtil; |
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hai.common.utils.WxUtils; |
|
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
|
import com.hai.entity.HighUser; |
|
|
|
|
import com.hai.model.HighMerchantStoreModel; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
import com.hai.service.HighMerchantStoreService; |
|
|
|
|
import com.hai.service.HighUserService; |
|
|
|
|
import com.v1.config.SysConst; |
|
|
|
|
import com.v1.config.WeChatQrcodeUtils; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@ -53,6 +55,9 @@ public class WxMsgController { |
|
|
|
|
@Resource |
|
|
|
|
private HighMerchantStoreService merchantStoreService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private HighUserService highUserService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private RedisUtil redisUtil; |
|
|
|
|
|
|
|
|
@ -108,22 +113,42 @@ public class WxMsgController { |
|
|
|
|
String msgType = map.get("MsgType"); |
|
|
|
|
// 二维码参数
|
|
|
|
|
String eventKey = map.get("EventKey"); |
|
|
|
|
String linkContent; |
|
|
|
|
|
|
|
|
|
// 判断用户是否是新用户
|
|
|
|
|
HighUser user = highUserService.findByOpenIdH5(userOpenId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String linkContent = null; |
|
|
|
|
String newUserContent = null; |
|
|
|
|
String content = null; |
|
|
|
|
if (eventKey != null && eventKey.length() != 0) { |
|
|
|
|
JSONObject object = weChatQrcodeUtils.paramPars(eventKey); |
|
|
|
|
// type = 1 推广扫码 type = 2
|
|
|
|
|
// type = 1 推广扫码 type = 2 商户门店 3:查看视频教程
|
|
|
|
|
if (Objects.equals(object.getString("qrscene_type"), "1") || Objects.equals(object.getString("type"), "1")) { |
|
|
|
|
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000010&key=&code=" + object.getString("code") + "'>点击查看更多优惠</a>\n\n"; |
|
|
|
|
} else { |
|
|
|
|
} else if (Objects.equals(object.getString("qrscene_type"), "2") || Objects.equals(object.getString("type"), "2")){ |
|
|
|
|
// 商户门店
|
|
|
|
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code")); |
|
|
|
|
linkContent = "<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>欢迎来到" + store.getStoreName()+"</a>" + "[哇][哇][哇]\n\n<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>点击这里一键加油</a>\n\n"; |
|
|
|
|
} else if (Objects.equals(object.getString("qrscene_type"), "3") || Objects.equals(object.getString("type"), "3")){ |
|
|
|
|
// 商户门店
|
|
|
|
|
linkContent = "<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>点击查看重庆中石油视频教程</a>" + |
|
|
|
|
"[哇][哇][哇]\n\n<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>点击查看贵州中石化视频教程</a>\n\n"; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击查看更多优惠</a>\n\n"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 判断是否是新用户
|
|
|
|
|
if (user == null) { |
|
|
|
|
newUserContent = "特意为您奉上" + |
|
|
|
|
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" + |
|
|
|
|
",放在您的"+ |
|
|
|
|
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+ |
|
|
|
|
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("二维码参数:" + eventKey); |
|
|
|
|
// 普通消息
|
|
|
|
|
if ("text".equals(msgType)) { |
|
|
|
@ -145,12 +170,7 @@ public class WxMsgController { |
|
|
|
|
"终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" + |
|
|
|
|
"您好,感谢关注嗨森逛商城!\n\n" + |
|
|
|
|
linkContent + |
|
|
|
|
"在线等你来撩~[哇][哇][哇]\n\n" + |
|
|
|
|
"特意为您奉上" + |
|
|
|
|
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" + |
|
|
|
|
",放在您的"+ |
|
|
|
|
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+ |
|
|
|
|
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n" + |
|
|
|
|
"在线等你来撩~[哇][哇][哇]\n\n" + newUserContent + |
|
|
|
|
"【如遇任何问题请致电客服:400-678-0738】" |
|
|
|
|
; |
|
|
|
|
// todo 业务处理
|
|
|
|
|