浏览代码

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

wcc 1 年之前
父节点
当前提交
4aa5d0fca7

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -21,7 +21,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 依赖修改1> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 用户列表昵称改成角色名称> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 6 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserListVO.java

@@ -170,4 +170,10 @@ public class GameUserListVO {
     @ApiModelProperty(notes = "最近充值时间")
     private LocalDateTime lastRechargeTime;
 
+    /**
+     * 最新游戏角色名称
+     */
+    @ApiModelProperty(notes = "最新游戏角色名称")
+    private String lastGameRoleName;
+
 }

+ 6 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserListVO.java

@@ -182,4 +182,10 @@ public class UserListVO {
     @ApiModelProperty(notes = "玩家状态, -1 为冻结状态, 1 为试玩状态 2为正常状态")
     private Integer status;
 
+    /**
+     * 最新游戏角色名称
+     */
+    @ApiModelProperty(notes = "最新游戏角色名称")
+    private String lastGameRoleName;
+
 }

+ 11 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserWechatVO.java

@@ -0,0 +1,11 @@
+package com.zanxiang.game.module.manage.pojo.vo;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-07-26
+ * @description : 用户微信信息
+ */
+public class UserWechatVO {
+
+
+}

+ 10 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameUserRoleService.java

@@ -5,6 +5,7 @@ import com.zanxiang.game.module.manage.pojo.dto.GameUserRoleDTO;
 import com.zanxiang.game.module.manage.pojo.params.GameUserRoleListParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleListVO;
 import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleVO;
+import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 
 import java.util.List;
 
@@ -15,6 +16,15 @@ import java.util.List;
  */
 public interface IGameUserRoleService {
 
+    /**
+     * 获取用户最近的游戏角色
+     *
+     * @param userId 用户id
+     * @param gameId 游戏id
+     * @return {@link GameUserRole}
+     */
+    GameUserRole getLastGameUserRoleName(Long userId, Long gameId);
+
     /**
      * 根据角色id查询
      *

+ 9 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserRoleServiceImpl.java

@@ -53,6 +53,15 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
     @Autowired
     private IAgentService agentService;
 
+    @Override
+    public GameUserRole getLastGameUserRoleName(Long userId, Long gameId) {
+        return super.getOne(new LambdaQueryWrapper<GameUserRole>()
+                .eq(GameUserRole::getUserId, userId)
+                .eq(GameUserRole::getGameId, gameId)
+                .orderByDesc(GameUserRole::getUpdateTime)
+                .last("limit 1"));
+    }
+
     @Override
     public GameUserRoleDTO getByRoleId(String roleId) {
         GameUserRole gameUserRole = super.getOne(new LambdaQueryWrapper<GameUserRole>().eq(GameUserRole::getRoleId, roleId));

+ 8 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserServiceImpl.java

@@ -16,6 +16,7 @@ import com.zanxiang.game.module.manage.pojo.vo.GameUserVO;
 import com.zanxiang.game.module.manage.service.*;
 import com.zanxiang.game.module.mybatis.entity.Agent;
 import com.zanxiang.game.module.mybatis.entity.GameUser;
+import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 import com.zanxiang.game.module.mybatis.mapper.GameUserMapper;
 import com.zanxiang.module.util.bean.BeanUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -53,6 +54,9 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
     @Autowired
     private IAgentService agentService;
 
+    @Autowired
+    private IGameUserRoleService gameUserRoleService;
+
     @Override
     public IPage<GameUserListVO> gameUserList(GameUserListParam param) {
         //游戏条件处理
@@ -131,6 +135,10 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
             gameUserListVO.setCpName(cpMap.get(gameDTO.getCpId()) == null ? null : cpMap.get(gameDTO.getCpId()).getCpName());
             gameUserListVO.setGameCategoryName(GameCategoryEnum.getNameByCategory(gameDTO.getCategory()));
         }
+        //最近角色
+        GameUserRole gameUserRole = gameUserRoleService.getLastGameUserRoleName(gameUser.getUserId(), gameUser.getGameId());
+        gameUserListVO.setLastGameRoleName(gameUserRole == null ? null : gameUserRole.getRoleName());
+        //返回
         return gameUserListVO;
     }
 

+ 8 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/UserServiceImpl.java

@@ -19,6 +19,7 @@ import com.zanxiang.game.module.manage.pojo.vo.UserListVO;
 import com.zanxiang.game.module.manage.pojo.vo.UserVO;
 import com.zanxiang.game.module.manage.service.*;
 import com.zanxiang.game.module.mybatis.entity.Agent;
+import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 import com.zanxiang.game.module.mybatis.entity.User;
 import com.zanxiang.game.module.mybatis.mapper.UserMapper;
 import com.zanxiang.module.util.bean.BeanUtil;
@@ -61,6 +62,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Autowired
     private IAgentService agentService;
 
+    @Autowired
+    private IGameUserRoleService gameUserRoleService;
+
     @Override
     public IPage<UserListVO> list(UserListParam param) {
         //游戏条件处理
@@ -131,6 +135,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             userListVO.setCpId(gameDTO.getCpId());
             userListVO.setCpName(cpMap.get(gameDTO.getCpId()) == null ? null : cpMap.get(gameDTO.getCpId()).getCpName());
         }
+        //最近角色
+        GameUserRole gameUserRole = gameUserRoleService.getLastGameUserRoleName(user.getId(), user.getGameId());
+        userListVO.setLastGameRoleName(gameUserRole == null ? null : gameUserRole.getRoleName());
+        //返回
         return userListVO;
     }
 

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