|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.v1.controller; |
|
|
|
package com.v1.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.druid.sql.visitor.functions.If; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
@ -9,6 +10,7 @@ import com.hai.common.pay.util.XmlUtil; |
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.WxUtils; |
|
|
|
import com.hai.common.utils.WxUtils; |
|
|
|
|
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.model.HighMerchantStoreModel; |
|
|
|
import com.hai.model.HighMerchantStoreModel; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.TextMessage; |
|
|
|
import com.hai.model.TextMessage; |
|
|
@ -42,6 +44,7 @@ import java.io.BufferedOutputStream; |
|
|
|
import java.io.StringReader; |
|
|
|
import java.io.StringReader; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
import java.util.SortedMap; |
|
|
|
import java.util.SortedMap; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -86,7 +89,25 @@ public class WxMsgController { |
|
|
|
String event = map.get("Event"); |
|
|
|
String event = map.get("Event"); |
|
|
|
// 区分消息类型
|
|
|
|
// 区分消息类型
|
|
|
|
String msgType = map.get("MsgType"); |
|
|
|
String msgType = map.get("MsgType"); |
|
|
|
|
|
|
|
// 二维码参数
|
|
|
|
|
|
|
|
String eventKey = map.get("EventKey"); |
|
|
|
|
|
|
|
String linkContent; |
|
|
|
|
|
|
|
String content = null; |
|
|
|
|
|
|
|
if (eventKey != null) { |
|
|
|
|
|
|
|
JSONObject object = weChatQrcodeUtils.paramPars(eventKey); |
|
|
|
|
|
|
|
// type = 1 推广扫码 type = 2
|
|
|
|
|
|
|
|
if (Objects.equals(object.getString("qrscene_type"), "1")) { |
|
|
|
|
|
|
|
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000010&key=&code=" + object.getString("code") + "'>点击注册</a>\n\n"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 商户门店
|
|
|
|
|
|
|
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code")); |
|
|
|
|
|
|
|
linkContent = "欢迎来到" + store.getStoreName() + "[哇][哇][哇]\n\n<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>点击这里一键加油</a>\n\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击注册</a>\n\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("二维码参数:" + eventKey); |
|
|
|
// 普通消息
|
|
|
|
// 普通消息
|
|
|
|
if ("text".equals(msgType)) { |
|
|
|
if ("text".equals(msgType)) { |
|
|
|
// todo 处理文本消息
|
|
|
|
// todo 处理文本消息
|
|
|
@ -102,33 +123,42 @@ public class WxMsgController { |
|
|
|
// 用户关注公众号
|
|
|
|
// 用户关注公众号
|
|
|
|
if ("subscribe".equals(event)) { |
|
|
|
if ("subscribe".equals(event)) { |
|
|
|
log.info("进入扫码关注流程:" + event); |
|
|
|
log.info("进入扫码关注流程:" + event); |
|
|
|
// 商户门店
|
|
|
|
|
|
|
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(map.get("EventKey")); |
|
|
|
|
|
|
|
// todo 业务处理
|
|
|
|
// todo 业务处理
|
|
|
|
String content = "欢迎来到" + store.getStoreName() + "<a href='https://hsgcs.dctpay.com/hsgH5?accountId=000000&gasKey=" + map.get("EventKey") + "&staffCode='>点击这里一键加油</a>"; |
|
|
|
content = |
|
|
|
|
|
|
|
"终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" + |
|
|
|
map.put("content" , content); |
|
|
|
"您好,感谢关注嗨森逛商城!\n\n" + |
|
|
|
String mapToXml = weChatQrcodeUtils.handleEventSubscribe(map); |
|
|
|
linkContent + |
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
"在线等你来撩~[哇][哇][哇]\n\n" + |
|
|
|
response.getWriter().print(mapToXml); |
|
|
|
"特意为您奉上" + |
|
|
|
|
|
|
|
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" + |
|
|
|
|
|
|
|
",放在您的"+ |
|
|
|
|
|
|
|
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>卡包</a>"+ |
|
|
|
|
|
|
|
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n" + |
|
|
|
|
|
|
|
"【如遇任何问题请致电客服:400-678-0738】" |
|
|
|
|
|
|
|
; |
|
|
|
// todo 业务处理
|
|
|
|
// todo 业务处理
|
|
|
|
} |
|
|
|
} |
|
|
|
// 用户扫码进入公众号
|
|
|
|
// 用户扫码进入公众号
|
|
|
|
else if ("SCAN".equals(event)) { |
|
|
|
else if ("SCAN".equals(event)) { |
|
|
|
// 商户门店
|
|
|
|
|
|
|
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(map.get("EventKey")); |
|
|
|
|
|
|
|
// todo 业务处理
|
|
|
|
// todo 业务处理
|
|
|
|
String content = "欢迎来到" + store.getStoreName() + "<a href='https://hsgcs.dctpay.com/hsgH5?accountId=000000&gasKey=" + map.get("EventKey") + "&staffCode='>点击这里一键加油</a>"; |
|
|
|
content = |
|
|
|
|
|
|
|
"油价很贵,诗和远方也很贵[可怜]\n\n" + |
|
|
|
|
|
|
|
"“一键加油”有”油“惠[红包][红包][红包]\n\n" + |
|
|
|
|
|
|
|
linkContent + |
|
|
|
|
|
|
|
"多重好礼为您助力\n\n" + |
|
|
|
|
|
|
|
"加油的时候少点心疼,踩油门的时候多点豪横![得意][得意][得意]\n\n" + |
|
|
|
|
|
|
|
"【如遇任何问题请致电客服:400-678-0738】" |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("content" , content); |
|
|
|
|
|
|
|
String mapToXml = weChatQrcodeUtils.handleEventSubscribe(map); |
|
|
|
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
|
|
|
response.getWriter().print(mapToXml); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if ("unsubscribe".equals(event)) { |
|
|
|
}else if ("unsubscribe".equals(event)) { |
|
|
|
// todo 取消关注 业务处理
|
|
|
|
// todo 取消关注 业务处理
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
map.put("content" , content); |
|
|
|
|
|
|
|
String mapToXml = weChatQrcodeUtils.handleEventSubscribe(map); |
|
|
|
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
|
|
|
response.getWriter().print(mapToXml); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
// return null;
|
|
|
|
// return null;
|
|
|
|