Jelajahi Sumber

运营后台和普通用户的登录分开

liuchengsen 1 bulan lalu
induk
melakukan
4b073f5e05

+ 0 - 38
zhijiayun-gateway/src/main/resources/db/schema.sql

@@ -473,34 +473,6 @@ CREATE TABLE IF NOT EXISTS `t_platform_config` (
     KEY `idx_enabled` (`enabled`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='平台配置表';
 
--- 体验配额配置表
-CREATE TABLE IF NOT EXISTS `t_trial_quota_config` (
-    `id`                        BIGINT        NOT NULL AUTO_INCREMENT COMMENT '主键ID',
-    `config_name`               VARCHAR(100)  NOT NULL COMMENT '配置名称',
-    `trial_days`                INT           DEFAULT 15 COMMENT '体验天数',
-    `daily_query_limit`         INT           DEFAULT 20 COMMENT '每日查询次数',
-    `monthly_watchlist_limit`   INT           DEFAULT 199 COMMENT '每月关注品种数',
-    `enabled`                   TINYINT(1)    DEFAULT 1 COMMENT '是否启用',
-    `config_type`               VARCHAR(20)   DEFAULT 'DEFAULT' COMMENT '配置类型:DEFAULT/COUPON/ACTIVITY',
-    `applicable_user_type`      VARCHAR(20)   DEFAULT 'NEW_USER' COMMENT '适用用户类型:NEW_USER/ALL',
-    `effective_from`            DATETIME      DEFAULT NULL COMMENT '生效开始时间',
-    `effective_to`              DATETIME      DEFAULT NULL COMMENT '生效结束时间',
-    `max_users`                 INT           DEFAULT NULL COMMENT '最大使用人数',
-    `current_users`             INT           DEFAULT 0 COMMENT '当前已使用人数',
-    `priority`                  INT           DEFAULT 0 COMMENT '优先级',
-    `description`               VARCHAR(500)  DEFAULT NULL COMMENT '配置说明',
-    `remark`                    VARCHAR(500)  DEFAULT NULL COMMENT '备注',
-    `created_by`                BIGINT        DEFAULT NULL COMMENT '创建人ID',
-    `updated_by`                BIGINT        DEFAULT NULL COMMENT '更新人ID',
-    `create_time`               DATETIME      DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    `update_time`               DATETIME      DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
-    PRIMARY KEY (`id`),
-    UNIQUE KEY `uk_config_name` (`config_name`),
-    KEY `idx_config_type` (`config_type`),
-    KEY `idx_enabled` (`enabled`),
-    KEY `idx_effective_time` (`effective_from`, `effective_to`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='体验配额配置表';
-
 -- ============================================
 -- 操作审计日志表
 -- ============================================
@@ -620,16 +592,6 @@ ON DUPLICATE KEY UPDATE
     `description` = VALUES(`description`),
     `official_url` = VALUES(`official_url`);
 
--- 初始化默认体验配额配置
-INSERT INTO `t_trial_quota_config` (`config_name`, `trial_days`, `daily_query_limit`, `monthly_watchlist_limit`, `enabled`, `config_type`, `applicable_user_type`, `description`)
-VALUES
-    ('新用户默认体验', 15, 20, 199, 1, 'DEFAULT', 'NEW_USER', '新用户注册后自动获得的体验配额')
-ON DUPLICATE KEY UPDATE
-    `trial_days`              = VALUES(`trial_days`),
-    `daily_query_limit`       = VALUES(`daily_query_limit`),
-    `monthly_watchlist_limit` = VALUES(`monthly_watchlist_limit`),
-    `enabled`                 = VALUES(`enabled`),
-    `description`             = VALUES(`description`);
 
 -- 初始化邀请配置(邀请人30天高级会员,被邀请人30天高级会员,总邀请上限30人)
 INSERT INTO `t_invite_config` (`id`, `reward_type`, `reward_months`, `reward_crawler_count`, `max_daily_reward`, `invite_code_expire_days`, `max_invite_per_day`, `max_total_invites`, `landing_title`, `landing_desc`, `app_name`, `status`)

+ 1 - 1
zhijiayun-gateway/src/test/java/com/xuekairui/gateway/GatewayBaseTest.java

@@ -69,7 +69,7 @@ public abstract class GatewayBaseTest {
             // TRUNCATE 业务表,重置 auto_increment 计数器
             String[] tables = {
                 "t_payment_order_extra_payment", "t_payment_order", "t_payment_plan",
-                "t_watchlist", "t_operation_audit_log", "t_trial_quota_config",
+                "t_watchlist", "t_operation_audit_log",
                 "t_business_license", "t_platform_account", "t_platform_config",
                 "t_crawler_quota_grant", "t_crawler_usage_log",
                 "t_invite_relation", "t_invite_code", "t_invite_config",

+ 0 - 264
zhijiayun-gateway/src/test/java/com/xuekairui/gateway/TrialQuotaConfigTest.java

@@ -1,264 +0,0 @@
-package com.xuekairui.gateway;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.jupiter.api.*;
-import org.springframework.http.MediaType;
-import org.springframework.test.web.servlet.MvcResult;
-
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
-
-/**
- * 体验配额配置接口测试
- * 覆盖:用户端获取活跃配置、运营端CRUD管理、权限校验
- */
-@DisplayName("体验配额配置接口测试")
-@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
-class TrialQuotaConfigTest extends GatewayBaseTest {
-
-    private static final ObjectMapper mapper = new ObjectMapper();
-    /** 动态捕获的配置 ID,避免依赖 auto_increment 顺序 */
-    private static Long createdConfigId;
-    private static Long activityConfigId;
-    private static Long deleteConfigId;
-
-    private String adminToken() {
-        return generateAccessToken(100L, "13900000000", "ADMIN");
-    }
-
-    // ==================== 用户端:获取活跃配置 ====================
-
-    @Test
-    @Order(1)
-    @DisplayName("GET /api/trial-quota/active - 获取活跃体验配额配置(公开接口)")
-    void getActiveConfig_shouldReturnConfig() throws Exception {
-        mockMvc.perform(get("/api/trial-quota/active"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").isNumber());
-    }
-
-    // ==================== 运营端:查询配置列表 ====================
-
-    @Test
-    @Order(10)
-    @DisplayName("GET /api/admin/trial-quota/configs - 查询配置列表")
-    void listConfigs_shouldReturnList() throws Exception {
-        mockMvc.perform(get("/api/admin/trial-quota/configs")
-                        .header("Authorization", "Bearer " + adminToken()))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data").isArray());
-    }
-
-    @Test
-    @Order(11)
-    @DisplayName("GET /api/admin/trial-quota/configs - 无Token应返回401")
-    void listConfigs_withoutToken_shouldReturn401() throws Exception {
-        mockMvc.perform(get("/api/admin/trial-quota/configs"))
-                .andExpect(status().isUnauthorized());
-    }
-
-    // ==================== 运营端:创建配置 ====================
-
-    @Test
-    @Order(20)
-    @DisplayName("POST /api/admin/trial-quota/config - 创建体验配额配置")
-    void createConfig_shouldSucceed() throws Exception {
-        String body = """
-                {
-                    "configName": "测试体验配置",
-                    "trialDays": 15,
-                    "dailyQueryLimit": 30,
-                    "monthlyWatchlistLimit": 200,
-                    "enabled": true,
-                    "configType": "DEFAULT",
-                    "applicableUserType": "NEW_USER",
-                    "priority": 1,
-                    "description": "自动化测试创建的配置"
-                }
-                """;
-        MvcResult result = mockMvc.perform(post("/api/admin/trial-quota/config")
-                        .header("Authorization", "Bearer " + adminToken())
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content(body))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data.id").isNumber())
-                .andExpect(jsonPath("$.data.configName").value("测试体验配置"))
-                .andExpect(jsonPath("$.data.trialDays").value(15))
-                .andExpect(jsonPath("$.data.dailyQueryLimit").value(30))
-                .andReturn();
-        createdConfigId = mapper.readTree(result.getResponse().getContentAsString())
-                .get("data").get("id").asLong();
-    }
-
-    @Test
-    @Order(21)
-    @DisplayName("POST /api/admin/trial-quota/config - 创建活动类型配置")
-    void createConfig_activityType_shouldSucceed() throws Exception {
-        String body = """
-                {
-                    "configName": "618活动体验配置",
-                    "trialDays": 30,
-                    "dailyQueryLimit": 50,
-                    "monthlyWatchlistLimit": 500,
-                    "enabled": true,
-                    "configType": "ACTIVITY",
-                    "applicableUserType": "ALL",
-                    "priority": 10,
-                    "maxUsers": 1000,
-                    "description": "618活动专属体验配置"
-                }
-                """;
-        MvcResult result = mockMvc.perform(post("/api/admin/trial-quota/config")
-                        .header("Authorization", "Bearer " + adminToken())
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content(body))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data.configName").value("618活动体验配置"))
-                .andExpect(jsonPath("$.data.configType").value("ACTIVITY"))
-                .andExpect(jsonPath("$.data.maxUsers").value(1000))
-                .andReturn();
-        activityConfigId = mapper.readTree(result.getResponse().getContentAsString())
-                .get("data").get("id").asLong();
-    }
-
-    @Test
-    @Order(22)
-    @DisplayName("POST /api/admin/trial-quota/config - 无Token应返回401")
-    void createConfig_withoutToken_shouldReturn401() throws Exception {
-        mockMvc.perform(post("/api/admin/trial-quota/config")
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content("{}"))
-                .andExpect(status().isUnauthorized());
-    }
-
-    // ==================== 运营端:更新配置 ====================
-
-    @Test
-    @Order(30)
-    @DisplayName("PUT /api/admin/trial-quota/config/{id} - 更新配置")
-    void updateConfig_shouldSucceed() throws Exception {
-        String body = """
-                {
-                    "configName": "测试体验配置(已更新)",
-                    "trialDays": 20,
-                    "dailyQueryLimit": 40,
-                    "monthlyWatchlistLimit": 300,
-                    "enabled": true,
-                    "configType": "DEFAULT",
-                    "applicableUserType": "NEW_USER",
-                    "priority": 2,
-                    "description": "更新后的配置"
-                }
-                """;
-        mockMvc.perform(put("/api/admin/trial-quota/config/" + createdConfigId)
-                        .header("Authorization", "Bearer " + adminToken())
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content(body))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data.configName").value("测试体验配置(已更新)"))
-                .andExpect(jsonPath("$.data.trialDays").value(20));
-    }
-
-    @Test
-    @Order(31)
-    @DisplayName("PUT /api/admin/trial-quota/config/{id} - 更新不存在的配置应返回404")
-    void updateConfig_nonExistent_shouldReturn404() throws Exception {
-        String body = """
-                {
-                    "configName": "不存在的配置",
-                    "trialDays": 15,
-                    "dailyQueryLimit": 20,
-                    "monthlyWatchlistLimit": 100,
-                    "enabled": true,
-                    "configType": "DEFAULT",
-                    "applicableUserType": "NEW_USER"
-                }
-                """;
-        mockMvc.perform(put("/api/admin/trial-quota/config/9999")
-                        .header("Authorization", "Bearer " + adminToken())
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content(body))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(404));
-    }
-
-    @Test
-    @Order(32)
-    @DisplayName("PUT /api/admin/trial-quota/config/{id} - 无Token应返回401")
-    void updateConfig_withoutToken_shouldReturn401() throws Exception {
-        mockMvc.perform(put("/api/admin/trial-quota/config/" + createdConfigId)
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content("{}"))
-                .andExpect(status().isUnauthorized());
-    }
-
-    // ==================== 运营端:删除配置 ====================
-
-    @Test
-    @Order(40)
-    @DisplayName("DELETE /api/admin/trial-quota/config/{id} - 删除配置")
-    void deleteConfig_shouldSucceed() throws Exception {
-        // 先创建一个新配置用来删除
-        String createBody = """
-                {
-                    "configName": "待删除配置",
-                    "trialDays": 7,
-                    "dailyQueryLimit": 10,
-                    "monthlyWatchlistLimit": 50,
-                    "enabled": true,
-                    "configType": "COUPON",
-                    "applicableUserType": "NEW_USER",
-                    "priority": 99,
-                    "description": "此配置将被删除"
-                }
-                """;
-        MvcResult createResult = mockMvc.perform(post("/api/admin/trial-quota/config")
-                        .header("Authorization", "Bearer " + adminToken())
-                        .contentType(MediaType.APPLICATION_JSON)
-                        .content(createBody))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.id").isNumber())
-                .andReturn();
-        deleteConfigId = mapper.readTree(createResult.getResponse().getContentAsString())
-                .get("data").get("id").asLong();
-
-        // 删除该配置
-        mockMvc.perform(delete("/api/admin/trial-quota/config/" + deleteConfigId)
-                        .header("Authorization", "Bearer " + adminToken()))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200));
-    }
-
-    @Test
-    @Order(41)
-    @DisplayName("DELETE /api/admin/trial-quota/config/{id} - 删除不存在的配置应返回404")
-    void deleteConfig_nonExistent_shouldReturn404() throws Exception {
-        mockMvc.perform(delete("/api/admin/trial-quota/config/9999")
-                        .header("Authorization", "Bearer " + adminToken()))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(404));
-    }
-
-    @Test
-    @Order(42)
-    @DisplayName("DELETE /api/admin/trial-quota/config/{id} - 无Token应返回401")
-    void deleteConfig_withoutToken_shouldReturn401() throws Exception {
-        mockMvc.perform(delete("/api/admin/trial-quota/config/" + createdConfigId))
-                .andExpect(status().isUnauthorized());
-    }
-
-    // ==================== 边界场景 ====================
-
-    @Test
-    @Order(50)
-    @DisplayName("GET /api/trial-quota/active - 无Token也可访问(公开接口)")
-    void getActiveConfig_noAuth_shouldBeAccessible() throws Exception {
-        mockMvc.perform(get("/api/trial-quota/active"))
-                .andExpect(status().isOk());
-    }
-}

+ 0 - 24
zhijiayun-gateway/src/test/resources/test-schema.sql

@@ -6,7 +6,6 @@
 -- DROP TABLE IF EXISTS t_payment_plan;
 -- DROP TABLE IF EXISTS t_watchlist;
 -- DROP TABLE IF EXISTS t_operation_audit_log;
--- DROP TABLE IF EXISTS t_trial_quota_config;
 -- DROP TABLE IF EXISTS t_business_license;
 -- DROP TABLE IF EXISTS t_platform_account;
 -- DROP TABLE IF EXISTS t_platform_config;
@@ -447,29 +446,6 @@ CREATE TABLE IF NOT EXISTS t_operation_audit_log (
     INDEX idx_operation_time (operation_time)
 );
 
--- 体验配额配置表
-CREATE TABLE IF NOT EXISTS t_trial_quota_config (
-    id                      BIGINT AUTO_INCREMENT PRIMARY KEY,
-    config_name             VARCHAR(64)   NOT NULL,
-    trial_days              INT           NOT NULL DEFAULT 15,
-    daily_query_limit       INT           NOT NULL DEFAULT 20,
-    monthly_watchlist_limit INT           NOT NULL DEFAULT 199,
-    enabled                 TINYINT(1)    NOT NULL DEFAULT 1,
-    priority                INT           NOT NULL DEFAULT 0,
-    config_type             VARCHAR(16)   NOT NULL DEFAULT 'DEFAULT',
-    applicable_user_type    VARCHAR(16)   NOT NULL DEFAULT 'NEW_USER',
-    effective_from          TIMESTAMP     DEFAULT NULL,
-    effective_to            TIMESTAMP     DEFAULT NULL,
-    max_users               INT           DEFAULT NULL,
-    current_users           INT           NOT NULL DEFAULT 0,
-    description             VARCHAR(256)  DEFAULT NULL,
-    remark                  VARCHAR(256)  DEFAULT NULL,
-    created_by              BIGINT        DEFAULT NULL,
-    updated_by              BIGINT        DEFAULT NULL,
-    create_time             TIMESTAMP     DEFAULT CURRENT_TIMESTAMP,
-    update_time             TIMESTAMP     DEFAULT CURRENT_TIMESTAMP
-);
-
 -- 初始化会员权益配置
 INSERT IGNORE INTO t_membership_benefit (level, benefit_type, benefit_value, description, status)
 VALUES

+ 0 - 1
zhijiayun-user/src/main/java/com/xuekairui/user/config/SecurityConfig.java

@@ -46,7 +46,6 @@ public class SecurityConfig {
             "/api/invite/resolve-link",  // 解析邀请链接/邀请码(公开)
             "/invite/**",                // 浏览器直接访问邀请链接(公开)
             "/api/platform-config/**",   // 平台配置查询(公开)
-            "/api/trial-quota/**",       // 体验配额配置查询(公开)
             "/api/search/suggestions",   // 搜索建议(公开)
             "/api/payment/callback/**",  // 支付回调(公开,供微信/支付宝调用)
             "/api/payment/anxin/notify/**",  // 安心付通知(公开,供支付宝调用)

+ 0 - 69
zhijiayun-user/src/main/java/com/xuekairui/user/controller/AdminTrialQuotaConfigController.java

@@ -1,69 +0,0 @@
-package com.xuekairui.user.controller;
-
-import com.xuekairui.common.Result;
-import com.xuekairui.user.entity.TrialQuotaConfig;
-import com.xuekairui.user.enums.OperationType;
-import com.xuekairui.user.service.OperationAuditLogService;
-import com.xuekairui.user.service.TrialQuotaConfigService;
-import jakarta.servlet.http.HttpServletRequest;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 体验配额配置管理接口(运营端)
- */
-@RestController
-@RequestMapping("/api/admin/trial-quota")
-@RequiredArgsConstructor
-public class AdminTrialQuotaConfigController {
-
-    private final TrialQuotaConfigService trialQuotaConfigService;
-    private final OperationAuditLogService auditLogService;
-
-    @GetMapping("/configs")
-    public Result<List<TrialQuotaConfig>> listConfigs() {
-        return Result.success(trialQuotaConfigService.listConfigs());
-    }
-
-    @PostMapping("/config")
-    public Result<TrialQuotaConfig> createConfig(
-            @RequestBody TrialQuotaConfig config,
-            HttpServletRequest httpRequest) {
-        Long operatorId = (Long) httpRequest.getAttribute("userId");
-        String operatorRole = getOperatorRole(httpRequest);
-        TrialQuotaConfig created = trialQuotaConfigService.createConfig(config, operatorId);
-        auditLogService.logSuccess(operatorId, "管理员", operatorRole, OperationType.TRIAL_CONFIG_CREATE,
-                "TRIAL_CONFIG:" + created.getId(), created.getId());
-        return Result.success(created);
-    }
-
-    @PutMapping("/config/{id}")
-    public Result<TrialQuotaConfig> updateConfig(
-            @PathVariable Long id,
-            @RequestBody TrialQuotaConfig config,
-            HttpServletRequest httpRequest) {
-        Long operatorId = (Long) httpRequest.getAttribute("userId");
-        String operatorRole = getOperatorRole(httpRequest);
-        TrialQuotaConfig updated = trialQuotaConfigService.updateConfig(id, config, operatorId);
-        auditLogService.logSuccess(operatorId, "管理员", operatorRole, OperationType.TRIAL_CONFIG_UPDATE,
-                "TRIAL_CONFIG:" + id, id);
-        return Result.success(updated);
-    }
-
-    @DeleteMapping("/config/{id}")
-    public Result<Void> deleteConfig(@PathVariable Long id, HttpServletRequest httpRequest) {
-        Long operatorId = (Long) httpRequest.getAttribute("userId");
-        String operatorRole = getOperatorRole(httpRequest);
-        trialQuotaConfigService.deleteConfig(id);
-        auditLogService.logSuccess(operatorId != null ? operatorId : 0L, "管理员", operatorRole,
-                OperationType.TRIAL_CONFIG_DELETE, "TRIAL_CONFIG:" + id, id);
-        return Result.success();
-    }
-
-    private String getOperatorRole(HttpServletRequest request) {
-        String role = (String) request.getAttribute("role");
-        return role != null ? role : "ADMIN";
-    }
-}

+ 0 - 25
zhijiayun-user/src/main/java/com/xuekairui/user/controller/TrialQuotaConfigController.java

@@ -1,25 +0,0 @@
-package com.xuekairui.user.controller;
-
-import com.xuekairui.common.Result;
-import com.xuekairui.user.entity.TrialQuotaConfig;
-import com.xuekairui.user.service.TrialQuotaConfigService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 体验配额配置接口(用户端)
- */
-@RestController
-@RequestMapping("/api/trial-quota")
-@RequiredArgsConstructor
-public class TrialQuotaConfigController {
-
-    private final TrialQuotaConfigService trialQuotaConfigService;
-
-    @GetMapping("/active")
-    public Result<TrialQuotaConfig> getActiveConfig() {
-        return Result.success(trialQuotaConfigService.getActiveConfig());
-    }
-}

+ 0 - 104
zhijiayun-user/src/main/java/com/xuekairui/user/entity/TrialQuotaConfig.java

@@ -1,104 +0,0 @@
-package com.xuekairui.user.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.time.LocalDateTime;
-
-/**
- * 体验配额配置实体(运营可动态配置)
- * 
- * 功能说明:
- * 1. 运营可以配置新用户的体验天数(默认15天)
- * 2. 运营可以配置体验用户每日查询次数限制
- * 3. 运营可以配置体验用户每月关注品种数限制
- * 4. 支持创建体验券批次,批量发放
- * 
- * @author ProPrice Team
- * @since 2026-06-16
- */
-@Data
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-@TableName("t_trial_quota_config")
-public class TrialQuotaConfig {
-    
-    /** 主键ID */
-    @TableId(type = IdType.AUTO)
-    private Long id;
-    
-    /** 配置名称(如:默认体验配置、活动体验配置) */
-    @TableField("config_name")
-    private String configName;
-    
-    /** 体验天数(默认15天) */
-    @TableField("trial_days")
-    private Integer trialDays;
-    
-    /** 每日查询次数限制(默认20次) */
-    @TableField("daily_query_limit")
-    private Integer dailyQueryLimit;
-    
-    /** 每月关注品种数限制(默认199种) */
-    @TableField("monthly_watchlist_limit")
-    private Integer monthlyWatchlistLimit;
-    
-    /** 是否启用 */
-    @TableField("enabled")
-    private Boolean enabled;
-    
-    /** 配置类型:DEFAULT-默认配置, COUPON-体验券配置, ACTIVITY-活动配置 */
-    @TableField("config_type")
-    private String configType;
-    
-    /** 适用用户等级:NEW_USER-新用户, ALL-所有用户 */
-    @TableField("applicable_user_type")
-    private String applicableUserType;
-    
-    /** 生效开始时间(null表示立即生效) */
-    @TableField("effective_from")
-    private LocalDateTime effectiveFrom;
-    
-    /** 生效结束时间(null表示长期有效) */
-    @TableField("effective_to")
-    private LocalDateTime effectiveTo;
-    
-    /** 最大使用人数(null表示无限制) */
-    @TableField("max_users")
-    private Integer maxUsers;
-    
-    /** 当前已使用人数 */
-    @TableField("current_users")
-    private Integer currentUsers;
-
-    /** 优先级 */
-    private Integer priority;
-
-    /** 配置说明 */
-    @TableField("description")
-    private String description;
-    
-    /** 备注 */
-    @TableField("remark")
-    private String remark;
-    
-    /** 创建人ID */
-    @TableField("created_by")
-    private Long createdBy;
-    
-    /** 更新人ID */
-    @TableField("updated_by")
-    private Long updatedBy;
-    
-    /** 创建时间 */
-    @TableField(value = "create_time", fill = FieldFill.INSERT)
-    private LocalDateTime createTime;
-    
-    /** 更新时间 */
-    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
-    private LocalDateTime updateTime;
-}

+ 0 - 31
zhijiayun-user/src/main/java/com/xuekairui/user/mapper/TrialQuotaConfigMapper.java

@@ -1,31 +0,0 @@
-package com.xuekairui.user.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xuekairui.user.entity.TrialQuotaConfig;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-/**
- * 体验配额配置Mapper
- */
-@Mapper
-public interface TrialQuotaConfigMapper extends BaseMapper<TrialQuotaConfig> {
-
-    /**
-     * 查询当前生效的默认配置
-     */
-    @Select("SELECT * FROM t_trial_quota_config WHERE config_type = 'DEFAULT' AND enabled = true " +
-            "AND (effective_from IS NULL OR effective_from <= #{now}) " +
-            "AND (effective_to IS NULL OR effective_to >= #{now}) " +
-            "ORDER BY create_time DESC LIMIT 1")
-    TrialQuotaConfig selectActiveDefaultConfig(LocalDateTime now);
-
-    /**
-     * 查询所有启用的配置
-     */
-    @Select("SELECT * FROM t_trial_quota_config WHERE enabled = true ORDER BY priority ASC")
-    List<TrialQuotaConfig> selectEnabledConfigs();
-}

+ 0 - 63
zhijiayun-user/src/main/java/com/xuekairui/user/service/TrialQuotaConfigService.java

@@ -1,63 +0,0 @@
-package com.xuekairui.user.service;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.xuekairui.common.BusinessException;
-import com.xuekairui.user.entity.TrialQuotaConfig;
-import com.xuekairui.user.mapper.TrialQuotaConfigMapper;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class TrialQuotaConfigService {
-
-    private final TrialQuotaConfigMapper trialQuotaConfigMapper;
-
-    public TrialQuotaConfig getActiveConfig() {
-        TrialQuotaConfig config = trialQuotaConfigMapper.selectActiveDefaultConfig(LocalDateTime.now());
-        if (config == null) {
-            throw new BusinessException(404, "无生效中的体验配额配置");
-        }
-        return config;
-    }
-
-    public List<TrialQuotaConfig> listConfigs() {
-        return trialQuotaConfigMapper.selectList(
-                new LambdaQueryWrapper<TrialQuotaConfig>()
-                        .orderByDesc(TrialQuotaConfig::getCreateTime));
-    }
-
-    public TrialQuotaConfig createConfig(TrialQuotaConfig config, Long operatorId) {
-        config.setCreatedBy(operatorId);
-        config.setUpdatedBy(operatorId);
-        config.setCurrentUsers(0);
-        trialQuotaConfigMapper.insert(config);
-        log.info("创建体验配额配置: id={}, name={}", config.getId(), config.getConfigName());
-        return config;
-    }
-
-    public TrialQuotaConfig updateConfig(Long id, TrialQuotaConfig config, Long operatorId) {
-        TrialQuotaConfig existing = trialQuotaConfigMapper.selectById(id);
-        if (existing == null) {
-            throw new BusinessException(404, "体验配额配置不存在");
-        }
-        config.setId(id);
-        config.setUpdatedBy(operatorId);
-        trialQuotaConfigMapper.updateById(config);
-        return trialQuotaConfigMapper.selectById(id);
-    }
-
-    public void deleteConfig(Long id) {
-        TrialQuotaConfig existing = trialQuotaConfigMapper.selectById(id);
-        if (existing == null) {
-            throw new BusinessException(404, "体验配额配置不存在");
-        }
-        trialQuotaConfigMapper.deleteById(id);
-        log.info("删除体验配额配置: id={}", id);
-    }
-}