Browse Source

后台配置基本完成

xudm 2 months ago
parent
commit
4d94a2a1e5
27 changed files with 906 additions and 57 deletions
  1. 16 0
      continew-module-system/src/main/java/top/continew/admin/business/mapper/AirdropRecordMapper.java
  2. 16 0
      continew-module-system/src/main/java/top/continew/admin/business/mapper/TeamInviteConfigMapper.java
  3. 12 1
      continew-module-system/src/main/java/top/continew/admin/business/mapper/TgUserMapper.java
  4. 83 0
      continew-module-system/src/main/java/top/continew/admin/business/model/entity/AirdropRecord.java
  5. 67 0
      continew-module-system/src/main/java/top/continew/admin/business/model/entity/TeamInviteConfig.java
  6. 0 29
      continew-module-system/src/main/java/top/continew/admin/business/model/entity/TgUser.java
  7. 26 0
      continew-module-system/src/main/java/top/continew/admin/business/model/query/TeamInviteConfigQuery.java
  8. 28 0
      continew-module-system/src/main/java/top/continew/admin/business/model/query/TgUserQuery.java
  9. 24 0
      continew-module-system/src/main/java/top/continew/admin/business/model/req/AirdropManagerReq.java
  10. 45 0
      continew-module-system/src/main/java/top/continew/admin/business/model/req/TeamInviteConfigReq.java
  11. 97 14
      continew-module-system/src/main/java/top/continew/admin/business/model/req/TgUserReq.java
  12. 15 0
      continew-module-system/src/main/java/top/continew/admin/business/service/AirdropManagerService.java
  13. 16 0
      continew-module-system/src/main/java/top/continew/admin/business/service/IAirdropRecordService.java
  14. 43 0
      continew-module-system/src/main/java/top/continew/admin/business/service/ITeamInviteConfigService.java
  15. 23 2
      continew-module-system/src/main/java/top/continew/admin/business/service/ITgUserService.java
  16. 56 0
      continew-module-system/src/main/java/top/continew/admin/business/service/Impl/AirdropManagerServiceImpl.java
  17. 20 0
      continew-module-system/src/main/java/top/continew/admin/business/service/Impl/AirdropRecordServiceImpl.java
  18. 2 0
      continew-module-system/src/main/java/top/continew/admin/business/service/Impl/TaskInfoServiceImpl.java
  19. 60 0
      continew-module-system/src/main/java/top/continew/admin/business/service/Impl/TeamInviteConfigServiceImpl.java
  20. 27 1
      continew-module-system/src/main/java/top/continew/admin/business/service/Impl/TgUserServiceImpl.java
  21. 21 0
      continew-module-system/src/main/resources/mapper/AirdropRecordMapper.xml
  22. 20 0
      continew-module-system/src/main/resources/mapper/TeamInviteConfigMapper.xml
  23. 56 5
      continew-module-system/src/main/resources/mapper/TgUserMapper.xml
  24. 22 0
      continew-webapi/src/main/java/top/continew/admin/controller/business/AirdropManagerController.java
  25. 1 1
      continew-webapi/src/main/java/top/continew/admin/controller/business/TaskInfoController.java
  26. 76 0
      continew-webapi/src/main/java/top/continew/admin/controller/business/TeamInviteConfigController.java
  27. 34 4
      continew-webapi/src/main/java/top/continew/admin/controller/business/TgUserController.java

+ 16 - 0
continew-module-system/src/main/java/top/continew/admin/business/mapper/AirdropRecordMapper.java

@@ -0,0 +1,16 @@
+package top.continew.admin.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import top.continew.admin.business.model.entity.AirdropRecord;
+
+/**
+ * <p>
+ * 空投记录 Mapper 接口
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-17
+ */
+public interface AirdropRecordMapper extends BaseMapper<AirdropRecord> {
+
+}

+ 16 - 0
continew-module-system/src/main/java/top/continew/admin/business/mapper/TeamInviteConfigMapper.java

@@ -0,0 +1,16 @@
+package top.continew.admin.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import top.continew.admin.business.model.entity.TeamInviteConfig;
+
+/**
+ * <p>
+ * 团队邀请配置 Mapper 接口
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-16
+ */
+public interface TeamInviteConfigMapper extends BaseMapper<TeamInviteConfig> {
+
+}

+ 12 - 1
continew-module-system/src/main/java/top/continew/admin/business/mapper/TgUserMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import top.continew.admin.business.model.entity.TgUser;
+import top.continew.admin.business.model.query.TgUserQuery;
 import top.continew.admin.business.model.req.TgUserReq;
 
 import java.util.List;
@@ -18,5 +19,15 @@ import java.util.List;
  */
 public interface TgUserMapper extends BaseMapper<TgUser> {
 
-    List<TgUser> getTgUserOfPage(@Param("query") TgUserReq query, Page page);
+    List<TgUser> getTgUserOfPage(@Param("query") TgUserQuery query, Page page);
+
+    /**
+     * 查询团队用户
+     *
+     * @param id       用户id
+     * @param teamType 团队类型
+     * @return
+     */
+    List<TgUser> getMyTeamUserListByType(@Param("userId") Long id, @Param("teamType") String teamType);
+
 }

+ 83 - 0
continew-module-system/src/main/java/top/continew/admin/business/model/entity/AirdropRecord.java

@@ -0,0 +1,83 @@
+package top.continew.admin.business.model.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 空投记录
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-17
+ */
+@Getter
+@Setter
+@TableName("b_airdrop_record")
+public class AirdropRecord extends Model<AirdropRecord> {
+
+    /**
+     * 主键
+     */
+    @TableField("id")
+    private Long id;
+
+    /**
+     * 空投目标人
+     */
+    @TableField("target_user")
+    private Long targetUser;
+
+    /**
+     * 空投金币数量
+     */
+    @TableField("gold_coin_num")
+    private Integer goldCoinNum;
+
+    /**
+     * 空投前金币数量
+     */
+    @TableField("pre_drop_num")
+    private Integer preDropNum;
+
+    /**
+     * 空投后金币数量
+     */
+    @TableField("post_drop_num")
+    private Integer postDropNum;
+
+    /**
+     * 空投时间
+     */
+    @TableField("airdrop_time")
+    private LocalDateTime airdropTime;
+
+    /**
+     * 操作类型【0 新增空投 1 减去空投】
+     */
+    @TableField("operation_type")
+    private Integer operationType;
+
+    /**
+     * 创建人
+     */
+    @TableField("created_by")
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField("created_time")
+    private LocalDateTime createdTime;
+
+    @Override
+    public Serializable pkVal() {
+        return null;
+    }
+}

+ 67 - 0
continew-module-system/src/main/java/top/continew/admin/business/model/entity/TeamInviteConfig.java

@@ -0,0 +1,67 @@
+package top.continew.admin.business.model.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 团队邀请配置
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-16
+ */
+@Getter
+@Setter
+@TableName("b_team_invite_config")
+public class TeamInviteConfig extends Model<TeamInviteConfig> {
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private Long id;
+
+    /**
+     * A队抽成比例 百分比 0.01
+     */
+    @TableField("team_a_scale")
+    private String teamAScale;
+
+    /**
+     * B队抽成比例 百分比 0.01
+     */
+    @TableField("team_b_scale")
+    private String teamBScale;
+
+    /**
+     * 邀请一人金币奖励
+     */
+    @TableField("Invite_one_reward")
+    private Integer inviteOneReward;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private LocalDateTime createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private LocalDateTime updateTime;
+
+    @Override
+    public Serializable pkVal() {
+        return this.id;
+    }
+}

+ 0 - 29
continew-module-system/src/main/java/top/continew/admin/business/model/entity/TgUser.java

@@ -184,30 +184,6 @@ public class TgUser extends Model<TgUser> {
     @TableField("referrer_id")
     private String referrerId;
 
-    /**
-     * 0单独可奖励1已经奖励
-     */
-    @TableField("invite_reward")
-    private Integer inviteReward;
-
-    /**
-     * 是否是新注册用户: [1-是, 0-否]
-     */
-    @TableField("new_user_flag")
-    private Integer newUserFlag;
-
-    /**
-     * 历史钥匙数量
-     */
-    @TableField("history_key")
-    private Integer historyKey;
-
-    /**
-     * 钥匙数量
-     */
-    @TableField("key_num")
-    private Integer keyNum;
-
     /**
      * 空投数量
      */
@@ -226,11 +202,6 @@ public class TgUser extends Model<TgUser> {
     @TableField("gold_coin_total_his")
     private BigDecimal goldCoinTotalHis;
 
-    /**
-     * 该用户每10s生产的金币数量
-     */
-    @TableField("development_gold_coin")
-    private Integer developmentGoldCoin;
 
     /**
      * 在线时间 单位秒

+ 26 - 0
continew-module-system/src/main/java/top/continew/admin/business/model/query/TeamInviteConfigQuery.java

@@ -0,0 +1,26 @@
+package top.continew.admin.business.model.query;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 团队邀请配置
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-16
+ */
+@Getter
+@Setter
+@Schema(description = "团队邀请配置查询参数")
+public class TeamInviteConfigQuery {
+
+    @Schema(description = "页码")
+    private int page;
+
+    @Schema(description = "页大小")
+    private int size;
+}

+ 28 - 0
continew-module-system/src/main/java/top/continew/admin/business/model/query/TgUserQuery.java

@@ -0,0 +1,28 @@
+package top.continew.admin.business.model.query;
+
+import cn.hutool.core.date.DatePattern;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@Schema(description = "tg用户信息查询")
+public class TgUserQuery implements Serializable {
+
+    @Schema(description = "用户昵称")
+    private String userName;
+
+    @Schema(description = "当前页码")
+    private int page;
+
+    @Schema(description = "注册时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59")
+    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
+    private List<Date> time;
+
+    @Schema(description = "页大小")
+    private int size;
+}

+ 24 - 0
continew-module-system/src/main/java/top/continew/admin/business/model/req/AirdropManagerReq.java

@@ -0,0 +1,24 @@
+package top.continew.admin.business.model.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@Schema(description = "创建或修改空投参数")
+public class AirdropManagerReq implements Serializable {
+
+    @Schema(description = "空投目标人")
+    @NotNull(message = "空投目标用户不能为空")
+    private Long targetUser;
+
+    @Schema(description = "空投金币数量")
+    @NotNull(message = "空投金币数量不能为空")
+    private Integer goldCoinNum;
+
+    @Schema(description = "操作类型【0 新增空投 1 减去空投】")
+    @NotNull(message = "操作类型不能为空")
+    private Integer operationType;
+}

+ 45 - 0
continew-module-system/src/main/java/top/continew/admin/business/model/req/TeamInviteConfigReq.java

@@ -0,0 +1,45 @@
+package top.continew.admin.business.model.req;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 团队邀请配置
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-16
+ */
+@Getter
+@Setter
+@Schema(description = "团队邀请配置新增或修改参数")
+public class TeamInviteConfigReq {
+
+    /**
+     * A队抽成比例 百分比 0.01
+     */
+    @Schema(description = "A队抽成比例", example = "0.02")
+    private String teamAScale;
+
+    /**
+     * B队抽成比例 百分比 0.01
+     */
+    @Schema(description = "B队抽成比例", example = "0.01")
+    private String teamBScale;
+
+    /**
+     * 邀请一人金币奖励
+     */
+    @Schema(description = "邀请一人金币奖励", example = "1000")
+    private Integer inviteOneReward;
+}

+ 97 - 14
continew-module-system/src/main/java/top/continew/admin/business/model/req/TgUserReq.java

@@ -1,29 +1,112 @@
 package top.continew.admin.business.model.req;
 
-import cn.hutool.core.date.DatePattern;
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
+import java.math.BigDecimal;
 
 @Data
-@Schema(description = "tg用户信息查询")
+@Schema(description = "tg用户信息修改参数")
 public class TgUserReq implements Serializable {
+//    /**
+//     * tg小程序id
+//     */
+//    @TableField("tg小程序id")
+//    private String tgId;
+//
+//    /**
+//     * tg账号
+//     */
+//    @TableField("tg账号")
+//    private String tgAccount;
 
-    @Schema(description = "用户昵称")
-    private String userName;
+    /**
+     * 名
+     */
+    @TableField("名")
+    private String firstName;
 
-    @Schema(description = "注册时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59")
-    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
-    private List<Date> time;
+    /**
+     * 姓
+     */
+    @TableField("姓")
+    private String lastName;
 
+    /**
+     * 昵称
+     */
+    @TableField("昵称")
+    private String nickname;
 
-    @Schema(description = "当前页码")
-    private int page;
+    /**
+     * 真实姓名
+     */
+    @TableField("真实姓名")
+    private String realName;
+
+    /**
+     * 头像
+     */
+    @TableField("头像")
+    private String avatar;
+
+    /**
+     * 用户的语言的编码
+     */
+    @TableField("用户的语言的编码")
+    private String languageCode;
+
+    /**
+     * 钱包地址
+     */
+    @TableField("钱包地址")
+    private String walletAddress;
+
+
+    /**
+     * 币账户进入的唯一标识地址
+     */
+    @TableField("币账户进入的唯一标识地址")
+    private String coinAddress;
+
+    /**
+     * 用户电话
+     */
+    @TableField("用户电话")
+    private String mobile;
+
+    /**
+     * 用户性别: [1=男, 2=女]
+     */
+    @TableField("用户性别")
+    private String sex;
+
+
+    /**
+     * 空投数量
+     */
+    @TableField("空投数量")
+    private Integer airdropCoin;
+
+    /**
+     * 金币余额
+     */
+    @TableField("金币余额")
+    private BigDecimal goldCoinAmount;
+
+    /**
+     * 金币总数量
+     */
+    @TableField("金币总数量")
+    private BigDecimal goldCoinTotalHis;
+
+
+    /**
+     * 用户余额
+     */
+    @TableField("用户余额")
+    private BigDecimal userAmount;
 
-    @Schema(description = "页大小")
-    private int size;
 }

+ 15 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/AirdropManagerService.java

@@ -0,0 +1,15 @@
+package top.continew.admin.business.service;
+
+import top.continew.admin.business.model.req.AirdropManagerReq;
+
+/**
+ * 空投管理服务
+ */
+public interface AirdropManagerService {
+    /**
+     * 空投管理
+     *
+     * @param req
+     */
+    void airdropManager(AirdropManagerReq req);
+}

+ 16 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/IAirdropRecordService.java

@@ -0,0 +1,16 @@
+package top.continew.admin.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import top.continew.admin.business.model.entity.AirdropRecord;
+
+/**
+ * <p>
+ * 空投记录 服务类
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-17
+ */
+public interface IAirdropRecordService extends IService<AirdropRecord> {
+
+}

+ 43 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/ITeamInviteConfigService.java

@@ -0,0 +1,43 @@
+package top.continew.admin.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import top.continew.admin.business.model.entity.TeamInviteConfig;
+import top.continew.admin.business.model.query.TeamInviteConfigQuery;
+import top.continew.admin.business.model.req.TeamInviteConfigReq;
+import top.continew.starter.extension.crud.model.resp.BasePageResp;
+
+/**
+ * <p>
+ * 团队邀请配置 服务类
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-16
+ */
+public interface ITeamInviteConfigService extends IService<TeamInviteConfig> {
+
+    /**
+     * 分页查询团队邀请配置
+     *
+     * @param query
+     * @return
+     */
+    BasePageResp<TeamInviteConfig> getTeamInviteConfigPage(TeamInviteConfigQuery query);
+
+    /**
+     * 更新队邀请配置
+     *
+     * @param id
+     * @param req
+     */
+    void updateTeamInviteConfig(Long id, TeamInviteConfigReq req);
+
+    /**
+     * 新增队邀请配置
+     *
+     * @param req
+     * @return
+     */
+    Long addTeamInviteConfig(TeamInviteConfigReq req);
+
+}

+ 23 - 2
continew-module-system/src/main/java/top/continew/admin/business/service/ITgUserService.java

@@ -2,9 +2,12 @@ package top.continew.admin.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import top.continew.admin.business.model.entity.TgUser;
+import top.continew.admin.business.model.query.TgUserQuery;
 import top.continew.admin.business.model.req.TgUserReq;
 import top.continew.starter.extension.crud.model.resp.PageResp;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -18,10 +21,28 @@ public interface ITgUserService extends IService<TgUser> {
     /**
      * tg小程序用户登录
      *
-     * @param appLoginReq
+     * @param query
      * @return
      */
-    PageResp<TgUser> pageQuery(TgUserReq appLoginReq);
+    PageResp<TgUser> pageQuery(TgUserQuery query);
+
+
+    void disableTgUserByIds(List<Long> ids);
 
+    /**
+     * 查询团队成员列表
+     *
+     * @param id       tg用户id
+     * @param teamType 团队类型 A B
+     * @return
+     */
+    List<TgUser> getMyTeamUserListByType(Long id, String teamType);
 
+    /**
+     * 更新tg用户的信息
+     *
+     * @param id
+     * @param req
+     */
+    void updateTgUserInfo(Long id, TgUserReq req);
 }

+ 56 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/Impl/AirdropManagerServiceImpl.java

@@ -0,0 +1,56 @@
+package top.continew.admin.business.service.Impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import top.continew.admin.business.model.entity.AirdropRecord;
+import top.continew.admin.business.model.entity.TgUser;
+import top.continew.admin.business.model.req.AirdropManagerReq;
+import top.continew.admin.business.service.AirdropManagerService;
+import top.continew.admin.business.service.IAirdropRecordService;
+import top.continew.admin.business.service.ITgUserService;
+import top.continew.starter.core.validation.CheckUtils;
+
+import java.time.LocalDateTime;
+
+@Service
+@AllArgsConstructor
+@Slf4j
+public class AirdropManagerServiceImpl implements AirdropManagerService {
+    private final IAirdropRecordService recordService;
+    private final ITgUserService userService;
+
+    @Override
+    @Transactional
+    public void airdropManager(AirdropManagerReq req) {
+        Object loginId = StpUtil.getLoginId();
+        TgUser user = userService.getById(req.getTargetUser());
+        CheckUtils.throwIfNull(user, "空投目标用户为空");
+
+        Integer goldCoinNum = req.getGoldCoinNum();
+        Integer airdropCoin = user.getAirdropCoin();
+        Integer preDropNum = user.getAirdropCoin();
+
+        //用户表新增或者减去空投金币数量
+        if (req.getOperationType().equals(1)) {
+            airdropCoin -= goldCoinNum;
+        } else {
+            airdropCoin += goldCoinNum;
+        }
+        user.setAirdropCoin(airdropCoin);
+        //记录操作日志
+        AirdropRecord record = new AirdropRecord();
+        record.setAirdropTime(LocalDateTime.now());
+        record.setTargetUser(user.getId());
+        record.setPreDropNum(preDropNum);
+        record.setPostDropNum(airdropCoin);
+        record.setGoldCoinNum(goldCoinNum);
+        record.setCreatedBy(String.valueOf(loginId));
+        record.setCreatedTime(LocalDateTime.now());
+        //同时更新
+        userService.updateById(user);
+        recordService.save(record);
+    }
+}

+ 20 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/Impl/AirdropRecordServiceImpl.java

@@ -0,0 +1,20 @@
+package top.continew.admin.business.service.Impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import top.continew.admin.business.mapper.AirdropRecordMapper;
+import top.continew.admin.business.model.entity.AirdropRecord;
+import top.continew.admin.business.service.IAirdropRecordService;
+
+/**
+ * <p>
+ * 空投记录 服务实现类
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-17
+ */
+@Service
+public class AirdropRecordServiceImpl extends ServiceImpl<AirdropRecordMapper, AirdropRecord> implements IAirdropRecordService {
+
+}

+ 2 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/Impl/TaskInfoServiceImpl.java

@@ -13,6 +13,7 @@ import top.continew.admin.business.model.entity.TaskInfo;
 import top.continew.admin.business.model.query.TaskInfoQuery;
 import top.continew.admin.business.model.req.TaskInfoReq;
 import top.continew.admin.business.service.ITaskInfoService;
+import top.continew.starter.core.validation.CheckUtils;
 import top.continew.starter.extension.crud.model.resp.BasePageResp;
 import top.continew.starter.extension.crud.model.resp.PageResp;
 
@@ -50,6 +51,7 @@ public class TaskInfoServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo> i
     public void updatetaskInfo(Long id, TaskInfoReq req) {
         Object loginId = StpUtil.getLoginId();
         TaskInfo byId = getById(id);
+        CheckUtils.throwIfNull(byId, "任务信息为空,更新失败");
         BeanUtils.copyProperties(req, byId);
         byId.setUpdateBy(String.valueOf(loginId));
         byId.setUpdatedTime(LocalDateTime.now());

+ 60 - 0
continew-module-system/src/main/java/top/continew/admin/business/service/Impl/TeamInviteConfigServiceImpl.java

@@ -0,0 +1,60 @@
+package top.continew.admin.business.service.Impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import top.continew.admin.business.mapper.TeamInviteConfigMapper;
+import top.continew.admin.business.model.entity.TaskInfo;
+import top.continew.admin.business.model.entity.TeamInviteConfig;
+import top.continew.admin.business.model.query.TeamInviteConfigQuery;
+import top.continew.admin.business.model.req.TeamInviteConfigReq;
+import top.continew.admin.business.service.ITeamInviteConfigService;
+import top.continew.starter.core.validation.CheckUtils;
+import top.continew.starter.extension.crud.model.resp.BasePageResp;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 团队邀请配置 服务实现类
+ * </p>
+ *
+ * @author xudm
+ * @since 2024-12-16
+ */
+@Service
+public class TeamInviteConfigServiceImpl extends ServiceImpl<TeamInviteConfigMapper, TeamInviteConfig> implements ITeamInviteConfigService {
+
+    @Override
+    public BasePageResp<TeamInviteConfig> getTeamInviteConfigPage(TeamInviteConfigQuery query) {
+        Page<TeamInviteConfig> page = new Page<>();
+        page.setCurrent(query.getPage() != 0 ? query.getPage() : 1);
+        page.setSize(query.getSize() != 0 ? query.getSize() : 10);
+        LambdaQueryWrapper<TeamInviteConfig> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.orderByDesc(TeamInviteConfig::getCreateTime);
+        page = page(page, queryWrapper);
+        return PageResp.build(page, TeamInviteConfig.class);
+    }
+
+    @Override
+    public void updateTeamInviteConfig(Long id, TeamInviteConfigReq req) {
+        TeamInviteConfig byId = getById(id);
+        CheckUtils.throwIfNull(byId, "团队配置信息为空,更新失败");
+        BeanUtils.copyProperties(req, byId);
+        byId.setUpdateTime(LocalDateTime.now());
+        updateById(byId);
+    }
+
+    @Override
+    public Long addTeamInviteConfig(TeamInviteConfigReq req) {
+        TeamInviteConfig teamInviteConfig = new TeamInviteConfig();
+        BeanUtils.copyProperties(req, teamInviteConfig);
+        teamInviteConfig.setCreateTime(LocalDateTime.now());
+        teamInviteConfig.setUpdateTime(LocalDateTime.now());
+        save(teamInviteConfig);
+        return teamInviteConfig.getId();
+    }
+}

+ 27 - 1
continew-module-system/src/main/java/top/continew/admin/business/service/Impl/TgUserServiceImpl.java

@@ -2,13 +2,16 @@ package top.continew.admin.business.service.Impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import top.continew.admin.business.mapper.TgUserMapper;
 import top.continew.admin.business.model.entity.TgUser;
+import top.continew.admin.business.model.query.TgUserQuery;
 import top.continew.admin.business.model.req.TgUserReq;
 import top.continew.admin.business.service.ITgUserService;
 import top.continew.starter.extension.crud.model.resp.PageResp;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -22,7 +25,7 @@ import java.util.List;
 @Service
 public class TgUserServiceImpl extends ServiceImpl<TgUserMapper, TgUser> implements ITgUserService {
     @Override
-    public PageResp<TgUser> pageQuery(TgUserReq queryVo) {
+    public PageResp<TgUser> pageQuery(TgUserQuery queryVo) {
         Page<TgUser> page = new Page<>();
         page.setCurrent(queryVo.getPage() != 0 ? queryVo.getPage() : 1);
         page.setSize(queryVo.getSize() != 0 ? queryVo.getSize() : 10);
@@ -31,4 +34,27 @@ public class TgUserServiceImpl extends ServiceImpl<TgUserMapper, TgUser> impleme
         page.setRecords(tgUserOfPage);
         return PageResp.build(page, TgUser.class);
     }
+
+    @Override
+    public void disableTgUserByIds(List<Long> ids) {
+        List<TgUser> tgUsers = listByIds(ids);
+        tgUsers.forEach(u -> {
+            u.setDisableFlag(1);
+            u.setUpdatedTime(LocalDateTime.now());
+        });
+        getBaseMapper().updateById(tgUsers);
+    }
+
+    @Override
+    public List<TgUser> getMyTeamUserListByType(Long id, String teamType) {
+        return getBaseMapper().getMyTeamUserListByType(id, teamType);
+    }
+
+    @Override
+    public void updateTgUserInfo(Long id, TgUserReq req) {
+        TgUser byId = getById(id);
+        BeanUtils.copyProperties(req, byId);
+        byId.setUpdatedTime(LocalDateTime.now());
+        getBaseMapper().updateById(byId);
+    }
 }

+ 21 - 0
continew-module-system/src/main/resources/mapper/AirdropRecordMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="top.continew.admin.business.mapper.AirdropRecordMapper">
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="top.continew.admin.business.model.entity.AirdropRecord">
+        <result column="id" property="id"/>
+        <result column="target_user" property="targetUser"/>
+        <result column="gold_coin_num" property="goldCoinNum"/>
+        <result column="pre_drop_num" property="preDropNum"/>
+        <result column="post_drop_num" property="postDropNum"/>
+        <result column="airdrop_time" property="airdropTime"/>
+        <result column="operation_type" property="operationType"/>
+        <result column="created_by" property="createdBy"/>
+        <result column="created_time" property="createdTime"/>
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, target_user, gold_coin_num, pre_drop_num, post_drop_num, airdrop_time, operation_type, created_by, created_time
+    </sql>
+</mapper>

+ 20 - 0
continew-module-system/src/main/resources/mapper/TeamInviteConfigMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="top.continew.admin.business.mapper.TeamInviteConfigMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="top.continew.admin.business.model.entity.TeamInviteConfig">
+        <id column="id" property="id" />
+        <result column="team_a_scale" property="teamAScale" />
+        <result column="team_b_scale" property="teamBScale" />
+        <result column="Invite_one_reward" property="inviteOneReward" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, team_a_scale, team_b_scale, Invite_one_reward, create_time, update_time
+    </sql>
+
+</mapper>

+ 56 - 5
continew-module-system/src/main/resources/mapper/TgUserMapper.xml

@@ -29,14 +29,9 @@
         <result column="sex" property="sex"/>
         <result column="invite_code" property="inviteCode"/>
         <result column="referrer_id" property="referrerId"/>
-        <result column="invite_reward" property="inviteReward"/>
-        <result column="new_user_flag" property="newUserFlag"/>
-        <result column="history_key" property="historyKey"/>
-        <result column="key_num" property="keyNum"/>
         <result column="airdrop_coin" property="airdropCoin"/>
         <result column="gold_coin_amount" property="goldCoinAmount"/>
         <result column="gold_coin_total_his" property="goldCoinTotalHis"/>
-        <result column="development_gold_coin" property="developmentGoldCoin"/>
         <result column="online_time" property="onlineTime"/>
         <result column="user_amount" property="userAmount"/>
         <result column="created_time" property="createdTime"/>
@@ -72,4 +67,60 @@
         </where>
         order by tu.created_time desc
     </select>
+
+    <select id="getMyTeamUserListByType" resultMap="BaseResultMap">
+        WITH RECURSIVE team_hierarchy AS (
+            -- A队:直接被你邀请的用户
+            SELECT id,
+                   tg_id,
+                   tg_account,
+                   first_name,
+                   last_name,
+                   nickname,
+                   real_name,
+                   avatar,
+                   passenger_flow_way,
+                   referrer_id,
+                   created_time,
+                   'A' as team_type,
+                   1   as level
+            FROM b_tg_user
+            WHERE referrer_id = '{#userId}'
+
+            UNION ALL
+
+            -- B队:被A队邀请的用户
+            SELECT u.id,
+                   u.tg_id,
+                   u.tg_account,
+                   u.first_name,
+                   u.last_name,
+                   u.nickname,
+                   u.real_name,
+                   u.avatar,
+                   u.passenger_flow_way,
+                   u.referrer_id,
+                   u.created_time,
+                   'B' as team_type,
+                   h.level + 1
+            FROM b_tg_user u
+                     JOIN team_hierarchy h ON u.referrer_id = h.id
+            WHERE h.level = 1 -- 只获取A队成员邀请的用户
+        )
+
+        SELECT id,
+               tg_id,
+               tg_account,
+               first_name,
+               last_name,
+               nickname,
+               real_name,
+               avatar,
+               passenger_flow_way,
+               referrer_id,
+               team_type
+        FROM team_hierarchy
+        where team_type = '#{teamType}'
+        ORDER BY created_time desc
+    </select>
 </mapper>

+ 22 - 0
continew-webapi/src/main/java/top/continew/admin/controller/business/AirdropManagerController.java

@@ -0,0 +1,22 @@
+package top.continew.admin.controller.business;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+
+import lombok.AllArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import top.continew.admin.business.model.req.AirdropManagerReq;
+import top.continew.admin.business.service.AirdropManagerService;
+
+@RestController
+@Tag(name = "空投管理")
+@RequestMapping("airdrop/manager")
+@AllArgsConstructor
+public class AirdropManagerController {
+    private final AirdropManagerService airdropManagerService;
+
+    @PutMapping()
+    public void airdropManager(@RequestBody @Validated AirdropManagerReq req) {
+        airdropManagerService.airdropManager(req);
+    }
+}

+ 1 - 1
continew-webapi/src/main/java/top/continew/admin/controller/business/TaskInfoController.java

@@ -38,7 +38,7 @@ public class TaskInfoController {
             example = "1,2,3,4",
             in = ParameterIn.PATH
     )
-    List<TaskInfo> getInviteRewardsRuleByIds(@PathVariable("ids") List<Long> ids) {
+    public List<TaskInfo> getInviteRewardsRuleByIds(@PathVariable("ids") List<Long> ids) {
         return taskInfoService.listByIds(ids);
     }
 

+ 76 - 0
continew-webapi/src/main/java/top/continew/admin/controller/business/TeamInviteConfigController.java

@@ -0,0 +1,76 @@
+package top.continew.admin.controller.business;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+import top.continew.admin.business.model.entity.TeamInviteConfig;
+import top.continew.admin.business.model.query.TeamInviteConfigQuery;
+import top.continew.admin.business.model.req.TeamInviteConfigReq;
+import top.continew.admin.business.service.ITeamInviteConfigService;
+import top.continew.starter.extension.crud.model.resp.BaseIdResp;
+import top.continew.starter.extension.crud.model.resp.BasePageResp;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/team/config")
+@AllArgsConstructor
+@Tag(name = "团队邀请配置API")
+public class TeamInviteConfigController {
+    private final ITeamInviteConfigService teamInviteConfigService;
+
+    @Operation(summary = "分页查询", description = "分页查询")
+    @GetMapping("/page")
+    BasePageResp<TeamInviteConfig> page(TeamInviteConfigQuery query) {
+        return teamInviteConfigService.getTeamInviteConfigPage(query);
+    }
+
+
+    @Operation(summary = "查询详情", description = "查询详情")
+    @GetMapping("/{ids}")
+    @Parameter(
+            name = "ids",
+            description = "ids",
+            example = "1,2,3,4",
+            in = ParameterIn.PATH
+    )
+    List<TeamInviteConfig> getInviteRewardsRuleByIds(@PathVariable("ids") List<Long> ids) {
+        return teamInviteConfigService.listByIds(ids);
+    }
+
+
+    @Operation(summary = "修改数据", description = "修改数据")
+    @Parameter(
+            name = "id",
+            description = "ID",
+            example = "1",
+            in = ParameterIn.PATH
+    )
+    @PutMapping({"/{id}"})
+    //@Validated({CrudValidationGroup.Update.class})
+    public void update(@RequestBody TeamInviteConfigReq req, @PathVariable("id") Long id) {
+        this.teamInviteConfigService.updateTeamInviteConfig(id, req);
+    }
+
+    @Operation(
+            summary = "删除数据",
+            description = "删除数据"
+    )
+    @DeleteMapping({"/{ids}"})
+    public void delete(@PathVariable("ids") List<Long> ids) {
+        this.teamInviteConfigService.removeByIds(ids);
+    }
+
+
+    @Operation(
+            summary = "新增数据",
+            description = "新增数据"
+    )
+    @PostMapping
+    public BaseIdResp<Long> add(@RequestBody TeamInviteConfigReq req) {
+        return new BaseIdResp<>(teamInviteConfigService.addTeamInviteConfig(req));
+    }
+}

+ 34 - 4
continew-webapi/src/main/java/top/continew/admin/controller/business/TgUserController.java

@@ -1,15 +1,20 @@
 package top.continew.admin.controller.business;
 
 import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import top.continew.admin.business.model.entity.TgUser;
+import top.continew.admin.business.model.query.TgUserQuery;
 import top.continew.admin.business.model.req.TgUserReq;
 import top.continew.admin.business.service.ITgUserService;
 import top.continew.starter.extension.crud.model.resp.BasePageResp;
 
+import java.util.List;
+
 @RestController()
 @RequestMapping("/tgUser")
 @AllArgsConstructor
@@ -19,7 +24,32 @@ public class TgUserController {
 
     @RequestMapping("/getTgUserList")
     @Operation(summary = "获取tg用户列表", description = "获取tg用户列表")
-    public BasePageResp<TgUser> getTgUserList(TgUserReq req) {
-        return userService.pageQuery(req);
+    public BasePageResp<TgUser> getTgUserList(TgUserQuery query) {
+        return userService.pageQuery(query);
+    }
+
+    @Operation(summary = "修改数据", description = "修改数据")
+    @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
+    @PutMapping({"/{id}"})
+    //@Validated({CrudValidationGroup.Update.class})
+    public void update(@RequestBody TgUserReq req, @PathVariable("id") Long id) {
+        this.userService.updateTgUserInfo(id, req);
+    }
+
+    @Operation(summary = "禁用账号", description = "禁用账号")
+    @GetMapping("/disable/{ids}")
+    @Parameter(name = "ids", description = "ids", example = "1,2,3,4", in = ParameterIn.PATH)
+    public void disableTgUser(@PathVariable("ids") List<Long> ids) {
+        userService.disableTgUserByIds(ids);
+    }
+
+    @Operation(summary = "获取团队成员列表", description = "获取团队成员列表")
+    @GetMapping("/getMyTeamUserList/{id}")
+    @Parameters({
+            @Parameter(name = "id", description = "用户id", example = "10004", in = ParameterIn.PATH),
+            @Parameter(name = "teamType", description = "团队类型", example = "A", in = ParameterIn.QUERY)
+    })
+    public List<TgUser> getMyTeamUserList(@PathVariable("id") Long id, @RequestParam("teamType") String teamType) {
+        return userService.getMyTeamUserListByType(id, teamType);
     }
 }