Browse Source

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

zhimo 1 year ago
parent
commit
21db202fec
18 changed files with 87 additions and 27 deletions
  1. 16 0
      game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/util/DateUtils.java
  2. 1 1
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java
  3. 6 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserListVO.java
  4. 3 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/AgentServiceImpl.java
  5. 3 4
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserRoleServiceImpl.java
  6. 3 4
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserServiceImpl.java
  7. 3 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/OrderServiceImpl.java
  8. 2 4
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/UserServiceImpl.java
  9. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAppletShell.java
  10. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUser.java
  11. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUserRole.java
  12. 6 1
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/UserCard.java
  13. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java
  14. 8 4
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/result/CardCheckResult.java
  15. 5 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletShellServiceImpl.java
  16. 2 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserRoleServiceImpl.java
  17. 1 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserServiceImpl.java
  18. 12 8
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/UserCardServiceImpl.java

+ 16 - 0
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/util/DateUtils.java

@@ -2,6 +2,7 @@ package com.zanxiang.game.module.base.util;
 
 import com.zanxiang.module.util.DateUtil;
 
+import java.time.Duration;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
@@ -53,4 +54,19 @@ public class DateUtils extends DateUtil {
         LocalDateTime weekEnd = now.plusDays(7 - dayOfWeek).with(LocalTime.MAX);
         return time.isAfter(weekStart) && time.isBefore(weekEnd);
     }
+
+    /**
+     * 注册支付时间差异
+     *
+     * @param regTime 注册时间
+     * @param payTime 支付时间
+     * @return {@link Long}
+     */
+    public static Long getRegPayTimeDiff(LocalDateTime regTime, LocalDateTime payTime) {
+        if (payTime == null || regTime == null) {
+            return null;
+        }
+        // 间隔秒数
+        return Duration.between(regTime, payTime).getSeconds();
+    }
 }

+ 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, 角色列表区服搜索模糊匹配> ( ´・・)ノ(._.`) \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

@@ -182,4 +182,10 @@ public class GameUserListVO {
     @ApiModelProperty(notes = "注册充值时间差")
     private Long regPayTimeDiff;
 
+    /**
+     * 用户注册时间
+     */
+    @ApiModelProperty(notes = "用户注册时间")
+    private LocalDateTime regTime;
+
 }

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

@@ -293,6 +293,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 
     @Override
     public Map<String, String> channelTransform(String channel) {
+        if (Strings.isBlank(channel) || Strings.isBlank(channel.trim())) {
+            return Collections.emptyMap();
+        }
         //判断是否是json, 是就直接转成map
         if (this.isJsonStr(channel)) {
             return JsonUtil.toMap(channel, Map.class, String.class);

+ 3 - 4
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserRoleServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
+import com.zanxiang.game.module.base.util.DateUtils;
 import com.zanxiang.game.module.manage.pojo.dto.*;
 import com.zanxiang.game.module.manage.pojo.params.GameUserRoleListParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleListVO;
@@ -23,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import reactor.util.function.Tuple2;
 
-import java.time.Duration;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.*;
@@ -163,9 +163,6 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
             gameUserRoleListVO.setRegIp(userDTO.getIp());
             gameUserRoleListVO.setRegTime(userDTO.getCreateTime());
             gameUserRoleListVO.setAgentId(userDTO.getAgentId());
-            if (gameUserRoleListVO.getLastRechargeTime() != null) {
-                gameUserRoleListVO.setRegPayTimeDiff(Duration.between(userDTO.getCreateTime(), gameUserRoleListVO.getLastRechargeTime()).getSeconds());
-            }
             AgentDTO agentDTO = agentMap.get(userDTO.getAgentId());
             if (agentDTO != null) {
                 gameUserRoleListVO.setAgentName(agentDTO.getAgentName());
@@ -189,6 +186,8 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
             gameUserRoleListVO.setGameCategoryId(gameDTO.getCategory());
             gameUserRoleListVO.setGameCategoryName(GameCategoryEnum.getNameByCategory(gameDTO.getCategory()));
         }
+        //注册充值时间差
+        gameUserRoleListVO.setRegPayTimeDiff(DateUtils.getRegPayTimeDiff(gameUserRoleListVO.getRegTime(), gameUserRoleListVO.getLastRechargeTime()));
         return gameUserRoleListVO;
     }
 }

+ 3 - 4
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
+import com.zanxiang.game.module.base.util.DateUtils;
 import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
 import com.zanxiang.game.module.manage.pojo.dto.CpDTO;
 import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
@@ -24,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import reactor.util.function.Tuple2;
 
-import java.time.Duration;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.List;
@@ -111,9 +111,6 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
         if (userDTO != null) {
             gameUserListVO.setNickname(userDTO.getNickname());
             gameUserListVO.setUsername(userDTO.getUsername());
-            if (gameUserListVO.getLastRechargeTime() != null) {
-                gameUserListVO.setRegPayTimeDiff(Duration.between(userDTO.getCreateTime(), gameUserListVO.getLastRechargeTime()).getSeconds());
-            }
             //用户渠道
             AgentDTO agentDTO = agentMap.get(userDTO.getAgentId());
             if (agentDTO != null) {
@@ -142,6 +139,8 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
         //最近角色
         GameUserRole gameUserRole = gameUserRoleService.getLastGameUserRoleName(gameUser.getUserId(), gameUser.getGameId());
         gameUserListVO.setLastGameRoleName(gameUserRole == null ? null : gameUserRole.getRoleName());
+        //注册充值时间差
+        gameUserListVO.setRegPayTimeDiff(DateUtils.getRegPayTimeDiff(gameUserListVO.getRegTime(), gameUserListVO.getLastRechargeTime()));
         //返回
         return gameUserListVO;
     }

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

@@ -10,6 +10,7 @@ import com.zanxiang.erp.security.util.SecurityUtil;
 import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
 import com.zanxiang.game.module.base.pojo.enums.PayDeviceEnum;
 import com.zanxiang.game.module.base.pojo.enums.PayWayEnum;
+import com.zanxiang.game.module.base.util.DateUtils;
 import com.zanxiang.game.module.manage.pojo.dto.*;
 import com.zanxiang.game.module.manage.pojo.params.OrderParam;
 import com.zanxiang.game.module.manage.pojo.params.UserOrderListParam;
@@ -196,6 +197,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         //支付渠道, 场景
         orderVO.setPayWayName(PayWayEnum.getNameByPayWayId(orderVO.getPayWayId()));
         orderVO.setPayDeviceName(PayDeviceEnum.getByPayWayId(orderVO.getPayDeviceId()));
+        //注册充值时间差
+        orderVO.setRegPayTimeDiff(DateUtils.getRegPayTimeDiff(orderVO.getRegTime(), orderVO.getPayTime()));
     }
 
     private LambdaQueryWrapper<Order> getListWrapper(OrderParam param, List<Long> agentIdList, List<Long> userIdList, String select) {

+ 2 - 4
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/UserServiceImpl.java

@@ -11,6 +11,7 @@ import com.zanxiang.corp.base.CorpServer;
 import com.zanxiang.corp.base.pojo.dto.CorpExternalUserDTO;
 import com.zanxiang.corp.base.rpc.ICorpExternalUserServiceRpc;
 import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
+import com.zanxiang.game.module.base.util.DateUtils;
 import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
 import com.zanxiang.game.module.manage.pojo.dto.CpDTO;
 import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
@@ -37,7 +38,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import reactor.util.function.Tuple2;
 
-import java.time.Duration;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
@@ -166,9 +166,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         GameUserRole gameUserRole = gameUserRoleService.getLastGameUserRoleName(user.getId(), user.getGameId());
         userListVO.setLastGameRoleName(gameUserRole == null ? null : gameUserRole.getRoleName());
         //注册充值时间差
-        if (userListVO.getLastRechargeTime() != null) {
-            userListVO.setRegPayTimeDiff(Duration.between(userListVO.getCreateTime(), userListVO.getLastRechargeTime()).getSeconds());
-        }
+        userListVO.setRegPayTimeDiff(DateUtils.getRegPayTimeDiff(userListVO.getCreateTime(), userListVO.getLastRechargeTime()));
         //返回
         return userListVO;
     }

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAppletShell.java

@@ -94,4 +94,9 @@ public class GameAppletShell implements Serializable {
      */
     private LocalDateTime updateTime;
 
+    /**
+     * 测试版本
+     */
+    private String testVersion;
+
 }

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUser.java

@@ -65,6 +65,11 @@ public class GameUser implements Serializable {
      */
     private Integer roleCount;
 
+    /**
+     * 用户注册时间
+     */
+    private LocalDateTime regTime;
+
     /**
      * 开始玩时间
      */

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUserRole.java

@@ -110,6 +110,11 @@ public class GameUserRole implements Serializable {
      */
     private LocalDateTime lastLoginTime;
 
+    /**
+     * 用户注册时间
+     */
+    private LocalDateTime regTime;
+
     /**
      * 创建时间
      */

+ 6 - 1
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/UserCard.java

@@ -85,6 +85,11 @@ public class UserCard implements Serializable {
      */
     private LocalDateTime updateTime;
 
+    /**
+     * 身份证地址
+     */
+    private String address;
+
     /**
      * 获取展示身份证号
      *
@@ -94,7 +99,7 @@ public class UserCard implements Serializable {
         if (Strings.isBlank(this.cardId)) {
             return null;
         }
-        return this.cardId.substring(0, 3) + " *** " + this.cardId.substring(this.cardId.length() - 3);
+        return this.cardId.substring(0, 3) + " *** " + this.cardId.substring(this.cardId.length() - 1);
     }
 
     /**

+ 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, 问题修正2> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <dubbo升级3.0, 一大波修改上线> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 8 - 4
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/result/CardCheckResult.java

@@ -1,6 +1,7 @@
 package com.zanxiang.game.module.sdk.pojo.result;
 
 import lombok.Data;
+import org.apache.logging.log4j.util.Strings;
 
 import java.util.Objects;
 
@@ -71,20 +72,23 @@ public class CardCheckResult {
         private String address;
     }
 
-    public boolean isSuccess() {
+    public Boolean isSuccess() {
         return Objects.equals(this.code, "0000");
     }
 
-    public boolean isPast() {
+    public Boolean isPast() {
         return Objects.equals(this.data, "一致");
     }
 
-    public boolean isFail() {
+    public Boolean isFail() {
         return !Objects.equals(this.code, "0");
     }
 
-    public boolean past() {
+    public Boolean past() {
         return this.result != null && Objects.equals(this.result.getRes(), "1");
     }
 
+    public String getAddress() {
+        return this.result == null ? Strings.EMPTY : this.result.getAddress();
+    }
 }

+ 5 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletShellServiceImpl.java

@@ -67,6 +67,11 @@ public class GameAppletShellServiceImpl extends ServiceImpl<GameAppletShellMappe
             //返回关闭
             return ShellSwitchEnum.SHELL_SWITCH_CLOSE.getShellSwitch();
         }
+        //测试版本, 关闭壳包, 提审前版本测试
+        if (Objects.equals(gameAppletShell.getTestVersion(), version)) {
+            return ShellSwitchEnum.SHELL_SWITCH_CLOSE.getShellSwitch();
+        }
+        //兜底逻辑,  找不到版本号直接返回进入壳包
         log.error("版本信息不存在, 默认进壳包, appId : {}, version : {}", appId, version);
         return ShellSwitchEnum.SHELL_SWITCH_OPEN.getShellSwitch();
     }

+ 2 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserRoleServiceImpl.java

@@ -119,6 +119,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
             distributedLockComponent.unlock(RedisKeyConstant.ROLE_UPDATE_KEY + "_" + userData.getUserId());
             return;
         }
+        User user = userService.getById(userData.getUserId());
         userRole = GameUserRole.builder()
                 .userId(userData.getUserId())
                 .gameUserId(gameUser.getId())
@@ -131,6 +132,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
                 .roleVipLevel(param.getRoleVipLevel())
                 .rolePower(param.getRolePower())
                 .os(userData.getDeviceSystem())
+                .regTime(user == null ? null : user.getCreateTime())
                 .createTime(param.getRoleGradeUpdateTime() == null || param.getRoleGradeUpdateTime() <= 0 ? LocalDateTime.now() : DateUtil.secondToLocalDateTime(param.getRoleGradeUpdateTime()))
                 .updateTime(LocalDateTime.now())
                 .lastLoginTime(LocalDateTime.now())

+ 1 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserServiceImpl.java

@@ -33,6 +33,7 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
                 .userId(user.getId())
                 .gameId(user.getGameId())
                 .nickname(user.getNickname())
+                .regTime(user.getCreateTime())
                 .createTime(LocalDateTime.now())
                 .updateTime(LocalDateTime.now())
                 .build());

+ 12 - 8
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/UserCardServiceImpl.java

@@ -17,6 +17,7 @@ import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import com.zanxiang.module.util.pojo.ResultVO;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -28,6 +29,8 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
+import reactor.util.function.Tuple2;
+import reactor.util.function.Tuples;
 
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -85,14 +88,14 @@ public class UserCardServiceImpl extends ServiceImpl<UserCardMapper, UserCard> i
             return ResultVO.fail(HttpStatusEnum.CARD_ID_ERROR.getMsg());
         }
         //阿里实名认证
-        boolean authenticationCheck;
+        Tuple2<Boolean, String> tuple2;
         if (this.serverUrl.contains("test")) {
-            authenticationCheck = this.authenticationCheck(cardName, cardId);
+            tuple2 = this.authenticationCheck(cardName, cardId);
         } else {
-            authenticationCheck = this.userCardCheck(cardName, cardId);
+            tuple2 = this.userCardCheck(cardName, cardId);
         }
         //实名认证失败
-        if (!authenticationCheck) {
+        if (!tuple2.getT1()) {
             return ResultVO.fail(HttpStatusEnum.AUTHENTICATION_FAIL.getMsg());
         }
         //新建记录
@@ -108,6 +111,7 @@ public class UserCardServiceImpl extends ServiceImpl<UserCardMapper, UserCard> i
                 .cardType(1)
                 .createTime(LocalDateTime.now())
                 .updateTime(LocalDateTime.now())
+                .address(Strings.isBlank(tuple2.getT2()) ? null : tuple2.getT2())
                 .build());
         //更新用户信息
         userService.update(new LambdaUpdateWrapper<User>()
@@ -172,7 +176,7 @@ public class UserCardServiceImpl extends ServiceImpl<UserCardMapper, UserCard> i
         return sex;
     }
 
-    private boolean authenticationCheck(String cardName, String cardId) {
+    private Tuple2<Boolean, String> authenticationCheck(String cardName, String cardId) {
         String host = "https://dskj.market.alicloudapi.com/platform/check/verified";
         String appCode = "f395b1587fc04a49a975f908660fb1e9";
         String url = host + "?certCode=" + cardId + "&realName=" + cardName;
@@ -192,10 +196,10 @@ public class UserCardServiceImpl extends ServiceImpl<UserCardMapper, UserCard> i
             log.error("请求阿里实名认证接口返回值为空(OLD), cardName : {}, cardId : {}, result : {}", cardName, cardId, JsonUtil.toString(result));
             throw new BaseException("实名认证失败");
         }
-        return result.isPast();
+        return Tuples.of(result.isPast(), Strings.EMPTY);
     }
 
-    private boolean userCardCheck(String cardName, String cardId) {
+    private Tuple2<Boolean, String> userCardCheck(String cardName, String cardId) {
         String url = "https://eid.shumaidata.com/eid/check";
         String appCode = "f395b1587fc04a49a975f908660fb1e9";
         //请求头
@@ -219,6 +223,6 @@ public class UserCardServiceImpl extends ServiceImpl<UserCardMapper, UserCard> i
             throw new BaseException("实名认证失败");
         }
         log.error("实名认证结果, result : {}", JsonUtil.toString(result));
-        return result.past();
+        return Tuples.of(result.past(), result.getAddress());
     }
 }