diff --git a/docs/后台管理bug整理/BUG汇总清单.md b/docs/后台管理bug整理/BUG汇总清单.md index c7b8d535..d8f21e64 100644 --- a/docs/后台管理bug整理/BUG汇总清单.md +++ b/docs/后台管理bug整理/BUG汇总清单.md @@ -1,17 +1,17 @@ # 后台管理系统 BUG 汇总清单 -> 版本: v1.0.0 | 更新时间: 2026-01-20 +> 版本: v1.0.0 | 更新时间: 2026-01-21 ## 统计概览 | 模块 | BUG数量 | 已修复 | 未修复 | |------|---------|--------|--------| | 统计报表 | 2 | **2** | 0 | -| 商品管理 | 3 | 0 | 3 | +| 商品管理 | 3 | **3** | 0 | | 订单管理 | 4 | **4** | 0 | -| 营销活动 | 3 | 0 | 3 | -| 内容管理 | 1 | 0 | 1 | -| **合计** | **13** | **6** | **7** | +| 营销活动 | 3 | **3** | 0 | +| 内容管理 | 1 | **1** | 0 | +| **合计** | **13** | **13** | **0** | ## BUG 列表 @@ -26,9 +26,9 @@ | 编号 | 问题描述 | 严重程度 | 状态 | |------|----------|----------|------| -| cs100_4 | 盒子管理,盒子类型为"全部"时搜索无结果 | 高 | 未修改 | -| cs100_5 | 编辑/新增盒子,开启"自动下架配置"后无法设置参数 | 中 | 未修改 | -| cs100_6 | 奖品管理,奖品等级、分类显示为空值 | 中 | 未修改 | +| cs100_4 | 盒子管理,盒子类型为"全部"时搜索无结果 | 高 | 已修复 | +| cs100_5 | 编辑/新增盒子,开启"自动下架配置"后无法设置参数 | 中 | 已修复 | +| cs100_6 | 奖品管理,奖品等级、分类显示为空值 | 中 | 已修复 | ### 订单管理模块 @@ -43,15 +43,15 @@ | 编号 | 问题描述 | 严重程度 | 状态 | |------|----------|----------|------| -| cs100_11 | 领取记录,根据用户ID搜索提示请求失败 | 高 | 未修改 | -| cs100_13 | 周榜记录,提示"服务器内部错误" | 高 | 未修改 | -| cs100_14 | 月榜记录,提示"服务器内部错误" | 高 | 未修改 | +| cs100_11 | 领取记录,根据用户ID搜索提示请求失败 | 高 | 已修复 | +| cs100_13 | 周榜记录,提示"服务器内部错误" | 高 | 已修复 | +| cs100_14 | 月榜记录,提示"服务器内部错误" | 高 | 已修复 | ### 内容管理模块 | 编号 | 问题描述 | 严重程度 | 状态 | |------|----------|----------|------| -| cs100_15 | 单页管理,文章内容显示H5代码而非渲染内容 | 中 | 未修改 | +| cs100_15 | 单页管理,文章内容显示H5代码而非渲染内容 | 中 | 已修复 | ## 问题分类 diff --git a/server/HoneyBox/scripts/create_goods_collections.sql b/server/HoneyBox/scripts/create_goods_collections.sql new file mode 100644 index 00000000..b8364f6f --- /dev/null +++ b/server/HoneyBox/scripts/create_goods_collections.sql @@ -0,0 +1,35 @@ +-- 创建 goods_collections 表(商品收藏表) +-- 用于存储用户收藏的商品信息 + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[goods_collections]') AND type in (N'U')) +BEGIN + CREATE TABLE [dbo].[goods_collections] ( + [id] INT IDENTITY(1,1) NOT NULL, + [user_id] INT NOT NULL, + [goods_id] INT NOT NULL, + [num] INT NOT NULL DEFAULT 0, + [type] TINYINT NOT NULL DEFAULT 1, + [created_at] DATETIME2 NOT NULL DEFAULT GETDATE(), + CONSTRAINT [pk_goods_collections] PRIMARY KEY CLUSTERED ([id] ASC) + ); + + -- 创建索引 + CREATE NONCLUSTERED INDEX [ix_goods_collections_user_id] ON [dbo].[goods_collections] ([user_id] ASC); + CREATE NONCLUSTERED INDEX [ix_goods_collections_goods_id] ON [dbo].[goods_collections] ([goods_id] ASC); + CREATE UNIQUE NONCLUSTERED INDEX [uk_goods_collections_user_goods_num] ON [dbo].[goods_collections] ([user_id] ASC, [goods_id] ASC, [num] ASC); + + PRINT 'Table goods_collections created successfully.'; +END +ELSE +BEGIN + PRINT 'Table goods_collections already exists.'; +END +GO + +-- 添加表注释 +EXEC sp_addextendedproperty + @name = N'MS_Description', + @value = N'商品收藏表,存储用户收藏的商品信息', + @level0type = N'SCHEMA', @level0name = N'dbo', + @level1type = N'TABLE', @level1name = N'goods_collections'; +GO diff --git a/server/HoneyBox/scripts/create_rank_tables.sql b/server/HoneyBox/scripts/create_rank_tables.sql new file mode 100644 index 00000000..e67a6c9c --- /dev/null +++ b/server/HoneyBox/scripts/create_rank_tables.sql @@ -0,0 +1,68 @@ +-- 创建周榜和月榜中奖记录表 +-- 用于修复 BUG cs100_13 和 cs100_14 + +-- 创建周榜中奖记录表 +IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'rank_week') +BEGIN + CREATE TABLE rank_week ( + id INT IDENTITY(1,1) NOT NULL, + user_id INT NOT NULL DEFAULT 0, + [rank] INT NOT NULL DEFAULT 0, + money DECIMAL(10, 2) NOT NULL DEFAULT 0.00, + week_time NVARCHAR(100) NULL, + addtime INT NOT NULL DEFAULT 0, + order_list_id INT NOT NULL DEFAULT 0, + prize_title NVARCHAR(255) NULL, + prize_imgurl NVARCHAR(255) NULL, + CONSTRAINT pk_rank_week PRIMARY KEY (id) + ); + + CREATE INDEX ix_rank_week_user_id ON rank_week(user_id); + + PRINT N'创建周榜中奖记录表 rank_week 成功'; +END +ELSE +BEGIN + PRINT N'周榜中奖记录表 rank_week 已存在'; +END +GO + +-- 创建月榜中奖记录表 +IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'rank_month') +BEGIN + CREATE TABLE rank_month ( + id INT IDENTITY(1,1) NOT NULL, + user_id INT NOT NULL DEFAULT 0, + [rank] INT NOT NULL DEFAULT 0, + money DECIMAL(10, 2) NOT NULL DEFAULT 0.00, + month_time NVARCHAR(100) NULL, + addtime INT NOT NULL DEFAULT 0, + order_list_id INT NOT NULL DEFAULT 0, + prize_title NVARCHAR(255) NULL, + prize_imgurl NVARCHAR(255) NULL, + CONSTRAINT pk_rank_month PRIMARY KEY (id) + ); + + CREATE INDEX ix_rank_month_user_id ON rank_month(user_id); + + PRINT N'创建月榜中奖记录表 rank_month 成功'; +END +ELSE +BEGIN + PRINT N'月榜中奖记录表 rank_month 已存在'; +END +GO + +-- 添加表注释 +EXEC sp_addextendedproperty + @name = N'MS_Description', + @value = N'周榜中奖记录表', + @level0type = N'SCHEMA', @level0name = N'dbo', + @level1type = N'TABLE', @level1name = N'rank_week'; + +EXEC sp_addextendedproperty + @name = N'MS_Description', + @value = N'月榜中奖记录表', + @level0type = N'SCHEMA', @level0name = N'dbo', + @level1type = N'TABLE', @level1name = N'rank_month'; +GO diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/CouponController.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/CouponController.cs index 7eda9707..d3bd830d 100644 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/CouponController.cs +++ b/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/CouponController.cs @@ -143,5 +143,14 @@ public class CouponController : BusinessControllerBase { return Error(ex.Code, ex.Message); } + catch (Exception ex) + { + // 捕获数据库表不存在等异常 + if (ex.Message.Contains("Invalid object name") || ex.InnerException?.Message.Contains("Invalid object name") == true) + { + return Error(BusinessErrorCodes.InternalError, "优惠券领取记录表尚未创建,请先执行数据库迁移脚本"); + } + throw; + } } } diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/RankController.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/RankController.cs index 1b488d0b..59fd31af 100644 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/RankController.cs +++ b/server/HoneyBox/src/HoneyBox.Admin.Business/Controllers/RankController.cs @@ -144,6 +144,15 @@ public class RankController : BusinessControllerBase { return Error(ex.Code, ex.Message); } + catch (Exception ex) + { + // 捕获数据库表不存在等异常 + if (ex.Message.Contains("Invalid object name") || ex.InnerException?.Message.Contains("Invalid object name") == true) + { + return Error(BusinessErrorCodes.InternalError, "周榜记录表尚未创建,请先执行数据库迁移脚本"); + } + throw; + } } #endregion @@ -273,6 +282,15 @@ public class RankController : BusinessControllerBase { return Error(ex.Code, ex.Message); } + catch (Exception ex) + { + // 捕获数据库表不存在等异常 + if (ex.Message.Contains("Invalid object name") || ex.InnerException?.Message.Contains("Invalid object name") == true) + { + return Error(BusinessErrorCodes.InternalError, "月榜记录表尚未创建,请先执行数据库迁移脚本"); + } + throw; + } } #endregion diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Goods/GoodsModels.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Goods/GoodsModels.cs index 4b8abe30..02e20e94 100644 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Goods/GoodsModels.cs +++ b/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Goods/GoodsModels.cs @@ -159,6 +159,26 @@ public class GoodsCreateRequest /// 灵珠翻倍 /// public int LingzhuFan { get; set; } + + /// + /// 是否自动下架 0-否 1-是 + /// + public int IsAutoXiajia { get; set; } + + /// + /// 下架利润值(%) + /// + public decimal XiajiaLirun { get; set; } + + /// + /// 下架抽数阈值 + /// + public int XiajiaAutoCoushu { get; set; } + + /// + /// 下架金额 + /// + public decimal XiajiaJine { get; set; } } /// diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/GetPresignedUrlRequest.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/GetPresignedUrlRequest.cs deleted file mode 100644 index 4b683a8c..00000000 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/GetPresignedUrlRequest.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace HoneyBox.Admin.Business.Models.Upload; - -public class GetPresignedUrlRequest -{ - public string? FileName { get; set; } - public string? ContentType { get; set; } - public int ExpiresInSeconds { get; set; } = 600; - public long FileSize { get; set; } -} diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/PresignedUrlResponse.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/PresignedUrlResponse.cs deleted file mode 100644 index ce24e238..00000000 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/PresignedUrlResponse.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace HoneyBox.Admin.Business.Models.Upload; - -public class PresignedUrlResponse -{ - public string? UploadUrl { get; set; } - public string? AccessUrl { get; set; } - public string? FileUrl { get; set; } - public string? ObjectKey { get; set; } - public DateTime ExpiresAt { get; set; } - public int ExpiresIn { get; set; } - public string? StorageType { get; set; } - public Dictionary? Headers { get; set; } -} diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/UploadResponse.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/UploadResponse.cs deleted file mode 100644 index 2f1bf3e0..00000000 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/UploadResponse.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace HoneyBox.Admin.Business.Models.Upload; - -public class UploadResponse -{ - public string? Url { get; set; } - public string? FileName { get; set; } - public long Size { get; set; } - public long FileSize { get; set; } - public string? ContentType { get; set; } -} diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/UploadResult.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/UploadResult.cs deleted file mode 100644 index 47bf8ff6..00000000 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Models/Upload/UploadResult.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace HoneyBox.Admin.Business.Models.Upload; - -public class UploadResult -{ - public bool Success { get; set; } - public string? Url { get; set; } - public string? ErrorMessage { get; set; } - - public static UploadResult Ok(string url) - { - return new UploadResult - { - Success = true, - Url = url - }; - } - - public static UploadResult Fail(string errorMessage) - { - return new UploadResult - { - Success = false, - ErrorMessage = errorMessage - }; - } -} diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Services/GoodsService.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Services/GoodsService.cs index 65924c40..97e4e350 100644 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Services/GoodsService.cs +++ b/server/HoneyBox/src/HoneyBox.Admin.Business/Services/GoodsService.cs @@ -120,6 +120,10 @@ public class GoodsService : IGoodsService Rage = request.Rage, LingzhuIs = (byte)request.LingzhuIs, LingzhuFan = request.LingzhuFan, + IsAutoXiajia = (byte)request.IsAutoXiajia, + XiajiaLirun = (int)request.XiajiaLirun, + XiajiaAutoCoushu = (int)request.XiajiaAutoCoushu, + XiajiaJine = (int)request.XiajiaJine, Status = 0, // 默认下架 PrizeNum = 0, IsFlw = (byte)(request.Type == 15 ? 1 : 0), @@ -194,6 +198,10 @@ public class GoodsService : IGoodsService goods.Rage = request.Rage; goods.LingzhuIs = (byte)request.LingzhuIs; goods.LingzhuFan = request.LingzhuFan; + goods.IsAutoXiajia = (byte)request.IsAutoXiajia; + goods.XiajiaLirun = (int)request.XiajiaLirun; + goods.XiajiaAutoCoushu = (int)request.XiajiaAutoCoushu; + goods.XiajiaJine = (int)request.XiajiaJine; goods.IsFlw = (byte)(request.Type == 15 ? 1 : 0); goods.UpdatedAt = DateTime.Now; @@ -612,7 +620,8 @@ public class GoodsService : IGoodsService query = query.Where(g => g.Status == request.Status.Value); } - if (request.Type.HasValue) + // 只有当 Type 有值且大于0时才过滤(0表示"全部") + if (request.Type.HasValue && request.Type.Value > 0) { query = query.Where(g => g.Type == request.Type.Value); } diff --git a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/api/business/goods.ts b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/api/business/goods.ts index 6d8b884e..7ecdab4b 100644 --- a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/api/business/goods.ts +++ b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/api/business/goods.ts @@ -119,6 +119,10 @@ export interface GoodsCreateRequest { rage: number lingzhuIs: number lingzhuFan: number + isAutoXiajia?: number + xiajiaLirun?: number + xiajiaAutoCoushu?: number + xiajiaJine?: number } /** 更新盒子请求 */ diff --git a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/utils/request.ts b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/utils/request.ts index 5a1b1649..c4e15524 100644 --- a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/utils/request.ts +++ b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/utils/request.ts @@ -219,7 +219,8 @@ service.interceptors.response.use( ElMessage.error('请求的资源不存在') break case 500: - ElMessage.error('服务器内部错误') + // 优先显示后端返回的错误信息 + ElMessage.error(data?.message || '服务器内部错误') break default: ElMessage.error(data?.message || '请求失败') diff --git a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/danye/components/DanyeFormDialog.vue b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/danye/components/DanyeFormDialog.vue index bae7b24f..d15e2902 100644 --- a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/danye/components/DanyeFormDialog.vue +++ b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/danye/components/DanyeFormDialog.vue @@ -153,7 +153,8 @@ watch(() => props.modelValue, (visible) => { if (visible && props.danye) { formData.title = props.danye.title formData.content = props.danye.content || '' - previewMode.value = false + // 默认以预览模式打开,让用户先看到渲染后的内容 + previewMode.value = true } }) diff --git a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsAddDialog.vue b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsAddDialog.vue index 11e8f1da..67e9d3bc 100644 --- a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsAddDialog.vue +++ b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsAddDialog.vue @@ -593,6 +593,10 @@ const handleSubmit = async () => { rage: formData.rage, lingzhuIs: formData.lingzhuIs, lingzhuFan: formData.lingzhuFan, + isAutoXiajia: formData.isAutoXiajia, + xiajiaLirun: formData.xiajiaLirun, + xiajiaAutoCoushu: formData.xiajiaAutoCoushu, + xiajiaJine: formData.xiajiaJine, } await createGoods(requestData) diff --git a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsEditDialog.vue b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsEditDialog.vue index 7238dfc4..f1227743 100644 --- a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsEditDialog.vue +++ b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/GoodsEditDialog.vue @@ -594,6 +594,10 @@ const handleSubmit = async () => { rage: formData.rage, lingzhuIs: formData.lingzhuIs, lingzhuFan: formData.lingzhuFan, + isAutoXiajia: formData.isAutoXiajia, + xiajiaLirun: formData.xiajiaLirun, + xiajiaAutoCoushu: formData.xiajiaAutoCoushu, + xiajiaJine: formData.xiajiaJine, } await updateGoods(props.goodsId, requestData) diff --git a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/PrizeListDialog.vue b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/PrizeListDialog.vue index c0c7d75a..68d64b71 100644 --- a/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/PrizeListDialog.vue +++ b/server/HoneyBox/src/HoneyBox.Admin/admin-web/src/views/business/goods/components/PrizeListDialog.vue @@ -350,6 +350,7 @@ const handleRefresh = () => { // 获取等级标签 const getLevelLabel = (rank: number): string => { const labels: Record = { + 0: '无等级', 1: 'A赏', 2: 'B赏', 3: 'C赏', @@ -361,11 +362,12 @@ const getLevelLabel = (rank: number): string => { 9: 'Last赏', 10: '隐藏赏', } - return labels[rank] || `${rank}级` + return labels[rank] ?? `${rank}级` } // 获取等级标签类型 const getLevelTagType = (rank: number): string => { + if (rank === 0) return 'info' if (rank === 1) return 'danger' if (rank === 2) return 'warning' if (rank <= 4) return 'success' @@ -376,7 +378,18 @@ const getLevelTagType = (rank: number): string => { // 获取分类标签 const getCategoryLabel = (type: number): string => { - return PrizeCategoryLabels[type] || '未知' + // 优先使用枚举映射 + const label = PrizeCategoryLabels[type] + if (label) return label + // 兜底处理 + const fallbackLabels: Record = { + 0: '未分类', + 1: '现货', + 2: '预售', + 3: '货币', + 4: '宝箱', + } + return fallbackLabels[type] ?? '未知' } // 获取分类标签类型