|
@@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.zanxiang.game.back.base.ServerInfo;
|
|
|
import com.zanxiang.game.back.base.pojo.dto.*;
|
|
|
import com.zanxiang.game.back.base.pojo.vo.OrderBackQueryRpcVO;
|
|
|
-import com.zanxiang.game.back.base.rpc.ITencentMiniGameBackRpc;
|
|
|
-import com.zanxiang.game.back.base.rpc.ITencentUserActionBackRpc;
|
|
|
-import com.zanxiang.game.back.base.rpc.ITtAppBackRpc;
|
|
|
-import com.zanxiang.game.back.base.rpc.ITtMiniGameBackRpc;
|
|
|
+import com.zanxiang.game.back.base.rpc.*;
|
|
|
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.*;
|
|
@@ -41,6 +38,9 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class CallBackServiceImpl implements ICallBackService {
|
|
|
|
|
|
+ @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
+ private ITencentAppApiBackRpc tencentAppApiBackRpc;
|
|
|
+
|
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
private ITencentUserActionBackRpc tencentUserActionBackRpc;
|
|
|
|
|
@@ -218,6 +218,12 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
tencentMiniGameBackRpc.backUser(tencentUserDTO);
|
|
|
gameBackLogService.addLog(user.getId(), null, "腾讯小游戏用户回传提交", JsonUtil.toString(tencentUserDTO));
|
|
|
}
|
|
|
+ //腾讯APP私域
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_APP_API.getValue())) {
|
|
|
+ TencentUserAppApiRpcDTO tencentUserAppApiRpcDTO = this.transform(user, agent, urlParamMap.get("callbackId"));
|
|
|
+ tencentAppApiBackRpc.backUser(tencentUserAppApiRpcDTO);
|
|
|
+ gameBackLogService.addLog(user.getId(), null, "腾讯APP私域用户回传提交", JsonUtil.toString(tencentUserAppApiRpcDTO));
|
|
|
+ }
|
|
|
//头条回传
|
|
|
if (CollectionUtils.isNotEmpty(urlParamMap) && Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
Game game = gameService.getById(agent.getGameId());
|
|
@@ -270,6 +276,12 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
tencentMiniGameBackRpc.backRoleRegister(tencentRoleRegisterRpcDTO);
|
|
|
gameBackLogService.addLog(user.getId(), gameUserRole.getRoleId(), "腾讯小游戏创角回传提交", JsonUtil.toString(tencentRoleRegisterRpcDTO));
|
|
|
}
|
|
|
+ //腾讯APP私域
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_APP_API.getValue())) {
|
|
|
+ TencentRoleRegisterAppApiRpcDTO tencentRoleRegisterAppApiRpcDTO = this.transform(gameUserRole, user, agent);
|
|
|
+ tencentAppApiBackRpc.backRoleRegister(tencentRoleRegisterAppApiRpcDTO);
|
|
|
+ gameBackLogService.addLog(user.getId(), null, "腾讯APP私域创角回传提交", JsonUtil.toString(tencentRoleRegisterAppApiRpcDTO));
|
|
|
+ }
|
|
|
//头条回传
|
|
|
if (Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
Game game = gameService.getById(agent.getGameId());
|
|
@@ -326,6 +338,12 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
tencentMiniGameBackRpc.backOrder(tencentOrderDTO);
|
|
|
gameBackLogService.addLog(user.getId(), platformOrderDTO.getOrderId(), "腾讯小游戏订单回传提交", JsonUtil.toString(tencentOrderDTO));
|
|
|
}
|
|
|
+ //腾讯APP私域
|
|
|
+ if (Objects.equals(agent.getAccountType(), AccountTypeEnum.TENCENT_APP_API.getValue())) {
|
|
|
+ TencentOrderAppApiRpcDTO tencentOrderAppApiRpcDTO = this.transform(user, agent, platformOrderDTO);
|
|
|
+ tencentAppApiBackRpc.backOrder(tencentOrderAppApiRpcDTO);
|
|
|
+ gameBackLogService.addLog(user.getId(), platformOrderDTO.getOrderId(), "腾讯APP私域订单回传提交", JsonUtil.toString(tencentOrderAppApiRpcDTO));
|
|
|
+ }
|
|
|
//头条回传
|
|
|
if (Objects.equals(agent.getAccountType(), AccountTypeEnum.BYTE.getValue())) {
|
|
|
//判断游戏类型
|
|
@@ -538,4 +556,68 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
.roleId(roleId)
|
|
|
.build();
|
|
|
}
|
|
|
+
|
|
|
+ private TencentUserAppApiRpcDTO transform(User user, Agent agent, String callbackId) {
|
|
|
+ return TencentUserAppApiRpcDTO.builder()
|
|
|
+ .backPolicyId(agent.getBackPolicyId())
|
|
|
+ .userId(user.getId().toString())
|
|
|
+ .gameId(agent.getGameId())
|
|
|
+ .adAccountId(agent.getAccountId())
|
|
|
+ .registerTime(user.getCreateTime())
|
|
|
+ .channel(agent.getAgentKey())
|
|
|
+ .mac(user.getMac())
|
|
|
+ .imei(user.getImei())
|
|
|
+ .oaid(user.getOaid())
|
|
|
+ .androidId(user.getAndroidId())
|
|
|
+ .idfa(user.getIdfa())
|
|
|
+ .caid(user.getCaid())
|
|
|
+ .regIp(user.getIp())
|
|
|
+ .userActionSetId(agent.getUserActionSetId())
|
|
|
+ .callbackId(Strings.isBlank(callbackId) ? null : Long.valueOf(callbackId))
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+ private TencentRoleRegisterAppApiRpcDTO transform(GameUserRole gameUserRole, User user, Agent agent) {
|
|
|
+ return TencentRoleRegisterAppApiRpcDTO.builder()
|
|
|
+ .backPolicyId(agent.getBackPolicyId())
|
|
|
+ .userId(user.getId().toString())
|
|
|
+ .gameId(agent.getGameId())
|
|
|
+ .adAccountId(agent.getAccountId())
|
|
|
+ .registerTime(user.getCreateTime())
|
|
|
+ .channel(agent.getAgentKey())
|
|
|
+ .roleId(gameUserRole.getRoleId())
|
|
|
+ .roleName(gameUserRole.getRoleName())
|
|
|
+ .mac(user.getMac())
|
|
|
+ .imei(user.getImei())
|
|
|
+ .oaid(user.getOaid())
|
|
|
+ .androidId(user.getAndroidId())
|
|
|
+ .idfa(user.getIdfa())
|
|
|
+ .caid(user.getCaid())
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+ private TencentOrderAppApiRpcDTO transform(User user, Agent agent, PlatformOrderDTO platformOrderDTO) {
|
|
|
+ return TencentOrderAppApiRpcDTO.builder()
|
|
|
+ .backPolicyId(agent.getBackPolicyId())
|
|
|
+ .userId(user.getId().toString())
|
|
|
+ .gameId(agent.getGameId())
|
|
|
+ .adAccountId(agent.getAccountId())
|
|
|
+ .registerTime(user.getCreateTime())
|
|
|
+ .rechargeMoney(platformOrderDTO.getAmount().multiply(new BigDecimal(100)).longValue())
|
|
|
+ .rechargeTime(platformOrderDTO.getCreateTime())
|
|
|
+ .orderId(platformOrderDTO.getOrderId())
|
|
|
+ .channel(agent.getAgentKey())
|
|
|
+ .orderStatus(platformOrderDTO.getStatus())
|
|
|
+ .payTime(platformOrderDTO.getPayTime())
|
|
|
+ .roleId(platformOrderDTO.getRoleId())
|
|
|
+ .roleName(platformOrderDTO.getRoleName())
|
|
|
+ .mac(user.getMac())
|
|
|
+ .imei(user.getImei())
|
|
|
+ .oaid(user.getOaid())
|
|
|
+ .androidId(user.getAndroidId())
|
|
|
+ .idfa(user.getIdfa())
|
|
|
+ .caid(user.getCaid())
|
|
|
+ .build();
|
|
|
+
|
|
|
+ }
|
|
|
}
|