From c76936275ee0619d67ec6b796ca322ba0a54c282 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Fri, 21 Oct 2022 14:32:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F=E5=85=AC?=
=?UTF-8?q?=E5=8F=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/v1/controller/WxMsgController.java | 40 ++++++++++++++-----
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java
index f4959d0a..4a1725ef 100644
--- a/v1/src/main/java/com/v1/controller/WxMsgController.java
+++ b/v1/src/main/java/com/v1/controller/WxMsgController.java
@@ -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;
@@ -89,8 +94,6 @@ public class WxMsgController {
try {
log.info("进入公众号!!!!!!!");
- // 反馈给微信服务器
- String resXml = "";
// 微信支付系统发送的数据(格式)
String notifyXml;
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
@@ -108,22 +111,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 = "点击查看更多优惠\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 = "欢迎来到" + store.getStoreName()+"" + "[哇][哇][哇]\n\n点击这里一键加油\n\n";
+ } else if (Objects.equals(object.getString("qrscene_type"), "3") || Objects.equals(object.getString("type"), "3")){
+ // 商户门店
+ linkContent = "点击查看重庆中石油视频教程" +
+ "[哇][哇][哇]\n\n点击查看贵州中石化视频教程\n\n";
}
} else {
linkContent = "点击查看更多优惠\n\n";
}
+ // 判断是否是新用户
+ if (user == null) {
+ newUserContent = "特意为您奉上" +
+ "5张优惠券" +
+ ",放在您的"+
+ "优惠券"+
+ "里面,记得及时使用哦[爱心][爱心][爱心]\n\n";
+ }
+
+
log.info("二维码参数:" + eventKey);
// 普通消息
if ("text".equals(msgType)) {
@@ -145,12 +168,7 @@ public class WxMsgController {
"终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" +
"您好,感谢关注嗨森逛商城!\n\n" +
linkContent +
- "在线等你来撩~[哇][哇][哇]\n\n" +
- "特意为您奉上" +
- "5张优惠券" +
- ",放在您的"+
- "优惠券"+
- "里面,记得及时使用哦[爱心][爱心][爱心]\n\n" +
+ "在线等你来撩~[哇][哇][哇]\n\n" + newUserContent +
"【如遇任何问题请致电客服:400-678-0738】"
;
// todo 业务处理