|
@@ -3,13 +3,11 @@ package com.zanxiang.game.module.sdk.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.zanxiang.game.back.base.ServerInfo;
|
|
|
-import com.zanxiang.game.back.base.pojo.dto.TtAccountRpcDTO;
|
|
|
-import com.zanxiang.game.back.base.pojo.dto.TtOrderRpcDTO;
|
|
|
-import com.zanxiang.game.back.base.pojo.dto.TtUserActiveRpcDTO;
|
|
|
-import com.zanxiang.game.back.base.rpc.ITtMiniGameBackRpc;
|
|
|
-import com.zanxiang.game.back.base.pojo.dto.TencentOrderDTO;
|
|
|
-import com.zanxiang.game.back.base.pojo.dto.TencentUserDTO;
|
|
|
+import com.zanxiang.game.back.base.pojo.dto.*;
|
|
|
+import com.zanxiang.game.back.base.rpc.ITencentMiniGameBackRpc;
|
|
|
import com.zanxiang.game.back.base.rpc.ITencentUserActionBackRpc;
|
|
|
+import com.zanxiang.game.back.base.rpc.ITtMiniGameBackRpc;
|
|
|
+import com.zanxiang.game.module.base.pojo.enums.AccountTypeEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
|
|
|
import com.zanxiang.game.module.mybatis.entity.*;
|
|
|
import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
|
|
@@ -33,10 +31,13 @@ import java.util.Objects;
|
|
|
public class CallBackServiceImpl implements ICallBackService {
|
|
|
|
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
- private ITencentUserActionBackRpc gameBackTencentRpc;
|
|
|
+ private ITencentUserActionBackRpc tencentUserActionBackRpc;
|
|
|
|
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
- private ITtMiniGameBackRpc wechatMiniGameDataReportRpc;
|
|
|
+ private ITencentMiniGameBackRpc tencentMiniGameBackRpc;
|
|
|
+
|
|
|
+ @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
+ private ITtMiniGameBackRpc ttMiniGameBackRpc;
|
|
|
|
|
|
@Autowired
|
|
|
private IAgentService agentService;
|
|
@@ -75,20 +76,29 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
.eq(GameApplet::getGameId, user.getGameId()));
|
|
|
log.error("用户注册回传, userId : {}", user.getId());
|
|
|
try {
|
|
|
- //腾讯回传
|
|
|
- if (Objects.equals(agent.getAccountType(), Agent.ACCOUNT_TYPE_TENCENT)) {
|
|
|
+ //腾讯H5回传
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_H5.getValue())) {
|
|
|
TencentUserDTO tencentUserDTO = this.transform(user, agent, gameApplet);
|
|
|
- log.error("用户注册 --> 腾讯回传提交, tencentUserDTO : {}", JsonUtil.toString(tencentUserDTO));
|
|
|
- gameBackTencentRpc.backUser(tencentUserDTO);
|
|
|
+ log.error("用户注册 --> 腾讯H5回传提交, tencentUserDTO : {}", JsonUtil.toString(tencentUserDTO));
|
|
|
+ tencentUserActionBackRpc.backUser(tencentUserDTO);
|
|
|
+ }
|
|
|
+ //腾讯小游戏回传
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())) {
|
|
|
+ TencentUserDTO tencentUserDTO = this.transform(user, agent, gameApplet);
|
|
|
+ //解析设置clickId
|
|
|
+ Map<String, String> channelMap = agentService.channelTransform(user.getChannel());
|
|
|
+ tencentUserDTO.setClickId(channelMap.get("gdt_vid"));
|
|
|
+ log.error("用户注册 --> 腾讯小游戏回传提交, tencentUserDTO : {}", JsonUtil.toString(tencentUserDTO));
|
|
|
+ tencentMiniGameBackRpc.backUser(tencentUserDTO);
|
|
|
}
|
|
|
//头条回传
|
|
|
- if (CollectionUtils.isNotEmpty(urlParamMap) && Objects.equals(agent.getAccountType(), Agent.ACCOUNT_TYPE_BYTE)) {
|
|
|
+ if (CollectionUtils.isNotEmpty(urlParamMap) && Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
Game game = gameService.getById(user.getGameId());
|
|
|
//判断是微信小游戏
|
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_WX_APPLET.getId())) {
|
|
|
TtUserActiveRpcDTO activeReportRpcDTO = this.transform(user, agent, gameApplet, urlParamMap);
|
|
|
log.error("用户注册 --> 头条回传提交, activeReportRpcDTO : {}", JsonUtil.toString(activeReportRpcDTO));
|
|
|
- wechatMiniGameDataReportRpc.userActiveReport(activeReportRpcDTO);
|
|
|
+ ttMiniGameBackRpc.userActiveReport(activeReportRpcDTO);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -115,20 +125,29 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
.eq(GameApplet::getGameId, user.getGameId()));
|
|
|
log.error("用户订单回传, orderId : {}", platformOrderDTO.getOrderId());
|
|
|
try {
|
|
|
- //腾讯回传
|
|
|
- if (Objects.equals(agent.getAccountType(), Agent.ACCOUNT_TYPE_TENCENT)) {
|
|
|
+ //腾讯H5回传
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_H5.getValue())) {
|
|
|
+ TencentOrderDTO tencentOrderDTO = this.transform(platformOrderDTO, user, agent, gameApplet);
|
|
|
+ log.error("用户下单 --> 腾讯H5回传提交, tencentOrderDTO : {}", JsonUtil.toString(tencentOrderDTO));
|
|
|
+ tencentUserActionBackRpc.backOrder(tencentOrderDTO);
|
|
|
+ }
|
|
|
+ //腾讯小游戏回传
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_MINI_GAME.getValue())) {
|
|
|
TencentOrderDTO tencentOrderDTO = this.transform(platformOrderDTO, user, agent, gameApplet);
|
|
|
- log.error("用户下单 --> 腾讯回传提交, tencentOrderDTO : {}", JsonUtil.toString(tencentOrderDTO));
|
|
|
- gameBackTencentRpc.backOrder(tencentOrderDTO);
|
|
|
+ //解析设置clickId
|
|
|
+ Map<String, String> channelMap = agentService.channelTransform(user.getChannel());
|
|
|
+ tencentOrderDTO.setClickId(channelMap.get("gdt_vid"));
|
|
|
+ log.error("用户下单 --> 腾讯小游戏回传提交, tencentOrderDTO : {}", JsonUtil.toString(tencentOrderDTO));
|
|
|
+ tencentUserActionBackRpc.backOrder(tencentOrderDTO);
|
|
|
}
|
|
|
//头条回传
|
|
|
- if (Objects.equals(agent.getAccountType(), Agent.ACCOUNT_TYPE_BYTE)) {
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
//判断游戏类型
|
|
|
Game game = gameService.getById(platformOrderDTO.getGameId());
|
|
|
if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_WX_APPLET.getId())) {
|
|
|
TtOrderRpcDTO ttOrderRpcDTO = this.transform(platformOrderDTO, user.getOpenId(), agent, gameApplet);
|
|
|
log.error("用户下单 --> 头条回传提交, orderReportRpcDTO : {}", JsonUtil.toString(ttOrderRpcDTO));
|
|
|
- wechatMiniGameDataReportRpc.orderReport(ttOrderRpcDTO);
|
|
|
+ ttMiniGameBackRpc.orderReport(ttOrderRpcDTO);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -138,6 +157,7 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
|
|
|
private TencentUserDTO transform(User user, Agent agent, GameApplet gameApplet) {
|
|
|
return TencentUserDTO.builder()
|
|
|
+ .backPolicyId(agent.getBackPolicyId())
|
|
|
.gameId(user.getGameId())
|
|
|
.adAccountId(agent.getAccountId())
|
|
|
.registerTime(user.getCreateTime())
|