根据需求,对商店模块进行了以下主要修改:
category_name 字段(字符串格式)item_id (关联的物品ID)item_quantity (物品数量)price (价格)currency_id (货币类型ID)consume_group_id (关联消耗组)reward_group_id (关联奖励组)app/Module/Shop/Databases/GenerateSql/shop_items.sql - 更新表结构定义database/migrations/modify_shop_items_table.sql - 数据库迁移脚本app/Module/Shop/Models/ShopItem.php - 更新模型属性和关联关系app/Module/Shop/AdminControllers/ShopItemController.php - 更新后台管理界面app/Module/Shop/Services/ShopService.php - 更新业务逻辑app/Module/Shop/README.md - 更新表结构说明`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表'
`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'
shop_items_item_id_index, shop_items_currency_id_indexshop_items_consume_group_id_index, shop_items_reward_group_id_indexitem() - 关联物品表consumeGroup() - 关联消耗组表rewardGroup() - 关联奖励组表需要实现以下服务类:
ConsumeService::consume() - 处理资源消耗RewardService::giveReward() - 处理奖励发放当前购买逻辑已标记为 TODO,需要:
由于不再有固定价格,需要:
在开发环境中执行以下 SQL 脚本:
mysql -u username -p database_name < database/migrations/modify_shop_items_table.sql