|
|
@ -450,11 +450,11 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
if (AppClientConstant.APP_GOV.equals(clientType)) { |
|
|
|
// 工作端
|
|
|
|
openId = getWorkOpenId(userId); |
|
|
|
saveWxWorkSubscribe(customerId, templateId, wxSubscribeStatus, userId, openId); |
|
|
|
saveWxWorkSubscribe(customerId, templateId, wxSubscribeStatus, userId, openId, wxAlwaysVisit); |
|
|
|
} else { |
|
|
|
//居民端
|
|
|
|
openId = getResiOpenId(userId); |
|
|
|
saveWxResiSubscribe(customerId, templateId, wxSubscribeStatus, userId, openId); |
|
|
|
saveWxResiSubscribe(customerId, templateId, wxSubscribeStatus, userId, openId, wxAlwaysVisit); |
|
|
|
} |
|
|
|
|
|
|
|
// 2.保存行为记录
|
|
|
@ -494,7 +494,8 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
* @author wxz |
|
|
|
* @date 2020.10.22 09:56 |
|
|
|
*/ |
|
|
|
private void saveWxResiSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, String openId) { |
|
|
|
private void saveWxResiSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, |
|
|
|
String openId, String wxAlwaysVisit) { |
|
|
|
|
|
|
|
WxmpResiUserSubscribeEntity wxResiSubscribe = wxmpResiUserSubscribeDao.getWxResiSubscribe(userId, customerId, templateId); |
|
|
|
if (wxResiSubscribe == null) { |
|
|
@ -511,8 +512,12 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
|
|
|
|
if (WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus)) { |
|
|
|
wxmpResiUserSubscribeDao.incrSubscribeCount(1, userId, customerId, templateId, openId); |
|
|
|
} else { |
|
|
|
} else if (WxMsgTemplateSubscribeStatus.UNSUBSCRIBE.equals(wxSubscribeStatus) && "yes".equals(wxAlwaysVisit)) { |
|
|
|
// 总是+取消
|
|
|
|
wxmpResiUserSubscribeDao.unSubscribe(userId, customerId, templateId, openId); |
|
|
|
} else { |
|
|
|
// 取消
|
|
|
|
wxmpResiUserSubscribeDao.decreaseResiSubscribeCount(openId, templateId, customerId, 1, userId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -522,7 +527,8 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
* @author wxz |
|
|
|
* @date 2020.10.22 14:21 |
|
|
|
*/ |
|
|
|
private void saveWxWorkSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, String openId) { |
|
|
|
private void saveWxWorkSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, |
|
|
|
String openId, String wxAlwaysVisit) { |
|
|
|
WxmpWorkUserSubscribeEntity wxWorkSubscribe = wxmpWorkUserSubscribeDao.getWxWorkSubscribe(userId, customerId, templateId); |
|
|
|
if (wxWorkSubscribe == null) { |
|
|
|
WxmpWorkUserSubscribeEntity insert = new WxmpWorkUserSubscribeEntity(); |
|
|
@ -538,8 +544,12 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
|
|
|
|
if (WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus)) { |
|
|
|
wxmpWorkUserSubscribeDao.incrSubscribeCount(1, userId, customerId, templateId, openId); |
|
|
|
} else { |
|
|
|
} else if (WxMsgTemplateSubscribeStatus.UNSUBSCRIBE.equals(wxSubscribeStatus) && "yes".equals(wxAlwaysVisit)) { |
|
|
|
// 取消订阅+总是
|
|
|
|
wxmpWorkUserSubscribeDao.unSubscribe(userId, customerId, templateId, openId); |
|
|
|
} else { |
|
|
|
// 取消订阅+不总是
|
|
|
|
wxmpWorkUserSubscribeDao.decreaseWorkSubscribeCount(openId, templateId, customerId, 1, userId); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|