|
@@ -187,46 +187,46 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
|
|
|
if (kfSessionFrom == null) {
|
|
|
return;
|
|
|
}
|
|
|
+ //查询玩家访问信息
|
|
|
+ UserApplet userApplet = userAppletService.getOne(new LambdaQueryWrapper<UserApplet>()
|
|
|
+ .eq(UserApplet::getAppId, appId)
|
|
|
+ .eq(UserApplet::getOpenId, openId)
|
|
|
+ .orderByDesc(UserApplet::getCreateTime)
|
|
|
+ .last("limit 1"));
|
|
|
+ //不存在访问信息, 不处理
|
|
|
+ if (userApplet == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, String> channelMap = JsonUtil.toMap(userApplet.getChannel(), Map.class, String.class);
|
|
|
+ String pageSign = channelMap.get(KfAppletReply.PAGE_SIGN);
|
|
|
//获取自动回复配置
|
|
|
- KfAppletReply kfAppletReply = kfAppletReplyService.getById(gameId);
|
|
|
+ KfAppletReply kfAppletReply = kfAppletReplyService.getOne(new LambdaQueryWrapper<KfAppletReply>()
|
|
|
+ .eq(KfAppletReply::getGameId, gameId)
|
|
|
+ .eq(KfAppletReply::getAppId, appId)
|
|
|
+ .eq(Strings.isNotBlank(pageSign), KfAppletReply::getPageSign, pageSign)
|
|
|
+ .orderByDesc(KfAppletReply::getCreateTime)
|
|
|
+ .last("limit 1"));
|
|
|
if (kfAppletReply == null) {
|
|
|
return;
|
|
|
}
|
|
|
- //判断是否来源与平台
|
|
|
- if (Objects.equals(kfSessionFrom, KfSessionFromEnum.KF_SESSION_FROM_PLATFORM)) {
|
|
|
- //回复默认消息
|
|
|
- if (Strings.isNotBlank(kfAppletReply.getReplyDefault())) {
|
|
|
- this.sysMsgSend(gameId, openId, kfAppletReply.getReplyDefault(), kfRoom);
|
|
|
- }
|
|
|
- }
|
|
|
- //判断是否来源于广告
|
|
|
- if (Objects.equals(kfSessionFrom, KfSessionFromEnum.KF_SESSION_FROM_AD)) {
|
|
|
- //存在文本消息发送
|
|
|
- if (Strings.isNotBlank(kfAppletReply.getReplyText())) {
|
|
|
- this.sysMsgSend(gameId, openId, kfAppletReply.getReplyText(), kfRoom);
|
|
|
- }
|
|
|
- //存在图片发送
|
|
|
- if (Strings.isNotBlank(kfAppletReply.getReplyImg())) {
|
|
|
- this.sysImgMsgSend(gameId, openId, kfAppletReply.getReplyImg(), kfRoom);
|
|
|
- }
|
|
|
- //存在链接发送
|
|
|
- if (Strings.isNotBlank(kfAppletReply.getReplyLink())) {
|
|
|
- //链接消息参数转换
|
|
|
- Map<String, String> linkMap = JsonUtil.toMap(kfAppletReply.getReplyLink(), Map.class, String.class);
|
|
|
- String url = linkMap.get("url");
|
|
|
- //链接拼接短链id
|
|
|
- if (Strings.isNotBlank(url)) {
|
|
|
- UserApplet userApplet = userAppletService.getOne(new LambdaQueryWrapper<UserApplet>()
|
|
|
- .eq(UserApplet::getAppId, appId)
|
|
|
- .eq(UserApplet::getOpenId, openId)
|
|
|
- .orderByDesc(UserApplet::getCreateTime)
|
|
|
- .last("limit 1"));
|
|
|
- if (userApplet != null) {
|
|
|
- linkMap.put("url", url + "?customer_channel=" + userApplet.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- this.sysLinkMsgSend(gameId, openId, kfRoom, linkMap);
|
|
|
+ //存在文本消息发送
|
|
|
+ if (Strings.isNotBlank(kfAppletReply.getReplyText())) {
|
|
|
+ this.sysMsgSend(gameId, openId, kfAppletReply.getReplyText(), kfRoom);
|
|
|
+ }
|
|
|
+ //存在图片发送
|
|
|
+ if (Strings.isNotBlank(kfAppletReply.getReplyImg())) {
|
|
|
+ this.sysImgMsgSend(gameId, openId, kfAppletReply.getReplyImg(), kfRoom);
|
|
|
+ }
|
|
|
+ //存在链接发送
|
|
|
+ if (Strings.isNotBlank(kfAppletReply.getReplyLink())) {
|
|
|
+ //链接消息参数转换
|
|
|
+ Map<String, String> linkMap = JsonUtil.toMap(kfAppletReply.getReplyLink(), Map.class, String.class);
|
|
|
+ String url = linkMap.get("url");
|
|
|
+ //链接拼接短链id
|
|
|
+ if (Strings.isNotBlank(url)) {
|
|
|
+ linkMap.put("url", url + "?customer_channel=" + userApplet.getId());
|
|
|
}
|
|
|
+ this.sysLinkMsgSend(gameId, openId, kfRoom, linkMap);
|
|
|
}
|
|
|
}
|
|
|
|