Explorar o código

Merge remote-tracking branch 'origin/package' into package

zhangxianyu hai 10 meses
pai
achega
1d102689a8
Modificáronse 22 ficheiros con 348 adicións e 74 borrados
  1. 6 0
      game-back/game-back-base/src/main/java/com/zanxiang/game/back/base/pojo/dto/TencentAppApiUserAgentQueryRpcDTO.java
  2. 4 2
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameOceanengineAppOrderLogServiceImpl.java
  3. 4 2
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameOceanengineOrderLogServiceImpl.java
  4. 27 10
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppApiOrderServiceImpl.java
  5. 23 12
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppApiRoleRegisterServiceImpl.java
  6. 24 13
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppApiUserServiceImpl.java
  7. 4 4
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppCallbackServiceImpl.java
  8. 4 2
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentMiniGameOrderServiceImpl.java
  9. 3 1
      game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentOrderServiceImpl.java
  10. 7 0
      game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/controller/GameParentController.java
  11. 6 0
      game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/pojo/vo/RolePayVO.java
  12. 2 0
      game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/service/IAdsRoleAmountRateParentService.java
  13. 2 8
      game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/service/impl/AdsRoleAmountDataParentServiceImpl.java
  14. 58 0
      game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/service/impl/AdsRoleAmountRateParentServiceImpl.java
  15. 7 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/AgentController.java
  16. 18 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/TencentNewWebUserActionSetDTO.java
  17. 3 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IAgentService.java
  18. 18 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/AgentServiceImpl.java
  19. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java
  20. 38 10
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/AgentServiceImpl.java
  21. 86 4
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/CallBackServiceImpl.java
  22. 3 5
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/util/WxPayUtil.java

+ 6 - 0
game-back/game-back-base/src/main/java/com/zanxiang/game/back/base/pojo/dto/TencentAppApiUserAgentQueryRpcDTO.java

@@ -1,11 +1,17 @@
 package com.zanxiang.game.back.base.pojo.dto;
 
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
 
 @Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
 public class TencentAppApiUserAgentQueryRpcDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 

+ 4 - 2
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameOceanengineAppOrderLogServiceImpl.java

@@ -24,6 +24,7 @@ import com.zanxiang.game.back.serve.utils.OrderUtil;
 import com.zanxiang.game.module.base.ServerInfo;
 import com.zanxiang.game.module.base.pojo.vo.AgentRpcVO;
 import com.zanxiang.game.module.base.rpc.IAgentRpc;
+import com.zanxiang.module.util.ObjectUtil;
 import com.zanxiang.module.util.bean.BeanUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -434,7 +435,7 @@ public class GameOceanengineAppOrderLogServiceImpl extends ServiceImpl<GameOcean
 
         @Override
         public Long totalRechargeAmount() {
-            return gameOceanengineAppOrderLogService.getOne(new QueryWrapper<GameOceanengineAppOrderLog>()
+            Map<String, Object> data = gameOceanengineAppOrderLogService.getMap(new QueryWrapper<GameOceanengineAppOrderLog>()
                     .select("ifnull(sum(amount), 0) as amount").lambda()
                     .eq(GameOceanengineAppOrderLog::getGameId, orderLog.getGameId())
                     .eq(GameOceanengineAppOrderLog::getAccountId, orderLog.getAccountId())
@@ -442,7 +443,8 @@ public class GameOceanengineAppOrderLogServiceImpl extends ServiceImpl<GameOcean
                     .eq(GameOceanengineAppOrderLog::getOrderStatus, OrderStatusEnum.SUCCESS_PAY.getValue())
                     .eq(GameOceanengineAppOrderLog::getUserId, userLog.getUserId())
                     .ne(GameOceanengineAppOrderLog::getOrderNo, orderLog.getOrderNo())
-            ).getAmount();
+            );
+            return ObjectUtil.objToLong(data.get("amount"), 0L);
         }
     }
 }

+ 4 - 2
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameOceanengineOrderLogServiceImpl.java

@@ -33,6 +33,7 @@ import com.zanxiang.game.module.base.pojo.vo.AgentRpcVO;
 import com.zanxiang.game.module.base.rpc.IAgentRpc;
 import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.NumberUtil;
+import com.zanxiang.module.util.ObjectUtil;
 import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import lombok.extern.slf4j.Slf4j;
@@ -536,7 +537,7 @@ public class GameOceanengineOrderLogServiceImpl extends ServiceImpl<GameOceaneng
 
         @Override
         public Long totalRechargeAmount() {
-            return gameOceanengineOrderLogService.getOne(new QueryWrapper<GameOceanengineOrderLog>()
+            Map<String, Object> data = gameOceanengineOrderLogService.getMap(new QueryWrapper<GameOceanengineOrderLog>()
                     .select("ifnull(sum(amount), 0) as amount").lambda()
                     .eq(GameOceanengineOrderLog::getGameId, orderLog.getGameId())
                     .eq(GameOceanengineOrderLog::getAppId, orderLog.getAppId())
@@ -545,7 +546,8 @@ public class GameOceanengineOrderLogServiceImpl extends ServiceImpl<GameOceaneng
                     .eq(GameOceanengineOrderLog::getOrderStatus, OrderStatusEnum.SUCCESS_PAY.getValue())
                     .eq(GameOceanengineOrderLog::getOpenId, orderLog.getOpenId())
                     .ne(GameOceanengineOrderLog::getOrderNo, orderLog.getOrderNo())
-            ).getAmount();
+            );
+            return ObjectUtil.objToLong(data.get("amount"), 0L);
         }
     }
 }

+ 27 - 10
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppApiOrderServiceImpl.java

@@ -8,8 +8,11 @@ import com.github.sd4324530.jtuple.Tuple2;
 import com.github.sd4324530.jtuple.Tuple3;
 import com.zanxiang.advertising.tencent.base.AdvertisingTencentServer;
 import com.zanxiang.advertising.tencent.base.pojo.dto.DataReportOfAccountIdRpcDTO;
+import com.zanxiang.advertising.tencent.base.pojo.dto.DataReportOfAccountIdV3RpcDTO;
 import com.zanxiang.advertising.tencent.base.pojo.dto.UserActionRpcDTO;
+import com.zanxiang.advertising.tencent.base.pojo.dto.UserActionV3RpcDTO;
 import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
+import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetV3Rpc;
 import com.zanxiang.game.back.base.pojo.enums.OrderStatusEnum;
 import com.zanxiang.game.back.serve.dao.mapper.GameTencentAppApiOrderMapper;
 import com.zanxiang.game.back.serve.pojo.TencentAppReport;
@@ -22,6 +25,7 @@ import com.zanxiang.game.back.serve.service.*;
 import com.zanxiang.game.back.serve.utils.BackPolicyUtil;
 import com.zanxiang.module.util.DateUtil;
 import com.zanxiang.module.util.NumberUtil;
+import com.zanxiang.module.util.ObjectUtil;
 import com.zanxiang.module.util.URIUtil;
 import com.zanxiang.module.util.encryption.Md5Util;
 import com.zanxiang.module.util.exception.BaseException;
@@ -46,7 +50,7 @@ public class GameTencentAppApiOrderServiceImpl extends ServiceImpl<GameTencentAp
 implements IGameTencentAppApiOrderService {
 
     @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
-    private IUserActionSetRpc userActionSetRpc;
+    private IUserActionSetV3Rpc userActionSetRpc;
     @Autowired
     private IGameTencentAppApiBackLogService gameTencentAppApiBackLogService;
     @Autowired
@@ -219,20 +223,32 @@ implements IGameTencentAppApiOrderService {
         }
         GameTencentAppCallback callback = gameTencentAppCallbackService.getById(user.getCallbackId());
 
+        UserActionV3RpcDTO.UserIdRpcDTO userId = UserActionV3RpcDTO.UserIdRpcDTO.builder().build();
+        if ("android".equalsIgnoreCase(callback.getDeviceOsType()))  {
+            if(StringUtils.isNotBlank(callback.getMuid())) {
+                userId.setHashImei(callback.getMuid());
+            }
+            if(StringUtils.isNotBlank(callback.getHashOaid())) {
+                userId.setHashOaid(callback.getHashOaid());
+            }
+            if(StringUtils.isNotBlank(callback.getHashAndroidId())) {
+                userId.setHashAndroidId(callback.getHashAndroidId());
+            }
+        } else {
+            if(StringUtils.isNotBlank(callback.getMuid())) {
+                userId.setHashIdfa(callback.getMuid());
+            }
+        }
         Map<String, Object> actionParams = new HashMap<>();
         actionParams.put("value", backMoney);
-        DataReportOfAccountIdRpcDTO dataReportOfAccountIdRpcDTO = DataReportOfAccountIdRpcDTO.builder()
+        DataReportOfAccountIdV3RpcDTO dataReportOfAccountIdRpcDTO = DataReportOfAccountIdV3RpcDTO.builder()
                 .accountId(user.getAdAccountId())
                 .userActionSetId(user.getUserActionSetId())
-                .action(UserActionRpcDTO.builder()
+                .action(UserActionV3RpcDTO.builder()
                         .actionTime(backTime)
                         .actionType(ActionTypeEnum.PURCHASE.getActionType())
-                        .userId(UserActionRpcDTO.UserIdRpcDTO.builder()
-                                .hashImei(StringUtils.isBlank(user.getImei()) ? null : Md5Util.encrypt32(user.getImei().toLowerCase()).toLowerCase())
-                                .hashIdfa(StringUtils.isBlank(user.getOaid()) ? null : Md5Util.encrypt32(user.getIdfa().toLowerCase()).toLowerCase())
-                                .hashOaid(StringUtils.isBlank(user.getOaid()) ? null : Md5Util.encrypt32(user.getOaid().toLowerCase()).toLowerCase())
-                                .build())
-                        .trace(UserActionRpcDTO.TraceRpcDTO.builder()
+                        .userId(userId)
+                        .trace(UserActionV3RpcDTO.TraceRpcDTO.builder()
                                 .clickId(callback.getClickId())
                                 .build())
                         .actionParam(actionParams)
@@ -447,7 +463,7 @@ implements IGameTencentAppApiOrderService {
 
         @Override
         public Long totalRechargeAmount() {
-            return gameTencentAppApiOrderService.count(new QueryWrapper<GameTencentAppApiOrder>()
+            Map<String, Object> data = gameTencentAppApiOrderService.getMap(new QueryWrapper<GameTencentAppApiOrder>()
                     .select("ifnull(sum(recharge_money), 0) as recharge_money").lambda()
                     .eq(GameTencentAppApiOrder::getGameId, orderLog.getGameId())
                     .eq(GameTencentAppApiOrder::getAdAccountId, orderLog.getAdAccountId())
@@ -456,6 +472,7 @@ implements IGameTencentAppApiOrderService {
                     .eq(GameTencentAppApiOrder::getUserId, orderLog.getUserId())
                     .ne(GameTencentAppApiOrder::getOrderId, orderLog.getOrderId())
             );
+            return ObjectUtil.objToLong(data.get("recharge_money"), 0L);
         }
     }
 }

+ 23 - 12
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppApiRoleRegisterServiceImpl.java

@@ -5,10 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.sd4324530.jtuple.Tuple2;
 import com.zanxiang.advertising.tencent.base.AdvertisingTencentServer;
-import com.zanxiang.advertising.tencent.base.pojo.dto.DataReportOfAccountIdRpcDTO;
-import com.zanxiang.advertising.tencent.base.pojo.dto.DataReportOfAppIdRpcDTO;
-import com.zanxiang.advertising.tencent.base.pojo.dto.UserActionRpcDTO;
+import com.zanxiang.advertising.tencent.base.pojo.dto.*;
 import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
+import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetV3Rpc;
 import com.zanxiang.game.back.serve.dao.mapper.GameTencentAppApiRoleRegisterMapper;
 import com.zanxiang.game.back.serve.pojo.entity.*;
 import com.zanxiang.game.back.serve.pojo.enums.ActionTypeEnum;
@@ -40,7 +39,7 @@ implements IGameTencentAppApiRoleRegisterService {
     @Autowired
     private IGameTencentAppCallbackService gameTencentAppCallbackService;
     @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
-    private IUserActionSetRpc userActionSetRpc;
+    private IUserActionSetV3Rpc userActionSetRpc;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -90,18 +89,30 @@ implements IGameTencentAppApiRoleRegisterService {
 
         GameTencentAppCallback callback = gameTencentAppCallbackService.getById(user.getCallbackId());
 
-        DataReportOfAccountIdRpcDTO dataReportOfAccountIdRpcDTO = DataReportOfAccountIdRpcDTO.builder()
+        UserActionV3RpcDTO.UserIdRpcDTO userId = UserActionV3RpcDTO.UserIdRpcDTO.builder().build();
+        if ("android".equalsIgnoreCase(callback.getDeviceOsType()))  {
+            if(StringUtils.isNotBlank(callback.getMuid())) {
+                userId.setHashImei(callback.getMuid());
+            }
+            if(StringUtils.isNotBlank(callback.getHashOaid())) {
+                userId.setHashOaid(callback.getHashOaid());
+            }
+            if(StringUtils.isNotBlank(callback.getHashAndroidId())) {
+                userId.setHashAndroidId(callback.getHashAndroidId());
+            }
+        } else {
+            if(StringUtils.isNotBlank(callback.getMuid())) {
+                userId.setHashIdfa(callback.getMuid());
+            }
+        }
+        DataReportOfAccountIdV3RpcDTO dataReportOfAccountIdRpcDTO = DataReportOfAccountIdV3RpcDTO.builder()
                 .accountId(user.getAdAccountId())
                 .userActionSetId(user.getUserActionSetId())
-                .action(UserActionRpcDTO.builder()
+                .action(UserActionV3RpcDTO.builder()
                         .actionTime(roleRegisterLog.getRegisterTime())
                         .actionType(ActionTypeEnum.CREATE_ROLE.getActionType())
-                        .userId(UserActionRpcDTO.UserIdRpcDTO.builder()
-                                .hashImei(StringUtils.isBlank(user.getImei()) ? null : Md5Util.encrypt32(user.getImei().toLowerCase()).toLowerCase())
-                                .hashIdfa(StringUtils.isBlank(user.getOaid()) ? null : Md5Util.encrypt32(user.getIdfa().toLowerCase()).toLowerCase())
-                                .hashOaid(StringUtils.isBlank(user.getOaid()) ? null : Md5Util.encrypt32(user.getOaid().toLowerCase()).toLowerCase())
-                                .build())
-                        .trace(UserActionRpcDTO.TraceRpcDTO.builder()
+                        .userId(userId)
+                        .trace(UserActionV3RpcDTO.TraceRpcDTO.builder()
                                 .clickId(callback.getClickId())
                                 .build())
                         .build())

+ 24 - 13
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppApiUserServiceImpl.java

@@ -5,9 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.sd4324530.jtuple.Tuple2;
 import com.zanxiang.advertising.tencent.base.AdvertisingTencentServer;
-import com.zanxiang.advertising.tencent.base.pojo.dto.DataReportOfAccountIdRpcDTO;
-import com.zanxiang.advertising.tencent.base.pojo.dto.UserActionRpcDTO;
-import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
+import com.zanxiang.advertising.tencent.base.pojo.dto.DataReportOfAccountIdV3RpcDTO;
+import com.zanxiang.advertising.tencent.base.pojo.dto.UserActionV3RpcDTO;
+import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetV3Rpc;
 import com.zanxiang.game.back.serve.dao.mapper.GameTencentAppApiUserMapper;
 import com.zanxiang.game.back.serve.pojo.entity.GameTencentAppApiBackLog;
 import com.zanxiang.game.back.serve.pojo.entity.GameTencentAppApiUser;
@@ -17,7 +17,6 @@ import com.zanxiang.game.back.serve.pojo.enums.BackStatusEnum;
 import com.zanxiang.game.back.serve.service.IGameTencentAppApiBackLogService;
 import com.zanxiang.game.back.serve.service.IGameTencentAppApiUserService;
 import com.zanxiang.game.back.serve.service.IGameTencentAppCallbackService;
-import com.zanxiang.module.util.encryption.Md5Util;
 import com.zanxiang.module.util.pojo.ResultVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -41,7 +40,7 @@ implements IGameTencentAppApiUserService {
     @Autowired
     private RestTemplate restTemplate;
     @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
-    private IUserActionSetRpc userActionSetRpc;
+    private IUserActionSetV3Rpc userActionSetRpc;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -84,18 +83,30 @@ implements IGameTencentAppApiUserService {
 
         GameTencentAppCallback callback = gameTencentAppCallbackService.getById(userLog.getCallbackId());
 
-        DataReportOfAccountIdRpcDTO dataReportOfAccountIdRpcDTO = DataReportOfAccountIdRpcDTO.builder()
+        UserActionV3RpcDTO.UserIdRpcDTO userId = UserActionV3RpcDTO.UserIdRpcDTO.builder().build();
+        if ("android".equalsIgnoreCase(callback.getDeviceOsType()))  {
+            if(StringUtils.isNotBlank(callback.getMuid())) {
+                userId.setHashImei(callback.getMuid());
+            }
+            if(StringUtils.isNotBlank(callback.getHashOaid())) {
+                userId.setHashOaid(callback.getHashOaid());
+            }
+            if(StringUtils.isNotBlank(callback.getHashAndroidId())) {
+                userId.setHashAndroidId(callback.getHashAndroidId());
+            }
+        } else {
+            if(StringUtils.isNotBlank(callback.getMuid())) {
+                userId.setHashIdfa(callback.getMuid());
+            }
+        }
+        DataReportOfAccountIdV3RpcDTO dataReportOfAccountIdRpcDTO = DataReportOfAccountIdV3RpcDTO.builder()
                 .accountId(userLog.getAdAccountId())
                 .userActionSetId(userLog.getUserActionSetId())
-                .action(UserActionRpcDTO.builder()
+                .action(UserActionV3RpcDTO.builder()
                         .actionTime(userLog.getRegisterTime())
                         .actionType(ActionTypeEnum.ACTIVATE_APP.getActionType())
-                        .userId(UserActionRpcDTO.UserIdRpcDTO.builder()
-                                .hashImei(StringUtils.isBlank(userLog.getImei()) ? null : Md5Util.encrypt32(userLog.getImei().toLowerCase()).toLowerCase())
-                                .hashIdfa(StringUtils.isBlank(userLog.getOaid()) ? null : Md5Util.encrypt32(userLog.getIdfa().toLowerCase()).toLowerCase())
-                                .hashOaid(StringUtils.isBlank(userLog.getOaid()) ? null : Md5Util.encrypt32(userLog.getOaid().toLowerCase()).toLowerCase())
-                                .build())
-                        .trace(UserActionRpcDTO.TraceRpcDTO.builder()
+                        .userId(userId)
+                        .trace(UserActionV3RpcDTO.TraceRpcDTO.builder()
                                 .clickId(callback.getClickId())
                                 .build())
                         .build())

+ 4 - 4
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentAppCallbackServiceImpl.java

@@ -83,10 +83,10 @@ implements IGameTencentAppCallbackService {
             if(StringUtils.isNoneBlank(idfa)) {
                 and.or().eq(GameTencentAppCallback::getMuid, Md5Util.encrypt32(idfa.toUpperCase()).toLowerCase());
             }
-            and.or().and(StringUtils.isNoneBlank(ip), tmp -> {
-                        tmp.ge(GameTencentAppCallback::getClickTime, DateUtil.localDateTimeToSecond(regTime.plusDays(2)))
-                                .eq(GameTencentAppCallback::getIp, ip);
-                    });
+            and.or(StringUtils.isNoneBlank(ip), tmp -> {
+                tmp.ge(GameTencentAppCallback::getClickTime, DateUtil.localDateTimeToSecond(regTime.plusDays(2)))
+                        .eq(GameTencentAppCallback::getIp, ip);
+            });
         });
         return getOne(qw);
     }

+ 4 - 2
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentMiniGameOrderServiceImpl.java

@@ -36,6 +36,7 @@ import com.zanxiang.game.module.base.ServerInfo;
 import com.zanxiang.game.module.base.pojo.vo.AgentRpcVO;
 import com.zanxiang.game.module.base.rpc.IAgentRpc;
 import com.zanxiang.module.util.NumberUtil;
+import com.zanxiang.module.util.ObjectUtil;
 import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import lombok.extern.slf4j.Slf4j;
@@ -473,7 +474,7 @@ public class GameTencentMiniGameOrderServiceImpl extends ServiceImpl<GameTencent
 
         @Override
         public Long totalRechargeAmount() {
-            return gameTencentMiniGameOrderService.getOne(new QueryWrapper<GameTencentMiniGameOrder>()
+            Map<String, Object> data = gameTencentMiniGameOrderService.getMap(new QueryWrapper<GameTencentMiniGameOrder>()
                     .select("ifnull(sum(recharge_money), 0) as recharge_money").lambda()
                     .eq(GameTencentMiniGameOrder::getGameId, orderLog.getGameId())
                     .eq(GameTencentMiniGameOrder::getWechatAppId, orderLog.getWechatAppId())
@@ -482,7 +483,8 @@ public class GameTencentMiniGameOrderServiceImpl extends ServiceImpl<GameTencent
                     .eq(GameTencentMiniGameOrder::getOrderStatus, OrderStatusEnum.SUCCESS_PAY.getValue())
                     .eq(GameTencentMiniGameOrder::getWechatOpenid, orderLog.getWechatOpenid())
                     .ne(GameTencentMiniGameOrder::getOrderId, orderLog.getOrderId())
-            ).getRechargeMoney();
+            );
+            return ObjectUtil.objToLong(data.get("recharge_money"), 0L);
         }
     }
 }

+ 3 - 1
game-back/game-back-serve/src/main/java/com/zanxiang/game/back/serve/service/impl/GameTencentOrderServiceImpl.java

@@ -40,6 +40,7 @@ import com.zanxiang.game.module.base.ServerInfo;
 import com.zanxiang.game.module.base.pojo.vo.AgentRpcVO;
 import com.zanxiang.game.module.base.rpc.IAgentRpc;
 import com.zanxiang.module.util.NumberUtil;
+import com.zanxiang.module.util.ObjectUtil;
 import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import com.zanxiang.module.util.pojo.ResultVO;
@@ -532,7 +533,7 @@ public class GameTencentOrderServiceImpl extends ServiceImpl<GameTencentOrderMap
 
         @Override
         public Long totalRechargeAmount() {
-            return gameTencentOrderService.count(new QueryWrapper<GameTencentOrder>()
+            Map<String, Object> data = gameTencentOrderService.getMap(new QueryWrapper<GameTencentOrder>()
                     .select("ifnull(sum(recharge_money), 0) as recharge_money").lambda()
                     .eq(GameTencentOrder::getGameId, orderLog.getGameId())
                     .eq(GameTencentOrder::getWechatAppId, orderLog.getWechatAppId())
@@ -542,6 +543,7 @@ public class GameTencentOrderServiceImpl extends ServiceImpl<GameTencentOrderMap
                     .eq(GameTencentOrder::getWechatOpenid, orderLog.getWechatOpenid())
                     .ne(GameTencentOrder::getOrderId, orderLog.getOrderId())
             );
+            return ObjectUtil.objToLong(data.get("recharge_money"), 0L);
         }
     }
 }

+ 7 - 0
game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/controller/GameParentController.java

@@ -42,4 +42,11 @@ public class GameParentController {
         return ResultVO.ok(adsRoleAmountRateParentService.rolePayOfPage(dto));
     }
 
+    @ApiOperation(value = "GS角色付费留存总计")
+//    @PreAuthorize(permissionKey = "gameGs:rolePay:total")
+    @PostMapping("/role/pay/retained/total")
+    public ResultVO<RolePayVO> rolePayTotal(@Validated @RequestBody RolePayDTO dto) {
+        return ResultVO.ok(adsRoleAmountRateParentService.rolePayTotal(dto));
+    }
+
 }

+ 6 - 0
game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/pojo/vo/RolePayVO.java

@@ -1,12 +1,18 @@
 package com.zanxiang.game.gs.data.serve.pojo.vo;
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
 
 @Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
 public class RolePayVO {
 
     /**

+ 2 - 0
game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/service/IAdsRoleAmountRateParentService.java

@@ -17,4 +17,6 @@ import com.zanxiang.game.gs.data.serve.pojo.vo.RolePayVO;
 public interface IAdsRoleAmountRateParentService extends IService<AdsRoleAmountRateParent> {
 
     PageVO<RolePayVO, Row> rolePayOfPage(RolePayDTO dto);
+
+    RolePayVO rolePayTotal(RolePayDTO dto);
 }

+ 2 - 8
game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/service/impl/AdsRoleAmountDataParentServiceImpl.java

@@ -58,12 +58,6 @@ public class AdsRoleAmountDataParentServiceImpl extends ServiceImpl<AdsRoleAmoun
 
     @Override
     public PageVO<BigRVO, Row> bigRListOfPage(BigRDTO dto) {
-        if (null == dto.getDtBegin()) {
-            dto.setDtBegin(LocalDate.now());
-        }
-        if (null == dto.getDtEnd()) {
-            dto.setDtEnd(LocalDate.now());
-        }
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled(ADS_ROLE_AMOUNT_DATA_PARENT.TOTAL_AMOUNT.getName());
         } else {
@@ -153,8 +147,8 @@ public class AdsRoleAmountDataParentServiceImpl extends ServiceImpl<AdsRoleAmoun
                 .on(ADS_ROLE_AMOUNT_DATA_PARENT.GAME_ID.eq(ADS_ROLE_AMOUNT_DATA_TODAY_PARENT.GAME_ID)
                         .and(ADS_ROLE_AMOUNT_DATA_PARENT.ROLE_ID.eq(ADS_ROLE_AMOUNT_DATA_TODAY_PARENT.ROLE_ID)))
                 .and(ADS_ROLE_AMOUNT_DATA_PARENT.SERVER_ID.isNotNull().or(ADS_ROLE_AMOUNT_DATA_TODAY_PARENT.SERVER_ID.isNotNull()))
-                .ge(AdsRoleAmountDataTodayParent::getDay, dto.getDtBegin())
-                .le(AdsRoleAmountDataTodayParent::getDay, dto.getDtBegin())
+                .ge(AdsRoleAmountDataTodayParent::getDay, dto.getDtBegin(), null != dto.getDtBegin())
+                .le(AdsRoleAmountDataTodayParent::getDay, dto.getDtBegin(), null != dto.getDtEnd())
                 .ge(AdsRoleAmountDataParent::getRoleTime, null == dto.getRoleCreateDayBegin() ? null : LocalDateTime.of(dto.getRoleCreateDayBegin(), LocalTime.MIDNIGHT), null != dto.getRoleCreateDayBegin())
                 .le(AdsRoleAmountDataParent::getRoleTime, null == dto.getRoleCreateDayEnd() ? null : LocalDateTime.of(dto.getRoleCreateDayEnd(), LocalTime.MAX), null != dto.getRoleCreateDayEnd())
                 .in(AdsRoleAmountDataParent::getGsId, dto.getGsIdList(), CollectionUtils.isNotEmpty(dto.getGsIdList()))

+ 58 - 0
game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/service/impl/AdsRoleAmountRateParentServiceImpl.java

@@ -10,6 +10,7 @@ import com.zanxiang.game.gs.data.serve.pojo.vo.RolePayVO;
 import com.zanxiang.game.gs.data.serve.service.ISysUserService;
 import com.zanxiang.module.util.DateUtil;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import com.zanxiang.game.gs.data.serve.service.IAdsRoleAmountRateParentService;
 import com.zanxiang.game.gs.data.serve.pojo.entity.game.parent.AdsRoleAmountRateParent;
@@ -23,6 +24,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import static com.mybatisflex.core.query.QueryMethods.*;
 import static com.zanxiang.game.gs.data.serve.pojo.entity.game.parent.table.AdsRoleAmountDataParentTableDef.ADS_ROLE_AMOUNT_DATA_PARENT;
 import static com.zanxiang.game.gs.data.serve.pojo.entity.game.parent.table.AdsRoleAmountRateParentTableDef.ADS_ROLE_AMOUNT_RATE_PARENT;
 
@@ -55,8 +57,64 @@ public class AdsRoleAmountRateParentServiceImpl extends ServiceImpl<AdsRoleAmoun
         return new PageVO<>(paginate);
     }
 
+    @Override
+    public RolePayVO rolePayTotal(RolePayDTO dto) {
+        QueryWrapper rolePayWrapper = getRolePayTotalWrapper(dto);
+        return getMapper().selectOneByQueryAs(rolePayWrapper, RolePayVO.class);
+    }
+
+    private QueryWrapper getRolePayTotalWrapper(RolePayDTO dto) {
+        return QueryWrapper.create()
+                .from(ADS_ROLE_AMOUNT_RATE_PARENT)
+                .select(getDayN())
+                .select(sum(ADS_ROLE_AMOUNT_RATE_PARENT.ROLE_AMOUNT_NUM).as(ADS_ROLE_AMOUNT_RATE_PARENT.ROLE_AMOUNT_NUM.getName()))
+                .select(sum(ADS_ROLE_AMOUNT_RATE_PARENT.ORDER_COUNT).as(ADS_ROLE_AMOUNT_RATE_PARENT.ORDER_COUNT.getName()))
+                .select(sum(ADS_ROLE_AMOUNT_RATE_PARENT.TOTAL_AMOUNT).as(ADS_ROLE_AMOUNT_RATE_PARENT.TOTAL_AMOUNT.getName()))
+                .select(sum(ADS_ROLE_AMOUNT_RATE_PARENT.ROLE_NUM).as(ADS_ROLE_AMOUNT_RATE_PARENT.ROLE_NUM.getName()))
+                .select("ROUND(IF(SUM(role_amount_num) > 0 , SUM(total_amount) / SUM(role_amount_num), 0), 4) AS gs_arppu")
+                .select("ROUND(IF(SUM(order_count) > 0 , SUM(total_amount) / SUM(order_count), 0), 4) AS gs_avg")
+                .select("ROUND(IF(SUM(role_num) > 0 , SUM(role_amount_num) / SUM(role_num), 0), 4) AS gs_rate")
+                .ge(AdsRoleAmountRateParent::getDt, dto.getDtBegin(), null != dto.getDtBegin())
+                .le(AdsRoleAmountRateParent::getDt, dto.getDtEnd(), null != dto.getDtEnd())
+                .in(AdsRoleAmountRateParent::getGsId, dto.getGsIdList(), CollectionUtils.isNotEmpty(dto.getGsIdList()));
+    }
+
+    private String getDayN() {
+        StringBuilder currDayN = new StringBuilder(StringUtils.EMPTY);
+        for (int day = 1; day <= 90; day++) {
+            String dayN = "da" + day;
+            daySplit(currDayN, dayN);
+        }
+        for (int month = 4; month <= 12; month++) {
+            String mN = "m" + month;
+            daySplit(currDayN, mN);
+        }
+        String total = "total";
+        daySplit(currDayN, total);
+        // 移除最后一个逗号和空格
+        if (currDayN.length() > 0) {
+            currDayN.setLength(currDayN.length() - 2);
+        }
+        //返回结果
+        return currDayN.toString();
+    }
+
+    private void daySplit(StringBuilder totalDayN, String dayN) {
+        totalDayN.append(" CONCAT_WS('/', ")
+                .append("IFNULL(SUM(SPLIT_PART(").append(dayN).append(", '/', 1)), 0), ")
+                .append("IFNULL(SUM(SPLIT_PART(").append(dayN).append(", '/', 2)), 0), ")
+                .append("IFNULL(SUM(SPLIT_PART(").append(dayN).append(", '/', 3)), 0), ")
+                .append("IFNULL(SUM(SPLIT_PART(").append(dayN).append(", '/', 4)), 0), ")
+                .append("ROUND(IF(SUM(SPLIT_PART(").append(dayN).append(", '/', 1)) > 0, ")
+                .append("SUM(SPLIT_PART(").append(dayN).append(", '/', 2)) / SUM(SPLIT_PART(").append(dayN).append(", '/', 1)), 0), 4), ")
+                .append("ROUND(IF(SUM(role_num) > 0, SUM(SPLIT_PART(").append(dayN).append(", '/', 1)) / SUM(role_num), 0), 4), ")
+                .append("ROUND(IF(SUM(role_num) > 0, SUM(SPLIT_PART(").append(dayN).append(", '/', 2)) / SUM(role_num), 0), 4)) ")
+                .append("as ").append(dayN).append(", ");
+    }
+
     private QueryWrapper getRolePayWrapper(RolePayDTO dto) {
         return QueryWrapper.create()
+                .from(ADS_ROLE_AMOUNT_RATE_PARENT)
                 .select(ADS_ROLE_AMOUNT_RATE_PARENT.ALL_COLUMNS)
                 .ge(AdsRoleAmountRateParent::getDt, dto.getDtBegin(), null != dto.getDtBegin())
                 .le(AdsRoleAmountRateParent::getDt, dto.getDtEnd(), null != dto.getDtEnd())

+ 7 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/AgentController.java

@@ -3,6 +3,7 @@ package com.zanxiang.game.module.manage.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zanxiang.erp.security.annotation.PreAuthorize;
 import com.zanxiang.game.module.base.pojo.enums.AccountTypeEnum;
+import com.zanxiang.game.module.manage.pojo.dto.TencentNewWebUserActionSetDTO;
 import com.zanxiang.game.module.manage.pojo.params.AgentAddParam;
 import com.zanxiang.game.module.manage.pojo.params.AgentListParam;
 import com.zanxiang.game.module.manage.pojo.vo.AgentVO;
@@ -32,6 +33,12 @@ public class AgentController {
         return ResultVO.ok(agentService.listOfPage(dto));
     }
 
+    @PreAuthorize(permissionKey = "manage:agent:newWebUserActionSet")
+    @PostMapping("/newWebUserActionSet")
+    public ResultVO<Boolean> newWebUserActionSet(@RequestBody @Validated TencentNewWebUserActionSetDTO dto) {
+        return ResultVO.ok(agentService.newWebUserActionSet(dto));
+    }
+
     @PreAuthorize(permissionKey = "manage:agent:add")
     @PostMapping
     public ResultVO<Boolean> add(@Validated @RequestBody AgentAddParam dto) {

+ 18 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/TencentNewWebUserActionSetDTO.java

@@ -0,0 +1,18 @@
+package com.zanxiang.game.module.manage.pojo.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+@Data
+public class TencentNewWebUserActionSetDTO {
+
+    @NotNull(message = "参数错误!!!")
+    private Long adAccountId;
+
+    @NotBlank(message = "数据源名称不能为空")
+    private String name;
+
+    private String description;
+}

+ 3 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IAgentService.java

@@ -3,6 +3,7 @@ package com.zanxiang.game.module.manage.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
+import com.zanxiang.game.module.manage.pojo.dto.TencentNewWebUserActionSetDTO;
 import com.zanxiang.game.module.manage.pojo.params.AgentAddParam;
 import com.zanxiang.game.module.manage.pojo.params.AgentListParam;
 import com.zanxiang.game.module.manage.pojo.vo.AgentAccountChoiceVO;
@@ -92,4 +93,6 @@ public interface IAgentService extends IService<Agent> {
      * @return {@link AgentDTO}
      */
     AgentDTO getAgentById(long agentId);
+
+    Boolean newWebUserActionSet(TencentNewWebUserActionSetDTO dto);
 }

+ 18 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/AgentServiceImpl.java

@@ -7,9 +7,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.advertising.tencent.base.AdvertisingTencentServer;
+import com.zanxiang.advertising.tencent.base.pojo.dto.CreateUserActionSetV3RpcDTO;
 import com.zanxiang.advertising.tencent.base.pojo.vo.UserActionSetRpcVO;
 import com.zanxiang.advertising.tencent.base.rpc.IAdAccountRpc;
 import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
+import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetV3Rpc;
 import com.zanxiang.erp.base.ErpServer;
 import com.zanxiang.erp.base.pojo.vo.SysGameUserGroupRpcVO;
 import com.zanxiang.erp.base.rpc.ISysGameUserGroupRpc;
@@ -21,6 +23,7 @@ import com.zanxiang.game.back.base.rpc.IGameBackPolicyRpc;
 import com.zanxiang.game.module.base.pojo.enums.AccountTypeEnum;
 import com.zanxiang.game.module.base.pojo.enums.GameAuthEnum;
 import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
+import com.zanxiang.game.module.manage.pojo.dto.TencentNewWebUserActionSetDTO;
 import com.zanxiang.game.module.manage.pojo.params.AgentAddParam;
 import com.zanxiang.game.module.manage.pojo.params.AgentListParam;
 import com.zanxiang.game.module.manage.pojo.vo.AgentAccountChoiceVO;
@@ -70,6 +73,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
     @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
     private IUserActionSetRpc userActionSetRpc;
 
+    @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
+    private IUserActionSetV3Rpc userActionSetV3Rpc;
+
     @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
     private ISysUserRpc sysUserRpc;
 
@@ -107,6 +113,18 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
         return result;
     }
 
+    @Override
+    public Boolean newWebUserActionSet(TencentNewWebUserActionSetDTO dto) {
+        return userActionSetV3Rpc.create(CreateUserActionSetV3RpcDTO.builder()
+                        .accountId(dto.getAdAccountId())
+                        .type("WEB")
+                        .name(dto.getName())
+                        .description(dto.getDescription())
+                        .enableConversionClaim(true)
+                        .unique(true)
+                .build()).getData() != null;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean add(AgentAddParam dto) {

+ 1 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java

@@ -23,7 +23,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功 <解决token重复重现的问题> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <解决微信支付CP方金额精度不正确的问题> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 38 - 10
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/AgentServiceImpl.java

@@ -4,6 +4,11 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.sd4324530.jtuple.Tuple2;
+import com.zanxiang.game.back.base.ServerInfo;
+import com.zanxiang.game.back.base.pojo.dto.TencentAppApiUserAgentQueryRpcDTO;
+import com.zanxiang.game.back.base.rpc.ITencentAppApiBackRpc;
+import com.zanxiang.game.back.base.rpc.ITencentUserActionBackRpc;
 import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
 import com.zanxiang.game.module.mybatis.entity.*;
 import com.zanxiang.game.module.mybatis.mapper.AgentMapper;
@@ -13,6 +18,7 @@ import com.zanxiang.game.module.sdk.service.*;
 import com.zanxiang.module.util.DateUtil;
 import com.zanxiang.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -29,6 +35,9 @@ import java.util.*;
 @Service
 public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements IAgentService {
 
+    @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
+    private ITencentAppApiBackRpc tencentAppApiBackRpc;
+
     @Autowired
     private IUserService userService;
 
@@ -169,19 +178,12 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
             Agent agent = super.getOne(new LambdaQueryWrapper<Agent>().eq(Agent::getAgentKey, userData.getChannel()));
             return Tuples.of(agent == null ? 0 : agent.getId(), Collections.singletonMap("agentKey", userData.getChannel()), Strings.EMPTY);
         }
-        //不投放, 不回传, 只归因渠道, -- 不投放, 且回传只存在于导量情况, 导量无注册行为
-        if (Objects.equals(game.getIsPut(), Boolean.FALSE) && Objects.equals(gameExt.getAdCallBackSwitch(), Boolean.FALSE)) {
-            //查询访问记录
-            UserVisitLog userVisitLog = this.getUserVisitLog(userData);
-            //返回渠道信息
-            return Tuples.of(userVisitLog == null ? 0L : userVisitLog.getAgentId(), Collections.emptyMap(), Strings.EMPTY);
-        }
-        //投放, 且回传 -- 投放, 且不回传这种情况不存在
-        if (Objects.equals(game.getIsPut(), Boolean.TRUE) && Objects.equals(gameExt.getAdCallBackSwitch(), Boolean.TRUE)) {
+        //头条私域, 虚拟游戏方式
+        if (Objects.equals(game.getPutType(), 3)) {
             //查询访问记录
             UserVisitLog userVisitLog = this.getUserVisitLog(userData);
             if (userVisitLog == null) {
-                //未匹配到访问信息, 返回自然
+                //未匹配到访问信息, 返回自然量
                 return Tuples.of(0L, Collections.emptyMap(), Strings.EMPTY);
             }
             //解析访问记录中得请求参数
@@ -191,6 +193,32 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
             //返回渠道信息
             return Tuples.of(agent == null ? 0L : agent.getId(), urlParamMap, Strings.EMPTY);
         }
+        //腾讯私域, 直接加企微方式
+        if (Objects.equals(game.getPutType(), 4)) {
+            TencentAppApiUserAgentQueryRpcDTO tencentAppApiUserAgentQueryRpcDTO = TencentAppApiUserAgentQueryRpcDTO.builder()
+                    .gameId(game.getId())
+                    .regIp(userData.getIp())
+                    .registerTime(LocalDateTime.now())
+                    .imei(userData.getImei())
+                    .oaid(userData.getOaid())
+                    .androidId(userData.getAndroidId())
+                    .idfa(userData.getIdfa())
+                    .caid(userData.getCaid())
+                    .build();
+            Tuple2<String, Long> tuple2 = tencentAppApiBackRpc.queryUserAgentFromCallback(tencentAppApiUserAgentQueryRpcDTO).getData();
+            Map<String, String> map = new HashMap<>(2);
+            map.put("agentKey", tuple2.first);
+            map.put("callbackId", tuple2.second.toString());
+            Agent agent = super.getOne(new LambdaQueryWrapper<Agent>().eq(Agent::getAgentKey, tuple2.first));
+            return Tuples.of(agent == null ? 0 : agent.getId(), map, Strings.EMPTY);
+        }
+        //不投放, 不回传, 只归因渠道, -- 不投放, 且回传只存在于导量情况, 导量无注册行为
+        if (Objects.equals(game.getIsPut(), Boolean.FALSE) && Objects.equals(gameExt.getAdCallBackSwitch(), Boolean.FALSE)) {
+            //查询访问记录
+            UserVisitLog userVisitLog = this.getUserVisitLog(userData);
+            //返回渠道信息
+            return Tuples.of(userVisitLog == null ? 0L : userVisitLog.getAgentId(), Collections.emptyMap(), Strings.EMPTY);
+        }
         //默认返回自然量
         return Tuples.of(0L, Collections.emptyMap(), Strings.EMPTY);
     }

+ 86 - 4
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/CallBackServiceImpl.java

@@ -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();
+
+    }
 }

+ 3 - 5
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/util/WxPayUtil.java

@@ -64,11 +64,9 @@ public class WxPayUtil {
      * @return : 返回处理完的字符串
      */
     public static String subZeroAndDot(String s) {
-        if (s.indexOf(".") > 0) {
-            // 去掉多余的0
-            s = s.replaceAll("0+?$", "");
-            // 如最后一位是.则去掉
-            s = s.replaceAll("[.]$", "");
+        int dotIndex = s.indexOf(".");
+        if (dotIndex > 0) {
+            s = s.substring(0, dotIndex);
         }
         return s;
     }