瀏覽代碼

Merge branch 'package' of GameCenter/game-center into dev

zhimo 1 年之前
父節點
當前提交
4cfd0cd2f6

+ 5 - 0
game-module/game-module-manage/pom.xml

@@ -106,6 +106,11 @@
             <groupId>com.zanxiang.game</groupId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <artifactId>corp-base</artifactId>
+            <groupId>com.zanxiang.corp</groupId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
         <!-- swagger2 -->
         <dependency>
             <groupId>io.springfox</groupId>

+ 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服务启动成功 <dubbo升级3.0, 依赖修改1> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <dubbo升级3.0, 订单回传过滤> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 8 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IAgentService.java

@@ -36,4 +36,12 @@ public interface IAgentService extends IService<Agent> {
      * @return {@link Map}<{@link String}, {@link String}>
      */
     Map<String, String> channelTransform(String channel);
+
+    /**
+     * 查询用户渠道信息
+     *
+     * @param channel 通道
+     * @return {@link Agent}
+     */
+    Agent getAgentByChannel(String channel);
 }

+ 6 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/AgentServiceImpl.java

@@ -244,6 +244,12 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
         return paramMap;
     }
 
+    @Override
+    public Agent getAgentByChannel(String channel) {
+        Map<String, String> urlParamMap = this.channelTransform(channel);
+        return this.getAgentByKey(urlParamMap);
+    }
+
     private boolean isJsonStr(String str) {
         boolean result = false;
         try {

+ 8 - 5
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/CallBackServiceImpl.java

@@ -18,6 +18,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
 import java.util.Map;
 import java.util.Objects;
 
@@ -113,13 +114,14 @@ public class CallBackServiceImpl implements ICallBackService {
         if (!Objects.equals(gameExt.getAdCallBackSwitch(), Boolean.TRUE)) {
             return;
         }
-        //查询用户渠道信息
-        Agent agent = agentService.getById(platformOrderDTO.getAgentId());
+        //用户信息
+        User user = userService.getById(platformOrderDTO.getUserId());
+        //用户渠道信息
+        Agent agent = agentService.getAgentByChannel(user.getChannel());
         if (agent == null) {
             log.error("订单回传不存在渠道信息, orderId : {}", platformOrderDTO.getOrderId());
             return;
         }
-        User user = userService.getById(platformOrderDTO.getUserId());
         //查询小游戏信息或者H5游戏相关公众号信息
         GameApplet gameApplet = gameAppletService.getOne(new LambdaQueryWrapper<GameApplet>()
                 .eq(GameApplet::getGameId, user.getGameId()));
@@ -145,7 +147,7 @@ public class CallBackServiceImpl implements ICallBackService {
                 //判断游戏类型
                 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);
+                    TtOrderRpcDTO ttOrderRpcDTO = this.transform(platformOrderDTO, user.getOpenId(), agent, gameApplet, user.getCreateTime());
                     log.error("用户下单 --> 头条回传提交, orderReportRpcDTO : {}", JsonUtil.toString(ttOrderRpcDTO));
                     ttMiniGameBackRpc.orderReport(ttOrderRpcDTO);
                 }
@@ -207,7 +209,7 @@ public class CallBackServiceImpl implements ICallBackService {
                 .build();
     }
 
-    private TtOrderRpcDTO transform(PlatformOrderDTO platformOrderDTO, String openId, Agent agent, GameApplet gameApplet) {
+    private TtOrderRpcDTO transform(PlatformOrderDTO platformOrderDTO, String openId, Agent agent, GameApplet gameApplet, LocalDateTime regTime) {
         TtAccountRpcDTO ttAccountRpcDTO = TtAccountRpcDTO.builder()
                 .accountId(agent.getAccountId())
                 .reportToken(agent.getReportToken())
@@ -225,6 +227,7 @@ public class CallBackServiceImpl implements ICallBackService {
                 .orderStatus(platformOrderDTO.getStatus())
                 .createTime(platformOrderDTO.getCreateTime())
                 .payTime(platformOrderDTO.getPayTime())
+                .regTime(regTime)
                 .build();
     }
 }