Forráskód Böngészése

feat(shop): 重构商店商品表结构

- 移除 item_id、item_quantity、price 和 currency_id 字段
- 新增 category_name、consume_group_id 和 reward_group_id 字段
- 更新模型 ShopItem 中的属性注释
notfff 8 hónapja
szülő
commit
59bc129149

+ 6 - 7
app/Module/Shop/Databases/GenerateSql/shop_items.sql

@@ -9,10 +9,9 @@ CREATE TABLE `kku_shop_items` (
   `name` varchar(100) NOT NULL COMMENT '商品名称',
   `description` text COMMENT '商品描述',
   `category_id` int unsigned NOT NULL COMMENT '分类ID,外键关联kku_shop_categories表',
-  `item_id` int unsigned NOT NULL COMMENT '关联的物品ID,外键关联kku_item_items表',
-  `item_quantity` int NOT NULL DEFAULT '1' COMMENT '物品数量',
-  `price` int NOT NULL COMMENT '价格',
-  `currency_id` int unsigned NOT NULL COMMENT '货币类型ID',
+  `category_name` varchar(100) DEFAULT NULL COMMENT '分类名称(字符串格式,区别于现有分类机制)',
+  `consume_group_id` int unsigned DEFAULT NULL COMMENT '消耗组ID,外键关联kku_game_consume_groups表',
+  `reward_group_id` int unsigned DEFAULT NULL COMMENT '奖励组ID,外键关联kku_game_reward_groups表',
   `max_buy` int NOT NULL DEFAULT '0' COMMENT '最大购买数量(0表示无限制)',
   `is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否激活(0:否, 1:是)',
   `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序权重',
@@ -23,8 +22,8 @@ CREATE TABLE `kku_shop_items` (
   `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
   PRIMARY KEY (`id`),
   KEY `shop_items_category_id_index` (`category_id`),
-  KEY `shop_items_item_id_index` (`item_id`),
-  KEY `shop_items_currency_id_index` (`currency_id`),
   KEY `shop_items_is_active_index` (`is_active`),
-  KEY `shop_items_sort_order_index` (`sort_order`)
+  KEY `shop_items_sort_order_index` (`sort_order`),
+  KEY `shop_items_consume_group_id_index` (`consume_group_id`),
+  KEY `shop_items_reward_group_id_index` (`reward_group_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商店商品表';

+ 3 - 4
app/Module/Shop/Models/ShopItem.php

@@ -20,10 +20,9 @@ use App\Module\Shop\Models\ShopPromotionItem;
  * @property  string  $name  商品名称
  * @property  string  $description  商品描述
  * @property  int  $category_id  分类ID,外键关联kku_shop_categories表
- * @property  int  $item_id  关联的物品ID,外键关联kku_item_items表
- * @property  int  $item_quantity  物品数量
- * @property  int  $price  价格
- * @property  int  $currency_id  货币类型ID
+ * @property  string  $category_name  分类名称(字符串格式,区别于现有分类机制)
+ * @property  int  $consume_group_id  消耗组ID,外键关联kku_game_consume_groups表
+ * @property  int  $reward_group_id  奖励组ID,外键关联kku_game_reward_groups表
  * @property  int  $max_buy  最大购买数量(0表示无限制)
  * @property  bool  $is_active  是否激活(0:否, 1:是)
  * @property  int  $sort_order  排序权重