소스 검색

fix : 用户渠道修改, 提交一大波代码

bilingfeng 1 년 전
부모
커밋
abcba0a854
32개의 변경된 파일723개의 추가작업 그리고 574개의 파일을 삭제
  1. 46 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/AgentDTO.java
  2. 0 38
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/AgentListDTO.java
  3. 32 42
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/UserDTO.java
  4. 55 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/AgentAddParam.java
  5. 71 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/AgentListParam.java
  6. 0 6
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/UserListParam.java
  7. 20 4
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/AgentVO.java
  8. 4 28
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserListVO.java
  9. 1 1
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserRoleListVO.java
  10. 1 1
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserRoleVO.java
  11. 5 14
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/OrderVO.java
  12. 18 48
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserListVO.java
  13. 3 3
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserVO.java
  14. 40 3
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IAgentService.java
  15. 1 2
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IUserService.java
  16. 63 41
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/AgentServiceImpl.java
  17. 22 12
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserRoleServiceImpl.java
  18. 30 35
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserServiceImpl.java
  19. 27 40
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/OrderServiceImpl.java
  20. 39 52
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/UserServiceImpl.java
  21. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUserRole.java
  22. 25 45
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/User.java
  23. 0 6
      game-module/game-module-sdk/pom.xml
  24. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/listener/OrderPaySuccessListener.java
  25. 67 26
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/dto/UserDTO.java
  26. 18 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IAgentService.java
  27. 13 16
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/ICallBackService.java
  28. 21 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/AgentServiceImpl.java
  29. 81 98
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/CallBackServiceImpl.java
  30. 1 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserRoleServiceImpl.java
  31. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserServiceImpl.java
  32. 12 11
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java

+ 46 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/AgentDTO.java

@@ -2,35 +2,81 @@ package com.zanxiang.game.module.manage.pojo.dto;
 
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
+/**
+ * @author wcc
+ */
 @Data
 public class AgentDTO {
 
+    /**
+     * 主键id
+     */
+    private Long id;
+
     /**
      * 渠道名称
      */
     private String agentName;
+
+    /**
+     * 渠道唯一标识
+     */
+    private String agentKey;
+
     /**
      * 推广账号类型(1:腾讯、2:头条)
      */
     private Integer accountType;
+
     /**
      * 账号类型
      */
     private Long accountId;
+
     /**
      * 游戏id
      */
     private Long gameId;
+
     /**
      * 腾讯用户行为数据源 id
      */
     private Long userActionSetId;
+
     /**
      * 回传策略 id
      */
     private Long backPolicyId;
+
     /**
      * 投放状态
      */
     private Integer putStatus;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建归属人id
+     */
+    private Long createBy;
+
+    /**
+     * 创建归属人名称
+     */
+    private String createByName;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 更新者
+     */
+    private Long updateBy;
 }

+ 0 - 38
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/AgentListDTO.java

@@ -1,38 +0,0 @@
-package com.zanxiang.game.module.manage.pojo.dto;
-
-import com.zanxiang.game.module.mybatis.entity.Agent;
-import com.zanxiang.module.web.pojo.BaseListDTO;
-import lombok.Data;
-
-import java.time.LocalDate;
-
-@Data
-public class AgentListDTO extends BaseListDTO<Agent> {
-
-
-    private String agentName;
-
-    private Integer accountType;
-
-    private Long accountId;
-    /**
-     * 游戏id
-     */
-    private Long gameId;
-    /**
-     * 回传策略 id
-     */
-    private Long backPolicyId;
-    /**
-     * 投放状态
-     */
-    private Integer putStatus;
-    /**
-     * 投手
-     */
-    private Long putUserId;
-
-    private LocalDate createBeginTime;
-
-    private LocalDate createEndTime;
-}

+ 32 - 42
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/UserDTO.java

@@ -19,9 +19,14 @@ public class UserDTO {
     private Long id;
 
     /**
-     * 所属渠道ID
+     * 注册渠道id
      */
-    private Long agentId;
+    private Long regAgentId;
+
+    /**
+     * 最新渠道id
+     */
+    private Long lastAgentId;
 
     /**
      * 注册游戏id
@@ -43,28 +48,23 @@ public class UserDTO {
      */
     private String password;
 
-    /**
-     * 绑定邮箱
-     */
-    private String email;
-
     /**
      * 绑定手机号码
      */
     private String mobile;
 
     /**
-     * 绑定支付宝账号
+     * 微信用户openId
      */
-    private String aliPay;
+    private String openId;
 
     /**
-     * 客户端类型, 1 : 安卓app
+     * 微信用户会话密钥
      */
-    private Integer deviceType;
+    private String sessionKey;
 
     /**
-     * 用户状态, -1 : 为冻结状态, 0 : 为正常状态
+     * 状态, 0 正常 1 封禁
      */
     private Integer status;
 
@@ -73,6 +73,16 @@ public class UserDTO {
      */
     private String avatar;
 
+    /**
+     * 绑定支付宝账号
+     */
+    private String aliPay;
+
+    /**
+     * 绑定邮箱
+     */
+    private String email;
+
     /**
      * 充值次数
      */
@@ -88,50 +98,30 @@ public class UserDTO {
      */
     private LocalDateTime lastRechargeTime;
 
-    /**
-     * 平台币余额
-     */
-    private BigDecimal platformCoin;
-
     /**
      * 创角数
      */
     private Integer roleCount;
 
-    /**
-     * 是否GS
-     */
-    private Boolean isGs;
-
-    /**
-     * 客服id
-     */
-    private Long customerId;
-
-    /**
-     * 拥有角色最高vip等级
-     */
-    private Integer vipMax;
-
     /**
      * 是否实名认证,0未实名认证,1成年人,2未成年人
      */
     private Integer authentication;
 
     /**
-     * 注册时间
+     * 客户端类型, 1:安卓app, 2: 苹果iosApp, 3: h5网页, 4 : 小程序(小游戏)
      */
-    private LocalDateTime createTime;
+    private Integer deviceType;
 
     /**
-     * 更改时间
+     * 客户端操作系统, android, ios, windows, mac
      */
-    private LocalDateTime updateTime;
+    private String deviceSystem;
 
     /**
-     * 客户端操作系统, android, ios, windows, mac
+     * 用户注册ip
      */
-    private String deviceSystem;
+    private String ip;
 
     /**
      * 用户设备mac地址
@@ -149,12 +139,12 @@ public class UserDTO {
     private String androidId;
 
     /**
-     * 用户注册ip
+     * 注册时间
      */
-    private String ip;
+    private LocalDateTime createTime;
 
     /**
-     * 广告id
+     * 更改时间
      */
-    private String adId;
+    private LocalDateTime updateTime;
 }

+ 55 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/AgentAddParam.java

@@ -0,0 +1,55 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-06-09
+ * @description : 添加渠道
+ */
+@Data
+public class AgentAddParam {
+
+    /**
+     * 渠道名称
+     */
+    @ApiModelProperty(notes = "渠道名称")
+    private String agentName;
+
+    /**
+     * 推广账号类型(1:腾讯、2:头条)
+     */
+    @ApiModelProperty(notes = "推广账号类型(1:腾讯、2:头条)")
+    private Integer accountType;
+
+    /**
+     * 账号类型
+     */
+    @ApiModelProperty(notes = "账号类型")
+    private Long accountId;
+
+    /**
+     * 游戏id
+     */
+    @ApiModelProperty(notes = "游戏id")
+    private Long gameId;
+
+    /**
+     * 腾讯用户行为数据源 id
+     */
+    @ApiModelProperty(notes = "腾讯用户行为数据源 id")
+    private Long userActionSetId;
+
+    /**
+     * 回传策略 id
+     */
+    @ApiModelProperty(notes = "回传策略 id")
+    private Long backPolicyId;
+
+    /**
+     * 投放状态
+     */
+    @ApiModelProperty(notes = "投放状态")
+    private Integer putStatus;
+}

+ 71 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/AgentListParam.java

@@ -0,0 +1,71 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import com.zanxiang.game.module.mybatis.entity.Agent;
+import com.zanxiang.module.web.pojo.BaseListDTO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-06-09
+ * @description : 渠道列表查询
+ */
+@Data
+public class AgentListParam extends BaseListDTO<Agent> {
+
+    /**
+     * 渠道名称
+     */
+    @ApiModelProperty(notes = "渠道名称")
+    private String agentName;
+
+    /**
+     * 账号类型
+     */
+    @ApiModelProperty(notes = "账号类型")
+    private Integer accountType;
+
+    /**
+     * 账号id
+     */
+    @ApiModelProperty(notes = "账号id")
+    private Long accountId;
+
+    /**
+     * 游戏id
+     */
+    @ApiModelProperty(notes = "游戏id")
+    private Long gameId;
+
+    /**
+     * 回传策略 id
+     */
+    @ApiModelProperty(notes = "回传策略 id")
+    private Long backPolicyId;
+
+    /**
+     * 投放状态
+     */
+    @ApiModelProperty(notes = "投放状态")
+    private Integer putStatus;
+
+    /**
+     * 投手
+     */
+    @ApiModelProperty(notes = "投手")
+    private Long putUserId;
+
+    /**
+     * 创建开始时间
+     */
+    @ApiModelProperty(notes = "创建开始时间")
+    private LocalDate createBeginTime;
+
+    /**
+     * 创建结束时间
+     */
+    @ApiModelProperty(notes = "创建结束时间")
+    private LocalDate createEndTime;
+}

+ 0 - 6
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/UserListParam.java

@@ -147,12 +147,6 @@ public class UserListParam extends BaseListDTO<User> {
     @ApiModelProperty(notes = "归因广告id")
     private String adId;
 
-    /**
-     * 是否GS
-     */
-    @ApiModelProperty(notes = "是否GS")
-    private Boolean isGs;
-
     /**
      * 是否切量
      */

+ 20 - 4
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/AgentVO.java

@@ -1,8 +1,6 @@
 package com.zanxiang.game.module.manage.pojo.vo;
 
-import com.zanxiang.advertising.tencent.base.pojo.vo.AdAccountRpcVO;
 import com.zanxiang.advertising.tencent.base.pojo.vo.UserActionSetRpcVO;
-import com.zanxiang.erp.base.pojo.vo.SysUserRpcVO;
 import lombok.Data;
 
 import java.time.LocalDateTime;
@@ -10,6 +8,9 @@ import java.time.LocalDateTime;
 @Data
 public class AgentVO {
 
+    /**
+     * 主键
+     */
     private Long id;
     /**
      * 渠道名称
@@ -36,13 +37,28 @@ public class AgentVO {
      */
     private Long userActionSetId;
 
+    /**
+     * 创建时间
+     */
     private LocalDateTime createTime;
 
+    /**
+     * 归属投手id
+     */
     private Long createBy;
 
+    /**
+     * 归属投手名称
+     */
+    private String createByName;
+
+    /**
+     * 游戏信息
+     */
     private GameInfoVO gameInfo;
 
+    /**
+     * 数据源信息
+     */
     private UserActionSetRpcVO userActionSet;
-
-    private SysUserRpcVO userInfo;
 }

+ 4 - 28
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserListVO.java

@@ -39,16 +39,16 @@ public class GameUserListVO {
     private String nickname;
 
     /**
-     * 注册渠道id
+     * 归属渠道id
      */
     @ApiModelProperty(notes = "注册渠道id")
     private Long agentId;
 
     /**
-     * 注册渠道名称
+     * 归属渠道名称
      */
     @ApiModelProperty(notes = "注册渠道名称")
-    private String channel;
+    private String agentName;
 
     /**
      * cp标识id
@@ -90,7 +90,7 @@ public class GameUserListVO {
      * 归因投放人员id
      */
     @ApiModelProperty(notes = "归因投放人员id")
-    private String pitcherId;
+    private Long pitcherId;
 
     /**
      * 归因投放人员名字
@@ -104,30 +104,6 @@ public class GameUserListVO {
     @ApiModelProperty(notes = "归因推广账号id")
     private Long accountId;
 
-    /**
-     * 归因推广账号
-     */
-    @ApiModelProperty(notes = "归因推广账号")
-    private String accountName;
-
-    /**
-     * 归因媒体id
-     */
-    @ApiModelProperty(notes = "归因媒体id")
-    private Long mediaId;
-
-    /**
-     * 归因媒体名称
-     */
-    @ApiModelProperty(notes = "归因媒体名称")
-    private String mediaName;
-
-    /**
-     * 归因广告id
-     */
-    @ApiModelProperty(notes = "归因广告id")
-    private String adId;
-
     /**
      * 充值金额
      */

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserRoleListVO.java

@@ -62,7 +62,7 @@ public class GameUserRoleListVO {
      * 注册渠道名称
      */
     @ApiModelProperty(notes = "注册渠道名称")
-    private String channel;
+    private String agentName;
 
     /**
      * cp标识id

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserRoleVO.java

@@ -48,7 +48,7 @@ public class GameUserRoleVO {
      * 渠道名称
      */
     @ApiModelProperty(notes = "渠道名称")
-    private String channelName;
+    private String agentName;
 
     /**
      * 所在服务器名称

+ 5 - 14
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/OrderVO.java

@@ -43,13 +43,13 @@ public class OrderVO {
     private Long agentId;
 
     @ApiModelProperty(notes = "充值渠道名称")
-    private String channel;
+    private String agentName;
 
     @ApiModelProperty(notes = "注册渠道id")
     private Long regAgentId;
 
     @ApiModelProperty(notes = "注册渠道名称")
-    private String regChannel;
+    private String regAgentName;
 
     @ApiModelProperty(notes = "注册游戏id")
     private Long regGameId;
@@ -70,7 +70,7 @@ public class OrderVO {
     private String regGameCategoryName;
 
     @ApiModelProperty(notes = "归因投放人员id")
-    private String pitcherId;
+    private Long pitcherId;
 
     @ApiModelProperty(notes = "归因投放人员名字")
     private String pitcherName;
@@ -78,17 +78,8 @@ public class OrderVO {
     @ApiModelProperty(notes = "归因推广账号id")
     private Long accountId;
 
-    @ApiModelProperty(notes = "归因推广账号")
-    private String accountName;
-
-    @ApiModelProperty(notes = "归因媒体id")
-    private Long mediaId;
-
-    @ApiModelProperty(notes = "归因媒体名称")
-    private String mediaName;
-
-    @ApiModelProperty(notes = "归因广告id")
-    private String adId;
+    @ApiModelProperty(notes = "推广账号类型(1:腾讯、2:头条)")
+    private Integer accountType;
 
     @ApiModelProperty(notes = "充值游戏id")
     private Long gameId;

+ 18 - 48
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserListVO.java

@@ -54,13 +54,25 @@ public class UserListVO {
      * 注册渠道id
      */
     @ApiModelProperty(notes = "注册渠道id")
-    private Long agentId;
+    private Long regAgentId;
 
     /**
      * 注册渠道名称
      */
     @ApiModelProperty(notes = "注册渠道名称")
-    private String channel;
+    private String regAgentName;
+
+    /**
+     * 渠道id
+     */
+    @ApiModelProperty(notes = "渠道id")
+    private Long agentId;
+
+    /**
+     * 渠道名称
+     */
+    @ApiModelProperty(notes = "渠道名称")
+    private String agentName;
 
     /**
      * cpId
@@ -102,7 +114,7 @@ public class UserListVO {
      * 归因投放人员id
      */
     @ApiModelProperty(notes = "归因投放人员id")
-    private String pitcherId;
+    private Long pitcherId;
 
     /**
      * 归因投放人员名字
@@ -117,28 +129,10 @@ public class UserListVO {
     private Long accountId;
 
     /**
-     * 归因推广账号
+     * 归因推广账号类型(1:腾讯、2:头条)
      */
-    @ApiModelProperty(notes = "归因推广账号")
-    private String accountName;
-
-    /**
-     * 归因媒体id
-     */
-    @ApiModelProperty(notes = "归因媒体id")
-    private Long mediaId;
-
-    /**
-     * 归因媒体名称
-     */
-    @ApiModelProperty(notes = "归因媒体名称")
-    private String mediaName;
-
-    /**
-     * 归因广告id
-     */
-    @ApiModelProperty(notes = "归因广告id")
-    private String adId;
+    @ApiModelProperty(notes = "归因推广账号类型(1:腾讯、2:头条)")
+    private Integer accountType;
 
     /**
      * 真实姓名
@@ -170,12 +164,6 @@ public class UserListVO {
     @ApiModelProperty(notes = "充值金额")
     private BigDecimal rechargeMoney;
 
-    /**
-     * 平台币余额
-     */
-    @ApiModelProperty(notes = "平台币余额")
-    private BigDecimal platformCoin;
-
     /**
      * 充值次数
      */
@@ -188,24 +176,6 @@ public class UserListVO {
     @ApiModelProperty(notes = "创角色数")
     private Integer roleCount;
 
-    /**
-     * 客服id
-     */
-    @ApiModelProperty(notes = "客服id")
-    private Long customerId;
-
-    /**
-     * 是否GS
-     */
-    @ApiModelProperty(notes = "是否GS")
-    private Boolean isGs;
-
-    /**
-     * 玩家vip(所有角色中的最高vip等级)
-     */
-    @ApiModelProperty(notes = "角色vip")
-    private Integer vipMax;
-
     /**
      * 最近登录时间
      */

+ 3 - 3
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserVO.java

@@ -100,10 +100,10 @@ public class UserVO {
     private String address;
 
     /**
-     * 注册来源
+     * 注册来源, 1:腾讯、2:头条
      */
-    @ApiModelProperty(notes = "注册来源")
-    private String regFrom;
+    @ApiModelProperty(notes = "注册来源, 1:腾讯、2:头条")
+    private Integer regFrom;
 
     /**
      * 渠道

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

@@ -3,22 +3,59 @@ 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.AgentListDTO;
+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;
 import com.zanxiang.game.module.mybatis.entity.Agent;
 
 import java.util.List;
 
+/**
+ * @author wcc
+ */
 public interface IAgentService extends IService<Agent> {
 
-    IPage<AgentVO> listOfPage(AgentListDTO dto);
+    /**
+     * 列表页面
+     *
+     * @param param 参数
+     * @return {@link IPage}<{@link AgentVO}>
+     */
+    IPage<AgentVO> listOfPage(AgentListParam param);
 
     /**
      * 建渠道
+     *
+     * @param param 参数
+     * @return boolean
+     */
+    boolean add(AgentAddParam param);
+
+    /**
+     * 通过账户和投手id查询渠道id列表
+     *
+     * @param account   账户
+     * @param pitcherId 投手id
+     * @param agentId   代理人身份证
+     * @return {@link List}<{@link AgentDTO}>
      */
-    boolean add(AgentDTO dto);
+    List<AgentDTO> listUserAgent(String account, String pitcherId, Long agentId);
 
+    /**
+     * 配置将状态
+     *
+     * @param agentIdList 代理id列表
+     * @param putStatus   把状态
+     * @return boolean
+     */
     boolean configPutStatus(List<Long> agentIdList, Integer putStatus);
 
+    /**
+     * 配置支持政策
+     *
+     * @param agentIdList  代理id列表
+     * @param backPolicyId 返回政策id
+     * @return boolean
+     */
     boolean configBackPolicy(List<Long> agentIdList, Long backPolicyId);
 }

+ 1 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IUserService.java

@@ -51,10 +51,9 @@ public interface IUserService extends IService<User> {
      * @param userName    : 用户名称
      * @param nickname    : 用户昵称
      * @param regIp       : 用户注册ip
-     * @param adId        : 广告id
      * @return {@link Map}<{@link Long}, {@link UserDTO}>
      */
-    Map<Long, UserDTO> userCondition(Long userId, List<Long> agentIdList, String userName, String nickname, String regIp, String adId);
+    Map<Long, UserDTO> userCondition(Long userId, List<Long> agentIdList, String userName, String nickname, String regIp);
 
     /**
      * 根据用户id查询信息

+ 63 - 41
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/AgentServiceImpl.java

@@ -9,12 +9,13 @@ import com.zanxiang.advertising.tencent.base.AdvertisingTencentServer;
 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.erp.base.pojo.vo.SysUserRpcVO;
+import com.zanxiang.erp.base.ErpServer;
 import com.zanxiang.erp.base.rpc.ISysUserRpc;
 import com.zanxiang.erp.security.util.SecurityUtil;
 import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
-import com.zanxiang.game.module.manage.pojo.dto.AgentListDTO;
 import com.zanxiang.game.module.manage.pojo.enums.AccountTypeEnum;
+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;
 import com.zanxiang.game.module.manage.pojo.vo.GameInfoVO;
 import com.zanxiang.game.module.manage.service.IAgentService;
@@ -27,47 +28,48 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 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;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.LocalTime;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
+/**
+ * @author wcc
+ */
 @Slf4j
 @Service
-public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent>
-        implements IAgentService {
+public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements IAgentService {
+
     @Autowired
     private IGameService gameService;
+
     @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
     private IAdAccountRpc adAccountRpc;
+
     @DubboReference(providedBy = AdvertisingTencentServer.SERVER_DUBBO_NAME)
     private IUserActionSetRpc userActionSetRpc;
-    @Autowired
+
+    @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
     private ISysUserRpc sysUserRpc;
 
-    public IPage<AgentVO> listOfPage(AgentListDTO dto) {
-        IPage<Agent> agentIPage = page(dto.toPage(), new LambdaQueryWrapper<Agent>()
-                .like(StringUtils.isNotEmpty(dto.getAgentName()), Agent::getAgentName, dto.getAgentName())
-                .eq(dto.getAccountType() != null, Agent::getAccountType, dto.getAccountType())
-                .eq(dto.getAccountId() != null, Agent::getAccountId, dto.getAccountId())
-                .eq(dto.getGameId() != null, Agent::getGameId, dto.getGameId())
-                .eq(dto.getBackPolicyId() != null, Agent::getBackPolicyId, dto.getBackPolicyId())
-                .eq(dto.getPutStatus() != null, Agent::getPutStatus, dto.getPutStatus())
-                .ge(dto.getCreateBeginTime() != null, Agent::getCreateTime, dto.getCreateBeginTime() == null ? null : LocalDateTime.of(dto.getCreateBeginTime(), LocalTime.MIDNIGHT))
-                .le(dto.getCreateEndTime() != null, Agent::getCreateTime, dto.getCreateEndTime() == null ? null : LocalDateTime.of(dto.getCreateEndTime(), LocalTime.MIDNIGHT))
-                .eq(Agent::getCreateBy, dto.getPutUserId() == null ? SecurityUtil.getUserId() : dto.getPutUserId())
+    @Override
+    public IPage<AgentVO> listOfPage(AgentListParam param) {
+        IPage<Agent> agentIPage = page(param.toPage(), new LambdaQueryWrapper<Agent>()
+                .like(StringUtils.isNotEmpty(param.getAgentName()), Agent::getAgentName, param.getAgentName())
+                .eq(param.getAccountType() != null, Agent::getAccountType, param.getAccountType())
+                .eq(param.getAccountId() != null, Agent::getAccountId, param.getAccountId())
+                .eq(param.getGameId() != null, Agent::getGameId, param.getGameId())
+                .eq(param.getBackPolicyId() != null, Agent::getBackPolicyId, param.getBackPolicyId())
+                .eq(param.getPutStatus() != null, Agent::getPutStatus, param.getPutStatus())
+                .ge(param.getCreateBeginTime() != null, Agent::getCreateTime, param.getCreateBeginTime() == null ? null : LocalDateTime.of(param.getCreateBeginTime(), LocalTime.MIDNIGHT))
+                .le(param.getCreateEndTime() != null, Agent::getCreateTime, param.getCreateEndTime() == null ? null : LocalDateTime.of(param.getCreateEndTime(), LocalTime.MIDNIGHT))
+                .eq(Agent::getCreateBy, param.getPutUserId() == null ? SecurityUtil.getUserId() : param.getPutUserId())
                 .orderByDesc(Agent::getCreateTime)
         );
         IPage<AgentVO> result = new Page<>(agentIPage.getCurrent(), agentIPage.getSize(), agentIPage.getTotal());
@@ -79,22 +81,22 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean add(AgentDTO dto) {
+    public boolean add(AgentAddParam param) {
         if (count(new LambdaQueryWrapper<Agent>()
-                .eq(Agent::getAccountType, dto.getAccountType())
-                .eq(Agent::getAccountId, dto.getAccountId())
+                .eq(Agent::getAccountType, param.getAccountType())
+                .eq(Agent::getAccountId, param.getAccountId())
         ) > 0) {
             throw new BaseException("一个账号只能建一个渠道,投一个游戏!!!");
         }
         return save(Agent.builder()
-                .agentName(dto.getAgentName())
+                .agentName(param.getAgentName())
                 .agentKey(UUID.randomUUID().toString().replaceAll("-", ""))
-                .accountType(dto.getAccountType())
-                .accountId(dto.getAccountId())
-                .gameId(dto.getGameId())
-                .userActionSetId(dto.getUserActionSetId())
-                .backPolicyId(dto.getBackPolicyId())
-                .putStatus(dto.getPutStatus())
+                .accountType(param.getAccountType())
+                .accountId(param.getAccountId())
+                .gameId(param.getGameId())
+                .userActionSetId(param.getUserActionSetId())
+                .backPolicyId(param.getBackPolicyId())
+                .putStatus(param.getPutStatus())
                 .createTime(LocalDateTime.now())
                 .createBy(SecurityUtil.getUserId())
                 .build());
@@ -147,23 +149,43 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent>
             }
         }
         Map<Long, GameInfoVO> gameMap = gameService.infoByIds(gameIds).stream().collect(Collectors.toMap(GameInfoVO::getId, Function.identity()));
-        Map<Long, SysUserRpcVO> userMap = sysUserRpc.userInfoByIds(SecurityUtil.getCompanyId(), new ArrayList<>(userIds)).getData().stream()
-                .collect(Collectors.toMap(SysUserRpcVO::getUserId, Function.identity()));
+        Map<Long, String> userMap = sysUserRpc.getUserNameByIds(new ArrayList<>(userIds)).getData();
         return agentList.stream().map(agent -> {
             AgentVO vo = BeanUtil.copy(agent, AgentVO.class);
             vo.setGameInfo(gameMap.get(agent.getGameId()));
             if (AccountTypeEnum.TENCENT.getValue().equals(agent.getAccountType())) {
                 vo.setUserActionSet(userActionSetMap.get(agent.getAccountId() + "_" + agent.getUserActionSetId()));
             }
-            vo.setUserInfo(userMap.get(agent.getCreateBy()));
+            vo.setCreateByName(userMap.get(agent.getCreateBy()));
             return vo;
         }).collect(Collectors.toList());
     }
 
-    private AgentVO toVOSimple(Agent agent) {
-        if (agent == null) {
-            return null;
+    @Override
+    public List<AgentDTO> listUserAgent(String account, String pitcherId, Long agentId) {
+        List<Agent> agentList;
+        //超管权限
+        if (SecurityUtil.isAdmin()) {
+            agentList = super.list(new LambdaQueryWrapper<Agent>()
+                    .eq(Strings.isNotBlank(account), Agent::getAccountId, account)
+                    .eq(Strings.isNotBlank(pitcherId), Agent::getCreateBy, pitcherId)
+                    .eq(agentId != null, Agent::getId, agentId));
+        } else {
+            agentList = super.list(new LambdaQueryWrapper<Agent>()
+                    .eq(Strings.isNotBlank(account), Agent::getAccountId, account)
+                    .eq(Agent::getCreateBy, Strings.isBlank(pitcherId) ? SecurityUtil.getUserId() : pitcherId)
+                    .eq(agentId != null, Agent::getId, agentId));
+        }
+        if (CollectionUtils.isEmpty(agentList)) {
+            return Collections.emptyList();
         }
-        return BeanUtil.copy(agent, AgentVO.class);
+        //设置归属投手
+        List<Long> createByList = agentList.stream().map(Agent::getCreateBy).collect(Collectors.toList());
+        Map<Long, String> userMap = sysUserRpc.getUserNameByIds(createByList).getData();
+        return agentList.stream().map(agent -> {
+            AgentDTO agentDTO = BeanUtil.copy(agent, AgentDTO.class);
+            agentDTO.setCreateByName(userMap.get(agent.getCreateBy()));
+            return agentDTO;
+        }).collect(Collectors.toList());
     }
 }

+ 22 - 12
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserRoleServiceImpl.java

@@ -13,8 +13,8 @@ import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleListVO;
 import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleVO;
 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.GameUserRole;
-import com.zanxiang.game.module.mybatis.entity.PromoChannel;
 import com.zanxiang.game.module.mybatis.mapper.GameUserRoleMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
@@ -24,6 +24,8 @@ import org.springframework.stereotype.Service;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * @author : lingfeng
@@ -50,7 +52,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
     private ICpService cpService;
 
     @Autowired
-    private IPromoChannelService promoChannelService;
+    private IAgentService agentService;
 
     @Override
     public GameUserRoleDTO getByRoleId(String roleId) {
@@ -83,9 +85,9 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
             //玩家游戏信息
             GameUserVO gameUserVO = gameUserService.getById(role.getGameUserId());
             if (gameUserVO != null) {
-                PromoChannel promoChannel = promoChannelService.getById(gameUserVO.getAgentId());
-                if (promoChannel != null) {
-                    gameUserRoleVO.setChannelName(promoChannel.getChannel());
+                Agent agent = agentService.getById(gameUserVO.getAgentId());
+                if (agent != null) {
+                    gameUserRoleVO.setAgentName(agent.getAgentName());
                 }
             }
             list.add(gameUserRoleVO);
@@ -95,9 +97,16 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
 
     @Override
     public IPage<GameUserRoleListVO> list(GameUserRoleListParam param) {
+        //渠道列表
+        List<AgentDTO> agentDTOList = agentService.listUserAgent(null, null, param.getChannelId());
+        //根据条件, 匹配渠道
+        if (CollectionUtils.isEmpty(agentDTOList)) {
+            return new Page<>();
+        }
+        //渠道id
+        List<Long> agentIdList = agentDTOList.stream().map(AgentDTO::getId).collect(Collectors.toList());
         //玩家条件处理
-        Map<Long, UserDTO> userMap = userService.userCondition(param.getUserId(), param.getChannelId() == null ? null : Collections.singletonList(param.getChannelId()),
-                param.getUserName(), param.getNickname(), param.getRegIp(), null);
+        Map<Long, UserDTO> userMap = userService.userCondition(param.getUserId(), agentIdList, param.getUserName(), param.getNickname(), param.getRegIp());
         //根据条件, 匹配不到玩家
         if (userMap != null && userMap.isEmpty()) {
             return new Page<>();
@@ -110,9 +119,9 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
         if (gameMap != null && gameMap.isEmpty()) {
             return new Page<>();
         }
-        Map<Long, PromoChannelDTO> channelMap = promoChannelService.promoChannelMap();
         Map<Long, CpDTO> cpMap = cpService.cpMap();
         Map<Long, GameCategoryDTO> gameCategoryMap = gameCategoryService.gameCategoryMap();
+        Map<Long, AgentDTO> agentMap = agentDTOList.stream().collect(Collectors.toMap(AgentDTO::getId, Function.identity()));
         //执行查询
         return page(param.toPage(), new QueryWrapper<GameUserRole>().lambda()
                 .in(CollectionUtils.isNotEmpty(userIdSet), GameUserRole::getUserId, userIdSet)
@@ -129,11 +138,11 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
                 .ge(param.getRechargeBeginDate() != null, GameUserRole::getLastRechargeTime, param.getRechargeBeginDate() == null ? null : LocalDateTime.of(param.getRechargeBeginDate(), LocalTime.MIN))
                 .le(param.getRechargeEndDate() != null, GameUserRole::getLastRechargeTime, param.getRechargeEndDate() == null ? null : LocalDateTime.of(param.getRechargeEndDate(), LocalTime.MAX))
                 .orderByDesc(GameUserRole::getCreateTime)
-        ).convert(u -> this.toVo(u, userMap, gameMap, channelMap, cpMap, gameCategoryMap));
+        ).convert(u -> this.toVo(u, userMap, gameMap, cpMap, gameCategoryMap, agentMap));
     }
 
     private GameUserRoleListVO toVo(GameUserRole gameUserRole, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap,
-                                    Map<Long, PromoChannelDTO> channelMap, Map<Long, CpDTO> cpMap, Map<Long, GameCategoryDTO> categoryMap) {
+                                    Map<Long, CpDTO> cpMap, Map<Long, GameCategoryDTO> categoryMap, Map<Long, AgentDTO> agentMap) {
         GameUserRoleListVO gameUserRoleListVO = BeanUtils.copy(gameUserRole, GameUserRoleListVO.class);
         if (Objects.isNull(gameUserRoleListVO)) {
             return null;
@@ -145,10 +154,11 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
         if (userDTO != null) {
             gameUserRoleListVO.setUsername(userDTO.getUsername());
             gameUserRoleListVO.setNickname(userDTO.getNickname());
-            gameUserRoleListVO.setAgentId(userDTO.getAgentId());
-            gameUserRoleListVO.setChannel(channelMap.get(userDTO.getAgentId()) == null ? null : channelMap.get(userDTO.getAgentId()).getChannel());
             gameUserRoleListVO.setRegIp(userDTO.getIp());
             gameUserRoleListVO.setRegTime(userDTO.getCreateTime());
+            gameUserRoleListVO.setAgentId(userDTO.getLastAgentId());
+            AgentDTO agentDTO = agentMap.get(userDTO.getLastAgentId());
+            gameUserRoleListVO.setAgentName(agentDTO == null ? null : agentDTO.getAgentName());
         }
         GameDTO gameDTO = CollectionUtils.isEmpty(gameMap) ? null : gameMap.get(gameUserRoleListVO.getGameId());
         if (gameDTO == null) {

+ 30 - 35
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserServiceImpl.java

@@ -20,7 +20,12 @@ import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
 import java.time.LocalTime;
-import java.util.*;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * @author : lingfeng
@@ -40,14 +45,11 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
     @Autowired
     private IGameCategoryService gameCategoryService;
 
-    @Autowired
-    private IPromoChannelService promoChannelService;
-
     @Autowired
     private ICpService cpService;
 
     @Autowired
-    private IPromoAccountService promoAccountService;
+    private IAgentService agentService;
 
     @Override
     public IPage<GameUserListVO> gameUserList(GameUserListParam param) {
@@ -58,29 +60,26 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
             return new Page<>();
         }
         //渠道列表
-        List<Long> agentIdList;
-        if (param.getChannelId() != null) {
-            agentIdList = Collections.singletonList(param.getChannelId());
-        } else {
-            agentIdList = promoChannelService.listByAccountOrPitcherId(param.getAccountId(), param.getPitcherId());
-        }
+        List<AgentDTO> agentDTOList = agentService.listUserAgent(param.getAccountId(),
+                param.getPitcherId(), param.getChannelId());
         //根据条件, 匹配渠道
-        if (agentIdList != null && agentIdList.isEmpty()) {
+        if (CollectionUtils.isEmpty(agentDTOList)) {
             return new Page<>();
         }
+        //渠道id
+        List<Long> agentIdList = agentDTOList.stream().map(AgentDTO::getId).collect(Collectors.toList());
         //玩家条件处理
         Map<Long, UserDTO> userMap = userService.userCondition(param.getUserId(), agentIdList, param.getUserName(),
-                param.getNickname(), null, param.getAdId());
+                param.getNickname(), null);
         //根据条件, 匹配不到玩家
         if (userMap != null && userMap.isEmpty()) {
             return new Page<>();
         }
         //相关用户id
-        Set<Long> userIdSet = userMap == null ? null : userMap.keySet();
-        Map<Long, PromoChannelDTO> channelMap = promoChannelService.promoChannelMap();
         Map<Long, CpDTO> cpMap = cpService.cpMap();
+        Set<Long> userIdSet = userMap == null ? null : userMap.keySet();
         Map<Long, GameCategoryDTO> gameCategoryMap = gameCategoryService.gameCategoryMap();
-        Map<Long, PromoAccountDTO> promoAccountMap = promoAccountService.promoAccountMap();
+        Map<Long, AgentDTO> agentMap = agentDTOList.stream().collect(Collectors.toMap(AgentDTO::getId, Function.identity()));
         //执行查询
         return page(param.toPage(), new QueryWrapper<GameUser>().lambda()
                 .in(CollectionUtils.isNotEmpty(userIdSet), GameUser::getUserId, userIdSet)
@@ -96,11 +95,11 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
                 .eq(param.getVipLevel() != null && param.getVipLevel() <= 10, GameUser::getRoleVipMax, param.getVipLevel())
                 .gt(param.getVipLevel() != null && param.getVipLevel() > 10, GameUser::getRoleVipMax, param.getVipLevel())
                 .orderByDesc(GameUser::getCreateTime)
-        ).convert(u -> this.toVo(u, userMap, gameMap, promoAccountMap, channelMap, cpMap, gameCategoryMap));
+        ).convert(u -> this.toVo(u, userMap, gameMap, agentMap, cpMap, gameCategoryMap));
     }
 
-    private GameUserListVO toVo(GameUser gameUser, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap, Map<Long, PromoAccountDTO> promoAccountMap,
-                                Map<Long, PromoChannelDTO> channelMap, Map<Long, CpDTO> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap) {
+    private GameUserListVO toVo(GameUser gameUser, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap, Map<Long, AgentDTO> agentMap,
+                                Map<Long, CpDTO> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap) {
         GameUserListVO gameUserListVO = BeanUtils.copy(gameUser, GameUserListVO.class);
         if (Objects.isNull(gameUserListVO)) {
             return null;
@@ -112,12 +111,11 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
         if (userDTO != null) {
             gameUserListVO.setNickname(userDTO.getNickname());
             gameUserListVO.setUsername(userDTO.getUsername());
-            gameUserListVO.setAgentId(userDTO.getAgentId());
-            gameUserListVO.setChannel(channelMap.get(userDTO.getAgentId()) == null ? null : channelMap.get(userDTO.getAgentId()).getChannel());
-            gameUserListVO.setAdId(userDTO.getAdId());
         }
-        GameDTO gameDTO = CollectionUtils.isEmpty(gameMap) ? null : gameMap.get(gameUserListVO.getGameId());
-        if (gameDTO == null) {
+        GameDTO gameDTO;
+        if (CollectionUtils.isNotEmpty(gameMap) && gameMap.containsKey(gameUserListVO.getGameId())) {
+            gameDTO = gameMap.get(gameUserListVO.getGameId());
+        } else {
             gameDTO = gameService.getById(gameUserListVO.getGameId());
         }
         if (gameDTO != null) {
@@ -127,17 +125,14 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
             gameUserListVO.setCpName(cpMap.get(gameDTO.getCpId()) == null ? null : cpMap.get(gameDTO.getCpId()).getCpName());
             gameUserListVO.setGameCategoryName(gameCategoryMap.get(gameDTO.getCategory()) == null ? null : gameCategoryMap.get(gameDTO.getCategory()).getName());
         }
-        PromoChannelDTO promoChannelDTO = channelMap.get(gameUserListVO.getAgentId());
-        if (promoChannelDTO != null) {
-            PromoAccountDTO promoAccountDTO = promoAccountMap.get(promoChannelDTO.getAccountId());
-            if (promoAccountDTO != null) {
-                gameUserListVO.setPitcherId(promoAccountDTO.getPitcherId());
-                gameUserListVO.setPitcherName(promoAccountDTO.getPitcherName());
-                gameUserListVO.setAccountId(promoAccountDTO.getId());
-                gameUserListVO.setAccountName(promoAccountDTO.getName());
-                gameUserListVO.setMediaId(promoAccountDTO.getMediaId());
-                gameUserListVO.setMediaName(promoAccountDTO.getMediaName());
-            }
+        //用户渠道
+        AgentDTO agentDTO = agentMap.get(gameUser.getAgentId());
+        //设置渠道信息
+        if (agentDTO != null) {
+            gameUserListVO.setAgentName(agentDTO.getAgentName());
+            gameUserListVO.setPitcherId(agentDTO.getCreateBy());
+            gameUserListVO.setPitcherName(agentDTO.getCreateByName());
+            gameUserListVO.setAccountId(agentDTO.getAccountId());
         }
         return gameUserListVO;
     }

+ 27 - 40
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/OrderServiceImpl.java

@@ -24,6 +24,7 @@ import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -44,15 +45,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private IGameCategoryService gameCategoryService;
 
-    @Autowired
-    private IPromoChannelService promoChannelService;
-
     @Autowired
     private ICpService cpService;
 
-    @Autowired
-    private IPromoAccountService promoAccountService;
-
     @Autowired
     private IUserService userService;
 
@@ -62,6 +57,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private IPayDeviceService payDeviceService;
 
+    @Autowired
+    private IAgentService agentService;
+
     @Override
     public IPage<UserOrderListVO> orderList(UserOrderListParam param) {
         //执行查询
@@ -99,16 +97,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Override
     public OrderListVO orderList(OrderParam param) {
         //渠道列表
-        List<Long> agentIds;
-        if (param.getChannelId() == null) {
-            agentIds = promoChannelService.listByAccountOrPitcherId(param.getAccountId(), param.getPitcherId());
-        } else {
-            agentIds = Collections.singletonList(param.getChannelId());
-        }
+        List<AgentDTO> agentDTOList = agentService.listUserAgent(param.getAccountId(), param.getPitcherId(), param.getChannelId());
         //根据条件, 匹配渠道
-        if (agentIds != null && agentIds.isEmpty()) {
+        if (CollectionUtils.isEmpty(agentDTOList)) {
             return new OrderListVO(param.toPage().getSize());
         }
+        //渠道id列表
+        List<Long> agentIds = agentDTOList.stream().map(AgentDTO::getId).collect(Collectors.toList());
+        //查询订单列表
         IPage<OrderVO> page = page(param.toPage(), getListWrapper(param, agentIds, "*")).convert(this::orderToVo);
         if (page.getTotal() == 0) {
             return new OrderListVO(param.toPage().getSize());
@@ -130,11 +126,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         //玩家信息
         List<Long> userIdList = orderListVOList.stream().map(OrderVO::getUserId).collect(Collectors.toList());
         Map<Long, UserDTO> userMap = userService.getByUserIds(userIdList);
-        //渠道信息
-        List<Long> agentIdList = orderListVOList.stream().map(OrderVO::getAgentId).collect(Collectors.toList());
-        Map<Long, PromoChannelDTO> channelMap = promoChannelService.promoChannelMap(agentIdList);
-        //推广账号信息
-        Map<Long, PromoAccountDTO> promoAccountMap = promoAccountService.promoAccountMap();
+        //渠道
+        Map<Long, AgentDTO> agentMap = agentDTOList.stream().collect(Collectors.toMap(AgentDTO::getId, Function.identity()));
         //游戏信息
         List<Long> gameIds = orderListVOList.stream().map(OrderVO::getGameId).collect(Collectors.toList());
         List<Long> regGameIds = orderListVOList.stream().map(OrderVO::getRegGameId).collect(Collectors.toList());
@@ -149,8 +142,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         //支付方式列表
         Map<Long, PayDeviceDTO> payDeviceMap = payDeviceService.payDeviceMap();
         //字段信息补充更新
-        orderListVOList.forEach(vo -> this.update(vo, userMap, channelMap, gameMap, gameCategoryMap, cpMap,
-                promoAccountMap, payWayMap, payDeviceMap));
+        orderListVOList.forEach(vo -> this.update(vo, userMap, gameMap, gameCategoryMap, cpMap,
+                payWayMap, payDeviceMap, agentMap));
         //设置返回
         OrderListVO orderListVO = new OrderListVO();
         orderListVO.setSize(page.getSize());
@@ -162,33 +155,27 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         return orderListVO;
     }
 
-    private void update(OrderVO orderVO, Map<Long, UserDTO> userMap, Map<Long, PromoChannelDTO> channelMap,
-                        Map<Long, GameDTO> gameMap, Map<Long, GameCategoryDTO> gameCategoryMap, Map<Long, CpDTO> cpMap,
-                        Map<Long, PromoAccountDTO> promoAccountMap, Map<Long, PayWayDTO> payWayMap, Map<Long, PayDeviceDTO> payDeviceMap) {
+    private void update(OrderVO orderVO, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap,
+                        Map<Long, GameCategoryDTO> gameCategoryMap, Map<Long, CpDTO> cpMap, Map<Long, PayWayDTO> payWayMap,
+                        Map<Long, PayDeviceDTO> payDeviceMap, Map<Long, AgentDTO> agentMap) {
         orderVO.setDateTime(orderVO.getCreateTime().toLocalDate());
         //用户信息补充
         UserDTO userDTO = userMap.get(orderVO.getUserId());
         if (userDTO != null) {
             //注册渠道
-            PromoChannelDTO promoChannelDTO = channelMap.get(userDTO.getAgentId());
-            if (promoChannelDTO != null) {
-                orderVO.setRegAgentId(userDTO.getAgentId());
-                orderVO.setRegChannel(promoChannelDTO.getChannel());
+            AgentDTO agentDTO = agentMap.get(userDTO.getRegAgentId());
+            if (agentDTO != null) {
+                orderVO.setRegAgentId(agentDTO.getId());
+                orderVO.setRegAgentName(agentDTO.getAgentName());
             }
         }
-        //渠道信息补充
-        PromoChannelDTO promoChannelDTO = channelMap.get(orderVO.getAgentId());
-        if (promoChannelDTO != null) {
-            orderVO.setChannel(promoChannelDTO.getChannel());
-            PromoAccountDTO promoAccountDTO = promoAccountMap.get(promoChannelDTO.getAccountId());
-            if (promoAccountDTO != null) {
-                orderVO.setAccountName(promoAccountDTO.getName());
-                orderVO.setAccountId(promoAccountDTO.getId());
-                orderVO.setPitcherId(promoAccountDTO.getPitcherId());
-                orderVO.setPitcherName(promoAccountDTO.getPitcherName());
-                orderVO.setMediaId(promoAccountDTO.getMediaId());
-                orderVO.setMediaName(promoAccountDTO.getMediaName());
-            }
+        //充值渠道
+        AgentDTO agentDTO = agentMap.get(orderVO.getAgentId());
+        if (agentDTO != null) {
+            orderVO.setAccountId(agentDTO.getId());
+            orderVO.setPitcherId(agentDTO.getCreateBy());
+            orderVO.setPitcherName(agentDTO.getCreateByName());
+            orderVO.setAccountType(agentDTO.getAccountType());
         }
         //注册游戏
         GameDTO regGameDTO = gameMap.get(orderVO.getRegGameId());

+ 39 - 52
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/UserServiceImpl.java

@@ -16,8 +16,7 @@ import com.zanxiang.game.module.manage.pojo.vo.UserCardVO;
 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.PromoAccount;
-import com.zanxiang.game.module.mybatis.entity.PromoChannel;
+import com.zanxiang.game.module.mybatis.entity.Agent;
 import com.zanxiang.game.module.mybatis.entity.User;
 import com.zanxiang.game.module.mybatis.mapper.UserMapper;
 import com.zanxiang.module.util.encryption.Md5Util;
@@ -49,12 +48,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Autowired
     private IGameUserService gameUserService;
 
-    @Autowired
-    private IPromoChannelService promoChannelService;
-
-    @Autowired
-    private IPromoAccountService promoAccountService;
-
     @Autowired
     private IUserService userService;
 
@@ -67,19 +60,19 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Autowired
     private IUserCardService userCardService;
 
+    @Autowired
+    private IAgentService agentService;
+
     @Override
     public IPage<UserListVO> list(UserListParam param) {
         //渠道列表
-        List<Long> agentIdList;
-        if (param.getChannelId() == null) {
-            agentIdList = promoChannelService.listByAccountOrPitcherId(param.getAccountId(), param.getPitcherId());
-        } else {
-            agentIdList = Collections.singletonList(param.getChannelId());
-        }
+        List<AgentDTO> agentDTOList = agentService.listUserAgent(param.getAccountId(), param.getPitcherId(), param.getChannelId());
         //根据条件, 匹配渠道
-        if (agentIdList != null && agentIdList.isEmpty()) {
+        if (CollectionUtils.isEmpty(agentDTOList)) {
             return new Page<>();
         }
+        //渠道id列表
+        List<Long> agentIdList = agentDTOList.stream().map(AgentDTO::getId).collect(Collectors.toList());
         //游戏条件处理
         Map<Long, GameDTO> gameMap = gameService.gameCondition(param.getCpId(), param.getGameId(), param.getGameCategoryId());
         //根据条件, 匹配不到游戏
@@ -88,7 +81,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         }
         //玩家条件处理
         Map<Long, UserDTO> userMap = userService.userCondition(param.getUserId(), agentIdList, param.getUserName(),
-                param.getNickname(), param.getRegIp(), param.getAdId());
+                param.getNickname(), param.getRegIp());
         //根据条件, 匹配不到玩家
         if (userMap != null && userMap.isEmpty()) {
             return new Page<>();
@@ -96,9 +89,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         //相关用户id
         Set<Long> userIdSet = userMap == null ? null : userMap.keySet();
         Map<Long, CpDTO> cpMap = cpService.cpMap();
-        Map<Long, PromoChannelDTO> channelMap = promoChannelService.promoChannelMap();
+        Map<Long, AgentDTO> agentMap = agentDTOList.stream().collect(Collectors.toMap(AgentDTO::getId, Function.identity()));
         Map<Long, GameCategoryDTO> gameCategoryMap = gameCategoryService.gameCategoryMap();
-        Map<Long, PromoAccountDTO> promoAccountMap = promoAccountService.promoAccountMap();
         //执行查询
         return page(param.toPage(), new QueryWrapper<User>().lambda()
                 .eq(param.getUserId() != null, User::getId, param.getUserId())
@@ -117,18 +109,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 .le(param.getRechargeEndDate() != null, User::getLastRechargeTime, param.getRechargeEndDate() == null ? null : LocalDateTime.of(param.getRechargeEndDate(), LocalTime.MAX))
                 .gt(Objects.equals(param.getIsRecharge(), Boolean.TRUE), User::getRechargeCount, 0)
                 .eq(Objects.equals(param.getIsRecharge(), Boolean.FALSE), User::getRechargeCount, 0)
-                .eq(param.getVipLevel() != null && param.getVipLevel() <= 10, User::getVipMax, param.getVipLevel())
-                .gt(param.getVipLevel() != null && param.getVipLevel() > 10, User::getVipMax, param.getVipLevel())
                 .eq(param.getStatus() != null, User::getStatus, param.getStatus())
-                .eq(param.getChannelId() != null, User::getAgentId, param.getChannelId())
-                .eq(param.getCustomerId() != null, User::getCustomerId, param.getCustomerId())
-                .eq(param.getIsGs() != null, User::getIsGs, param.getIsGs())
+                .eq(param.getChannelId() != null, User::getLastAgentId, param.getChannelId())
                 .orderByDesc(User::getCreateTime)
-        ).convert(u -> this.toVo(u, userMap, gameMap, promoAccountMap, channelMap, cpMap, gameCategoryMap));
+        ).convert(u -> this.toVo(u, userMap, gameMap, cpMap, gameCategoryMap, agentMap));
     }
 
-    private UserListVO toVo(User user, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap, Map<Long, PromoAccountDTO> promoAccountMap,
-                            Map<Long, PromoChannelDTO> channelMap, Map<Long, CpDTO> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap) {
+    private UserListVO toVo(User user, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap, Map<Long, CpDTO> cpMap,
+                            Map<Long, GameCategoryDTO> gameCategoryMap, Map<Long, AgentDTO> agentMap) {
         UserListVO userListVO = BeanUtils.copy(user, UserListVO.class);
         if (Objects.isNull(userListVO)) {
             return null;
@@ -142,9 +130,23 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             userListVO.setRegIp(userDTO.getIp());
             userListVO.setUsername(userDTO.getUsername());
             userListVO.setNickname(userDTO.getNickname());
-            userListVO.setAgentId(userDTO.getAgentId());
-            userListVO.setChannel(channelMap.get(userDTO.getAgentId()) == null ? null : channelMap.get(userDTO.getAgentId()).getChannel());
-            userListVO.setAdId(userDTO.getAdId());
+            userListVO.setRegAgentId(userDTO.getRegAgentId());
+            //注册渠道
+            AgentDTO regAgentDTO = agentMap.get(userDTO.getRegAgentId());
+
+            if (regAgentDTO != null) {
+                userListVO.setRegAgentName(regAgentDTO.getAgentName());
+            }
+            userListVO.setAgentId(userDTO.getLastAgentId());
+            //最新渠道
+            AgentDTO lastAgentDTO = agentMap.get(userDTO.getLastAgentId());
+            if (lastAgentDTO != null) {
+                userListVO.setAgentName(lastAgentDTO.getAgentName());
+                userListVO.setAccountId(lastAgentDTO.getId());
+                userListVO.setPitcherId(lastAgentDTO.getCreateBy());
+                userListVO.setPitcherName(lastAgentDTO.getCreateByName());
+                userListVO.setAccountType(lastAgentDTO.getAccountType());
+            }
         }
         GameDTO gameDTO = CollectionUtils.isEmpty(gameMap) ? null : gameMap.get(userListVO.getGameId());
         if (gameDTO == null) {
@@ -157,18 +159,6 @@ 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());
         }
-        PromoChannelDTO promoChannelDTO = channelMap.get(userListVO.getAgentId());
-        if (promoChannelDTO != null) {
-            PromoAccountDTO promoAccountDTO = promoAccountMap.get(promoChannelDTO.getAccountId());
-            if (promoAccountDTO != null) {
-                userListVO.setAccountId(promoAccountDTO.getId());
-                userListVO.setAccountName(promoAccountDTO.getName());
-                userListVO.setPitcherId(promoAccountDTO.getPitcherId());
-                userListVO.setPitcherName(promoAccountDTO.getPitcherName());
-                userListVO.setMediaId(promoAccountDTO.getMediaId());
-                userListVO.setMediaName(promoAccountDTO.getMediaName());
-            }
-        }
         return userListVO;
     }
 
@@ -222,11 +212,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             userVO.setRegGame(gameDTO.getName());
         }
         //渠道
-        PromoChannel promoChannel = promoChannelService.getById(user.getAgentId());
-        if (promoChannel != null) {
-            userVO.setChannelName(promoChannel.getChannel());
-            PromoAccount promoAccount = promoAccountService.getById(promoChannel.getAccountId());
-            userVO.setRegFrom(promoAccount.getAccount());
+        Agent agent = agentService.getById(user.getLastAgentId());
+        if (agent != null) {
+            userVO.setChannelName(agent.getAgentName());
+            userVO.setRegFrom(agent.getAccountType());
         }
         //vip等级
         GameUserVO maxVipGameUser = gameUserService.getMaxVipGameUser(userId);
@@ -237,22 +226,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     }
 
     @Override
-    public Map<Long, UserDTO> userCondition(Long userId, List<Long> agentIdList, String userName, String nickname,
-                                            String regIp, String adId) {
+    public Map<Long, UserDTO> userCondition(Long userId, List<Long> agentIdList, String userName, String nickname, String regIp) {
         //用户信息条件处理
         if (userId == null && CollectionUtils.isEmpty(agentIdList) && Strings.isBlank(userName)
-                && Strings.isBlank(nickname) && Strings.isBlank(regIp) && Strings.isBlank(adId)) {
+                && Strings.isBlank(nickname) && Strings.isBlank(regIp)) {
             return null;
         }
         //查询
         List<User> userList = super.list(new LambdaQueryWrapper<User>()
                 .eq(userId != null, User::getId, userId)
-                .eq(Strings.isNotBlank(adId), User::getAdId, adId)
-                .in(CollectionUtils.isNotEmpty(agentIdList), User::getAgentId, agentIdList)
+                .in(CollectionUtils.isNotEmpty(agentIdList), User::getLastAgentId, agentIdList)
                 .eq(Strings.isNotBlank(regIp), User::getIp, regIp)
                 .like(Strings.isNotBlank(userName), User::getUsername, userName)
                 .like(Strings.isNotBlank(nickname), User::getNickname, nickname)
-                .select(User::getId, User::getUsername, User::getNickname, User::getIp, User::getCreateTime, User::getAgentId, User::getAdId));
+                .select(User::getId, User::getUsername, User::getNickname, User::getIp, User::getCreateTime, User::getLastAgentId));
         if (CollectionUtils.isEmpty(userList)) {
             return Collections.emptyMap();
         }

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

@@ -32,6 +32,11 @@ public class GameUserRole {
      */
     private Long userId;
 
+    /**
+     * 所属渠道ID
+     */
+    private Long agentId;
+
     /**
      * 游戏用户id, 对应game_user主键id
      */

+ 25 - 45
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/User.java

@@ -29,9 +29,14 @@ public class User {
     private Long id;
 
     /**
-     * 所属渠道ID
+     * 注册渠道id
      */
-    private Long agentId;
+    private Long regAgentId;
+
+    /**
+     * 最新渠道id
+     */
+    private Long lastAgentId;
 
     /**
      * 注册游戏id
@@ -53,11 +58,6 @@ public class User {
      */
     private String password;
 
-    /**
-     * 绑定邮箱
-     */
-    private String email;
-
     /**
      * 绑定手机号码
      */
@@ -74,24 +74,24 @@ public class User {
     private String sessionKey;
 
     /**
-     * 绑定支付宝账号
+     * 状态, 0 正常 1 封禁
      */
-    private String aliPay;
+    private Integer status;
 
     /**
-     * 客户端类型, 1 : 安卓app
+     * 头像
      */
-    private Integer deviceType;
+    private String avatar;
 
     /**
-     * 状态, 0 正常 1 封禁
+     * 绑定支付宝账号
      */
-    private Integer status;
+    private String aliPay;
 
     /**
-     * 头像
+     * 绑定邮箱
      */
-    private String avatar;
+    private String email;
 
     /**
      * 充值次数
@@ -108,50 +108,30 @@ public class User {
      */
     private LocalDateTime lastRechargeTime;
 
-    /**
-     * 平台币余额
-     */
-    private BigDecimal platformCoin;
-
     /**
      * 创角数
      */
     private Integer roleCount;
 
-    /**
-     * 是否GS
-     */
-    private Boolean isGs;
-
-    /**
-     * 客服id
-     */
-    private Long customerId;
-
-    /**
-     * 拥有角色最高vip等级
-     */
-    private Integer vipMax;
-
     /**
      * 是否实名认证,0未实名认证,1成年人,2未成年人
      */
     private Integer authentication;
 
     /**
-     * 注册时间
+     * 客户端类型, 1:安卓app, 2: 苹果iosApp, 3: h5网页, 4 : 小程序(小游戏)
      */
-    private LocalDateTime createTime;
+    private Integer deviceType;
 
     /**
-     * 更改时间
+     * 客户端操作系统, android, ios, windows, mac
      */
-    private LocalDateTime updateTime;
+    private String deviceSystem;
 
     /**
-     * 客户端操作系统, android, ios, windows, mac
+     * 用户注册ip
      */
-    private String deviceSystem;
+    private String ip;
 
     /**
      * 用户设备mac地址
@@ -169,14 +149,14 @@ public class User {
     private String androidId;
 
     /**
-     * 用户注册ip
+     * 注册时间
      */
-    private String ip;
+    private LocalDateTime createTime;
 
     /**
-     * 归因广告id
+     * 更改时间
      */
-    private String adId;
+    private LocalDateTime updateTime;
 
     /**
      * 获取用户显示手机号

+ 0 - 6
game-module/game-module-sdk/pom.xml

@@ -113,12 +113,6 @@
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-metadata-definition-protobuf</artifactId>
         </dependency>
-        <!-- 头条回传api -->
-        <dependency>
-            <groupId>com.zanxiang.advertising.oceanengine</groupId>
-            <artifactId>advertising-oceanengine-track-base</artifactId>
-            <version>${project.version}</version>
-        </dependency>
     </dependencies>
 
     <build>

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

@@ -57,7 +57,7 @@ public class OrderPaySuccessListener {
         //商户号额度统计更新
         performOrderService.payMerchantTotal(platformOrderDTO);
         //订单回传
-        callBackService.orderCallBack(platformOrderDTO);
+//        callBackService.orderCallBack(platformOrderDTO);
         log.info("订单:{} 支付成功履约监听逻辑 ------end---------", event.getOrderId());
     }
 }

+ 67 - 26
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/dto/UserDTO.java

@@ -2,6 +2,7 @@ package com.zanxiang.game.module.sdk.pojo.dto;
 
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
 /**
@@ -18,9 +19,19 @@ public class UserDTO {
     private Long id;
 
     /**
-     * 所属渠道ID
+     * 注册渠道id
      */
-    private Long agentId;
+    private Long regAgentId;
+
+    /**
+     * 最新渠道id
+     */
+    private Long lastAgentId;
+
+    /**
+     * 注册游戏id
+     */
+    private Long gameId;
 
     /**
      * 用户名
@@ -33,19 +44,39 @@ public class UserDTO {
     private String nickname;
 
     /**
-     * 注册手机号
+     * 密码
      */
-    private String regMobile;
+    private String password;
 
     /**
-     * 注册邮箱
+     * 绑定手机号码
      */
-    private String regEmail;
+    private String mobile;
 
     /**
-     * 密码
+     * 微信用户openId
      */
-    private String password;
+    private String openId;
+
+    /**
+     * 微信用户会话密钥
+     */
+    private String sessionKey;
+
+    /**
+     * 状态, 0 正常 1 封禁
+     */
+    private Integer status;
+
+    /**
+     * 头像
+     */
+    private String avatar;
+
+    /**
+     * 绑定支付宝账号
+     */
+    private String aliPay;
 
     /**
      * 绑定邮箱
@@ -53,49 +84,59 @@ public class UserDTO {
     private String email;
 
     /**
-     * 绑定手机号码
+     * 充值次数
      */
-    private String mobile;
+    private Integer rechargeCount;
 
     /**
-     * 微信小游戏用户openId
+     * 充值金额
      */
-    private String openId;
+    private BigDecimal rechargeMoney;
 
     /**
-     * 微信用户会话密钥
+     * 最近充值时间
      */
-    private String sessionKey;
+    private LocalDateTime lastRechargeTime;
 
     /**
-     * 设备来源 mobile,android,iphone,ipad,web,pc,mac,wxapp
+     * 创角数
      */
-    private String fromDevice;
+    private Integer roleCount;
 
     /**
-     * 设备ID android 为imei ios 为idfa
+     * 是否实名认证,0未实名认证,1成年人,2未成年人
      */
-    private String deviceId;
+    private Integer authentication;
 
     /**
-     * 设备类型
+     * 客户端类型, 1:安卓app, 2: 苹果iosApp, 3: h5网页, 4 : 小程序(小游戏)
      */
-    private String deviceType;
+    private Integer deviceType;
 
     /**
-     * -1 为冻结状态, 1 为试玩状态 2为正常状态
+     * 客户端操作系统, android, ios, windows, mac
      */
-    private Integer status;
+    private String deviceSystem;
 
     /**
-     * 头像
+     * 用户注册ip
      */
-    private String avatar;
+    private String ip;
+
+    /**
+     * 用户设备mac地址
+     */
+    private String mac;
+
+    /**
+     * 设备唯一编号IMEI
+     */
+    private String imei;
 
     /**
-     * 渠道
+     * 安卓id, (仅安卓设备才有值)
      */
-    private Long channel;
+    private String androidId;
 
     /**
      * 注册时间

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

@@ -0,0 +1,18 @@
+package com.zanxiang.game.module.sdk.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zanxiang.game.module.mybatis.entity.Agent;
+
+/**
+ * @author bilingfeng
+ */
+public interface IAgentService extends IService<Agent> {
+
+    /**
+     * 根据前端参数获取渠道信息
+     *
+     * @param channel 通道
+     * @return {@link Long}
+     */
+    Long getAgentIdByChannel(String channel);
+}

+ 13 - 16
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/ICallBackService.java

@@ -1,8 +1,5 @@
 package com.zanxiang.game.module.sdk.service;
 
-import com.zanxiang.game.module.mybatis.entity.User;
-import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
-
 /**
  * @author : lingfeng
  * @time : 2022-11-10
@@ -10,17 +7,17 @@ import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
  */
 public interface ICallBackService {
 
-    /**
-     * 用户回传
-     *
-     * @param user 用户
-     */
-    void userCallBack(User user);
-
-    /**
-     * 订单回传
-     *
-     * @param orderInfo 订单信息
-     */
-    void orderCallBack(PlatformOrderDTO orderInfo);
+//    /**
+//     * 用户回传
+//     *
+//     * @param user 用户
+//     */
+//    void userCallBack(User user);
+//
+//    /**
+//     * 订单回传
+//     *
+//     * @param orderInfo 订单信息
+//     */
+//    void orderCallBack(PlatformOrderDTO orderInfo);
 }

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

@@ -0,0 +1,21 @@
+package com.zanxiang.game.module.sdk.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zanxiang.game.module.mybatis.entity.Agent;
+import com.zanxiang.game.module.mybatis.mapper.AgentMapper;
+import com.zanxiang.game.module.sdk.service.IAgentService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author bilingfeng
+ */
+@Slf4j
+@Service
+public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements IAgentService {
+
+    @Override
+    public Long getAgentIdByChannel(String channel) {
+        return null;
+    }
+}

+ 81 - 98
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/CallBackServiceImpl.java

@@ -1,30 +1,12 @@
 package com.zanxiang.game.module.sdk.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.zanxiang.advertising.oceanengine.track.base.pojo.PlatformServer;
-import com.zanxiang.advertising.oceanengine.track.base.pojo.dto.AppOrderRpcDTO;
-import com.zanxiang.advertising.oceanengine.track.base.pojo.dto.UserRegisterRpcDTO;
-import com.zanxiang.advertising.oceanengine.track.base.pojo.rpc.IAppOrderRpc;
-import com.zanxiang.advertising.oceanengine.track.base.pojo.rpc.IAppUserRpc;
-import com.zanxiang.advertising.oceanengine.track.base.pojo.vo.AppReportLogRpcVO;
-import com.zanxiang.game.module.base.enums.CallBackEnum;
-import com.zanxiang.game.module.base.enums.OsEnum;
-import com.zanxiang.game.module.mybatis.entity.Order;
-import com.zanxiang.game.module.mybatis.entity.User;
-import com.zanxiang.game.module.sdk.enums.PayTypeEnum;
-import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
 import com.zanxiang.game.module.sdk.service.ICallBackService;
 import com.zanxiang.game.module.sdk.service.IOrderService;
 import com.zanxiang.game.module.sdk.service.IUserService;
-import com.zanxiang.module.util.JsonUtil;
-import com.zanxiang.module.util.pojo.ResultVO;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
-
 /**
  * @author : lingfeng
  * @time : 2022-11-10
@@ -40,86 +22,87 @@ public class CallBackServiceImpl implements ICallBackService {
     @Autowired
     private IOrderService orderService;
 
-    @DubboReference(providedBy = PlatformServer.SERVER_DUBBO_NAME)
-    private IAppUserRpc appUserRpc;
-
-    @DubboReference(providedBy = PlatformServer.SERVER_DUBBO_NAME)
-    private IAppOrderRpc appOrderRpc;
-
-    @Override
-    public void userCallBack(User user) {
-        if (user == null) {
-            return;
-        }
-        log.error("用户注册回传, userId : {}", user.getId());
-        UserRegisterRpcDTO dto = UserRegisterRpcDTO.builder()
-                .appKey(String.valueOf(user.getGameId()))
-                .userId(String.valueOf(user.getId()))
-                .username(user.getUsername())
-                .mac(user.getMac())
-                .imei(user.getImei())
-                .androidId(user.getAndroidId())
-                .ip(user.getIp())
-                .osType(OsEnum.getByName(user.getDeviceSystem()))
-                .registerTime(user.getCreateTime())
-                .build();
-        //调接口
-        ResultVO<AppReportLogRpcVO> result;
-        try {
-            result = appUserRpc.register(dto);
-        } catch (Exception e) {
-            log.error("用户注册回传上报异常, user : {}, e : {}", JsonUtil.toString(user), e.getMessage());
-            return;
-        }
-        log.error("用户注册回传结果, userId : {}, result : {}", user.getId(), JsonUtil.toString(result));
-        String adId = "AD_ID";
-        //成功
-        if (result.isSuccess() && result.getData() != null && result.getData().getAid() != null) {
-            adId = result.getData().getAid().toString();
-        }
-        //更新数据库
-        userService.update(new LambdaUpdateWrapper<User>().set(User::getAdId, adId).eq(User::getId, user.getId()));
-    }
 
-    @Override
-    public void orderCallBack(PlatformOrderDTO orderInfo) {
-        if (orderInfo == null) {
-            return;
-        }
-        log.error("用户注册回传, orderId : {}", orderInfo.getOrderId());
-        AppOrderRpcDTO dto = AppOrderRpcDTO.builder()
-                .appKey(String.valueOf(orderInfo.getGameId()))
-                .orderId(orderInfo.getOrderId())
-                .userId(String.valueOf(orderInfo.getUserId()))
-                .amount(orderInfo.getAmount().multiply(new BigDecimal("100")).longValue())
-                .realAmount(orderInfo.getRealAmount().multiply(new BigDecimal("100")).longValue())
-                .tranNo(orderInfo.getMerchantOrderNo())
-                .orderStatus(orderInfo.getStatus())
-                .payType(PayTypeEnum.getByPayType(orderInfo.getPayWayId()))
-                .payTime(orderInfo.getPayTime())
-                .createTime(orderInfo.getCreateTime())
-                .build();
-        //调接口
-        ResultVO<AppReportLogRpcVO> result;
-        try {
-            result = appOrderRpc.order(dto);
-        } catch (Exception e) {
-            log.error("订单回传上报异常, orderInfo : {}, e : {}", JsonUtil.toString(orderInfo), e.getMessage());
-            return;
-        }
-        log.error("订单回传结果, orderId : {}, result : {}", orderInfo.getOrderId(), JsonUtil.toString(result));
-        String adId = "AD_ID";
-        Integer callBackStatus = CallBackEnum.FAIL_CALL_BACK.getCallBackStatus();
-        //成功
-        if (result.isSuccess() && result.getData() != null && result.getData().getAid() != null) {
-            adId = result.getData().getAid().toString();
-            callBackStatus = CallBackEnum.SUCCESS_CALL_BACK.getCallBackStatus();
-        }
-        //更新数据库
-        orderService.update(new LambdaUpdateWrapper<Order>()
-                .set(Order::getAdId, adId)
-                .set(Order::getCallBackStatus, callBackStatus)
-                .eq(Order::getOrderId, orderInfo.getOrderId()));
-    }
+//    @DubboReference(providedBy = PlatformServer.SERVER_DUBBO_NAME)
+//    private IAppUserRpc appUserRpc;
+//
+//    @DubboReference(providedBy = PlatformServer.SERVER_DUBBO_NAME)
+//    private IAppOrderRpc appOrderRpc;
+//
+//    @Override
+//    public void userCallBack(User user) {
+//        if (user == null) {
+//            return;
+//        }
+//        log.error("用户注册回传, userId : {}", user.getId());
+//        UserRegisterRpcDTO dto = UserRegisterRpcDTO.builder()
+//                .appKey(String.valueOf(user.getGameId()))
+//                .userId(String.valueOf(user.getId()))
+//                .username(user.getUsername())
+//                .mac(user.getMac())
+//                .imei(user.getImei())
+//                .androidId(user.getAndroidId())
+//                .ip(user.getIp())
+//                .osType(OsEnum.getByName(user.getDeviceSystem()))
+//                .registerTime(user.getCreateTime())
+//                .build();
+//        //调接口
+//        ResultVO<AppReportLogRpcVO> result;
+//        try {
+//            result = appUserRpc.register(dto);
+//        } catch (Exception e) {
+//            log.error("用户注册回传上报异常, user : {}, e : {}", JsonUtil.toString(user), e.getMessage());
+//            return;
+//        }
+//        log.error("用户注册回传结果, userId : {}, result : {}", user.getId(), JsonUtil.toString(result));
+//        String adId = "AD_ID";
+//        //成功
+//        if (result.isSuccess() && result.getData() != null && result.getData().getAid() != null) {
+//            adId = result.getData().getAid().toString();
+//        }
+//        //更新数据库
+//        userService.update(new LambdaUpdateWrapper<User>().set(User::getAdId, adId).eq(User::getId, user.getId()));
+//    }
+//
+//    @Override
+//    public void orderCallBack(PlatformOrderDTO orderInfo) {
+//        if (orderInfo == null) {
+//            return;
+//        }
+//        log.error("用户注册回传, orderId : {}", orderInfo.getOrderId());
+//        AppOrderRpcDTO dto = AppOrderRpcDTO.builder()
+//                .appKey(String.valueOf(orderInfo.getGameId()))
+//                .orderId(orderInfo.getOrderId())
+//                .userId(String.valueOf(orderInfo.getUserId()))
+//                .amount(orderInfo.getAmount().multiply(new BigDecimal("100")).longValue())
+//                .realAmount(orderInfo.getRealAmount().multiply(new BigDecimal("100")).longValue())
+//                .tranNo(orderInfo.getMerchantOrderNo())
+//                .orderStatus(orderInfo.getStatus())
+//                .payType(PayTypeEnum.getByPayType(orderInfo.getPayWayId()))
+//                .payTime(orderInfo.getPayTime())
+//                .createTime(orderInfo.getCreateTime())
+//                .build();
+//        //调接口
+//        ResultVO<AppReportLogRpcVO> result;
+//        try {
+//            result = appOrderRpc.order(dto);
+//        } catch (Exception e) {
+//            log.error("订单回传上报异常, orderInfo : {}, e : {}", JsonUtil.toString(orderInfo), e.getMessage());
+//            return;
+//        }
+//        log.error("订单回传结果, orderId : {}, result : {}", orderInfo.getOrderId(), JsonUtil.toString(result));
+//        String adId = "AD_ID";
+//        Integer callBackStatus = CallBackEnum.FAIL_CALL_BACK.getCallBackStatus();
+//        //成功
+//        if (result.isSuccess() && result.getData() != null && result.getData().getAid() != null) {
+//            adId = result.getData().getAid().toString();
+//            callBackStatus = CallBackEnum.SUCCESS_CALL_BACK.getCallBackStatus();
+//        }
+//        //更新数据库
+//        orderService.update(new LambdaUpdateWrapper<Order>()
+//                .set(Order::getAdId, adId)
+//                .set(Order::getCallBackStatus, callBackStatus)
+//                .eq(Order::getOrderId, orderInfo.getOrderId()));
+//    }
 
 }

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

@@ -110,6 +110,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
         }
         userRole = GameUserRole.builder()
                 .userId(userData.getUserId())
+                .agentId(gameUser.getAgentId())
                 .gameUserId(gameUser.getId())
                 .gameId(userData.getGameId())
                 .serverId(param.getServerId())

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

@@ -31,7 +31,7 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
         }
         super.save(GameUser.builder()
                 .userId(user.getId())
-                .agentId(user.getAgentId())
+                .agentId(user.getLastAgentId())
                 .gameId(user.getGameId())
                 .nickname(user.getNickname())
                 .createTime(LocalDateTime.now())

+ 12 - 11
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java

@@ -57,9 +57,6 @@ public class LoginServiceImpl implements IRegisterLoginService {
     @Autowired
     private IWordCheckService wordCheckService;
 
-    @Autowired
-    private IPromoChannelService promoChannelService;
-
     @Autowired
     private IUserCardService userCardService;
 
@@ -84,6 +81,9 @@ public class LoginServiceImpl implements IRegisterLoginService {
     @Autowired
     private IUserShareService userShareService;
 
+    @Autowired
+    private IAgentService agentService;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public ResultVO<UserLoginVO> loginWxCode(LoginVxCodeParam param, UserData userData) {
@@ -122,10 +122,10 @@ public class LoginServiceImpl implements IRegisterLoginService {
         Long agentId;
         Long fromUserId = null;
         if (param.getShareUserId() == null) {
-            agentId = promoChannelService.getAgentIdByChannel(userData.getChannel());
+            agentId = agentService.getAgentIdByChannel(userData.getChannel());
         } else {
             UserDTO userDTO = userService.getUserByUserId(param.getShareUserId());
-            agentId = userDTO.getAgentId();
+            agentId = userDTO.getLastAgentId();
             fromUserId = userDTO.getId();
         }
         //构造用户信息
@@ -135,7 +135,7 @@ public class LoginServiceImpl implements IRegisterLoginService {
         //创建用户信息
         userService.save(user);
         gameUserService.createGameUser(user);
-        callBackService.userCallBack(user);
+//        callBackService.userCallBack(user);
         //返回登录信息
         if (fromUserId == null) {
             return ResultVO.ok(this.createUserLoginVO(user, userData));
@@ -194,12 +194,12 @@ public class LoginServiceImpl implements IRegisterLoginService {
                 return ResultVO.fail(checkRegisterEnum.getMsg());
             }
             //创建用户信息
-            Long agentId = promoChannelService.getAgentIdByChannel(userData.getChannel());
+            Long agentId = agentService.getAgentIdByChannel(userData.getChannel());
             user = transform(userData, agentId, username);
             user.setPassword(password);
             userService.save(user);
             gameUserService.createGameUser(user);
-            callBackService.userCallBack(user);
+//            callBackService.userCallBack(user);
         }
         //返回登录信息
         return ResultVO.ok(this.createUserLoginVO(user, userData));
@@ -224,12 +224,12 @@ public class LoginServiceImpl implements IRegisterLoginService {
                 .eq(User::getGameId, userData.getGameId()).eq(User::getMobile, mobile));
         //用户信息不存在, 直接注册
         if (user == null) {
-            Long agentId = promoChannelService.getAgentIdByChannel(userData.getChannel());
+            Long agentId = agentService.getAgentIdByChannel(userData.getChannel());
             user = transform(userData, agentId, mobile);
             user.setMobile(mobile);
             userService.save(user);
             gameUserService.createGameUser(user);
-            callBackService.userCallBack(user);
+//            callBackService.userCallBack(user);
         } else {
             //判断账号是否停用
             if (Objects.equals(BanStatusEnum.BAN_STATUS.getStatus(), user.getStatus())) {
@@ -303,7 +303,8 @@ public class LoginServiceImpl implements IRegisterLoginService {
     private User transform(UserData userData, Long agentId, String userName) {
         //构造用户信息
         return User.builder()
-                .agentId(agentId)
+                .regAgentId(agentId)
+                .lastAgentId(agentId)
                 .gameId(userData.getGameId())
                 .username(userName)
                 .nickname(RegisterUtil.randomNickName(userName))