|
@@ -74,14 +74,16 @@ public class IntellectPushServiceImpl implements IntellectPushService {
|
|
|
AdminConfig adminConfig = adminConfigService.selectByAppid(appid);
|
|
|
SignExample example = SignExample.newAndCreateCriteria().andUidEqualTo(user.getId().intValue()).andCreatedateEqualTo(TimeUtil.getCurrentIntDate(TimeUtil.YYYYMMDD_N)).example();
|
|
|
Sign sign = signMapper.selectOneByExample(example);
|
|
|
- if (sign == null) {
|
|
|
- SignedRecommand signRecommand = signedRecommendService.selectRandom(user.getSex().toString());
|
|
|
- bookId = signRecommand.getBookId();
|
|
|
- } else {
|
|
|
+
|
|
|
+ //修改,关闭未签到推荐书库
|
|
|
+// if (sign == null) {
|
|
|
+ SignedRecommand signRecommand = signedRecommendService.selectRandom(user.getSex().toString());
|
|
|
+ bookId = signRecommand.getBookId();
|
|
|
+ /* } else {
|
|
|
SignRecommand signRecommand = signRecommendService.selectRandom(user.getSex().toString());
|
|
|
bookId = signRecommand.getBookId();
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
ManageTitle manageTitle = manageTitleService.selectRandom(user.getSex().toString());
|
|
|
ManageCover manageCover = manageCoverService.selectRandom("1", user.getSex().toString());
|
|
|
WxMpKefuMessage.WxArticle wxArticle = new WxMpKefuMessage.WxArticle();
|
|
@@ -117,17 +119,17 @@ public class IntellectPushServiceImpl implements IntellectPushService {
|
|
|
User user = userService.selectById(orders.getUserId());
|
|
|
String msg = "亲,你上次看的书还在等着你呐~ 点击继续阅读%n>%s%n首冲50元即可畅读90万字,365元年份会员更可全年无线畅读。%n%n为了下次方便阅读,请置顶公众号";
|
|
|
Long bookId = orders.getBookId();
|
|
|
- if (bookId==null){
|
|
|
+ if (bookId == null) {
|
|
|
|
|
|
UserRecentlyRead userRecentlyRead = userRecentReadService.selectLastByUserId(orders.getUserId());
|
|
|
- bookId = userRecentlyRead.getBookId();
|
|
|
+ bookId = userRecentlyRead.getBookId();
|
|
|
}
|
|
|
AdminConfig adminConfig = adminConfigService.selectByAppid(appid);
|
|
|
|
|
|
- String url =bookService.createBookUrl(bookId,adminConfig,user);
|
|
|
+ String url = bookService.createBookUrl(bookId, adminConfig, user);
|
|
|
Book book = bookService.selectById(bookId);
|
|
|
- String link = "<a href='"+url+"'>《"+book.getName()+"》</a>";
|
|
|
- msg = String.format(msg,link);
|
|
|
+ String link = "<a href='" + url + "'>《" + book.getName() + "》</a>";
|
|
|
+ msg = String.format(msg, link);
|
|
|
WxMpKefuMessage wxMpKefuMessage = new TextBuilder().toUser(user.getOpenid()).content(msg).build();
|
|
|
return wxMpKefuMessage;
|
|
|
}
|
|
@@ -142,21 +144,21 @@ public class IntellectPushServiceImpl implements IntellectPushService {
|
|
|
@Override
|
|
|
public void pushBySubscribe(Integer platformId, String appid, Long userId) {
|
|
|
try {
|
|
|
- Integer second = afterNow();
|
|
|
- if (second > 0) {
|
|
|
- redisService.set(redisService.getKeyListener().getKeyMpSubscribe(platformId, appid, userId), userId + "", second);
|
|
|
- return;
|
|
|
- }
|
|
|
- WxMpKefuMessage signMessage = createSubscribeMessage(platformId, appid, userId);
|
|
|
+ Integer second = afterNow();
|
|
|
+ if (second > 0) {
|
|
|
+ redisService.set(redisService.getKeyListener().getKeyMpSubscribe(platformId, appid, userId), userId + "", second);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ WxMpKefuMessage signMessage = createSubscribeMessage(platformId, appid, userId);
|
|
|
|
|
|
|
|
|
- WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
- WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
+ WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
+ WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
|
|
|
wxMpService.getKefuService().sendKefuMessage(signMessage);
|
|
|
} catch (WxErrorException e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("签到智能推送失败",e);
|
|
|
+ log.error("签到智能推送失败", e);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -164,21 +166,21 @@ public class IntellectPushServiceImpl implements IntellectPushService {
|
|
|
@Override
|
|
|
public void pushBySign(Integer platformId, String appid, Long userId) {
|
|
|
try {
|
|
|
- Integer second = afterNow();
|
|
|
- if (second > 0) {
|
|
|
- redisService.set(redisService.getKeyListener().getKeyMpSign(platformId, appid, userId), userId + "", second);
|
|
|
- return;
|
|
|
- }
|
|
|
- WxMpKefuMessage signMessage = createSignMessage(platformId, appid, userId);
|
|
|
+ Integer second = afterNow();
|
|
|
+ if (second > 0) {
|
|
|
+ redisService.set(redisService.getKeyListener().getKeyMpSign(platformId, appid, userId), userId + "", second);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ WxMpKefuMessage signMessage = createSignMessage(platformId, appid, userId);
|
|
|
|
|
|
|
|
|
- WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
- WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
+ WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
+ WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
|
|
|
wxMpService.getKefuService().sendKefuMessage(signMessage);
|
|
|
} catch (WxErrorException e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("签到智能推送失败",e);
|
|
|
+ log.error("签到智能推送失败", e);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -188,21 +190,21 @@ public class IntellectPushServiceImpl implements IntellectPushService {
|
|
|
@Override
|
|
|
public void pushByContinueRead(Integer platformId, String appid, Integer id) {
|
|
|
try {
|
|
|
- Integer second = afterNow();
|
|
|
- if (second > 0) {
|
|
|
- redisService.set(redisService.getKeyListener().getKeyPrefixBookContinueRead(platformId, appid, id), id + "", second);
|
|
|
- return;
|
|
|
- }
|
|
|
- WxMpKefuMessage signMessage = createContinueReadMessage(platformId, appid, id);
|
|
|
+ Integer second = afterNow();
|
|
|
+ if (second > 0) {
|
|
|
+ redisService.set(redisService.getKeyListener().getKeyPrefixBookContinueRead(platformId, appid, id), id + "", second);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ WxMpKefuMessage signMessage = createContinueReadMessage(platformId, appid, id);
|
|
|
|
|
|
|
|
|
- WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
- WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
+ WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
+ WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
|
|
|
wxMpService.getKefuService().sendKefuMessage(signMessage);
|
|
|
} catch (WxErrorException e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("继续阅读智能推送失败",e);
|
|
|
+ log.error("继续阅读智能推送失败", e);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -210,35 +212,35 @@ public class IntellectPushServiceImpl implements IntellectPushService {
|
|
|
@Override
|
|
|
public void pushByNopay(Integer platformId, String appid, Integer id) {
|
|
|
try {
|
|
|
- WxMpKefuMessage signMessage = createNopayMessage(platformId, appid, id);
|
|
|
+ WxMpKefuMessage signMessage = createNopayMessage(platformId, appid, id);
|
|
|
|
|
|
- WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
- WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
+ WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
+ WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
|
|
|
wxMpService.getKefuService().sendKefuMessage(signMessage);
|
|
|
} catch (WxErrorException e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("未支付提醒智能推送失败",e);
|
|
|
+ log.error("未支付提醒智能推送失败", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void pushByNoSign(Integer platformId, String appid, Long userId) {
|
|
|
try {
|
|
|
- Integer second = afterNow();
|
|
|
- if (second > 0) {
|
|
|
- redisService.set(redisService.getKeyListener().getKeyMpNosign(platformId, appid, userId), userId + "", second);
|
|
|
- return;
|
|
|
- }
|
|
|
- WxMpKefuMessage signMessage = createNoSignMessage(platformId, appid, userId);
|
|
|
+ Integer second = afterNow();
|
|
|
+ if (second > 0) {
|
|
|
+ redisService.set(redisService.getKeyListener().getKeyMpNosign(platformId, appid, userId), userId + "", second);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ WxMpKefuMessage signMessage = createNoSignMessage(platformId, appid, userId);
|
|
|
|
|
|
- WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
- WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
+ WxOpenService wxOpenService = wxThirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
+ WxOpenMpService wxMpService = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid);
|
|
|
|
|
|
wxMpService.getKefuService().sendKefuMessage(signMessage);
|
|
|
} catch (WxErrorException e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("未签到提醒智能推送失败",e);
|
|
|
+ log.error("未签到提醒智能推送失败", e);
|
|
|
}
|
|
|
}
|
|
|
|