Quellcode durchsuchen

清理宝箱旧系统残留文件和修复路由命名

- 删除废弃的菜单项(ID: 218, 226, 261)
- 移除旧系统Action文件: DuplicateChestContentAction, ViewChestDetailAction, ChestCostAction
- 移除旧系统配置文件: ChestContentWhitelist, ChestCostWhitelist, CHEST_COST_TYPE枚举
- 修复GameRewardGroupPityCountController路由注解,使用正确的命名规范
- 更新菜单URI为game-reward-group-pity-counts,符合路由命名标准
notfff vor 7 Monaten
Ursprung
Commit
23606a780c

+ 1 - 1
app/Module/Game/AdminControllers/GameRewardGroupPityCountController.php

@@ -14,7 +14,7 @@ use UCore\DcatAdmin\AdminController;
  *
  * 路由: /admin/game/reward-group-pity-counts
  */
-#[Resource('game/reward-group-pity-counts', names: 'dcat.admin.game.reward-group-pity-counts')]
+#[Resource('game-reward-group-pity-counts', names: 'dcat.admin.game-reward-group-pity-counts')]
 class GameRewardGroupPityCountController extends AdminController
 {
     /**

+ 0 - 36
app/Module/GameItems/AdminControllers/Actions/ChestCostAction.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\AdminControllers\Actions;
-
-use App\Module\GameItems\Enums\ITEM_TYPE;
-use App\Module\GameItems\Models\Item;
-use Illuminate\Http\Request;
-use UCore\DcatAdmin\RowAction;
-use UCore\DcatAdmin\RowActionHandler;
-
-
-/**
- * @property-read Item $row
- */
-class ChestCostAction extends RowActionHandler
-{
-
-    public $title = '宝箱消耗';
-
-
-    public function allowed()
-    {
-        return $this->row->type === ITEM_TYPE::CHEST;
-
-    }
-
-    public function handle(Request $request)
-    {
-        $id = $this->getKey();
-
-        return $this->response()->redirect(admin_url("game-items-chest-costs?item_id={$id}"));
-    }
-
-
-
-}

+ 0 - 43
app/Module/GameItems/AdminControllers/Actions/DuplicateChestContentAction.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\AdminControllers\Actions;
-
-use App\Module\GameItems\Models\ItemChestContent;
-use Dcat\Admin\Grid\RowAction;
-use Illuminate\Http\Request;
-
-class DuplicateChestContentAction extends RowAction
-{
-    protected $title = '复制';
-
-    public function title()
-    {
-        return $this->title;
-    }
-
-    public function handle(Request $request)
-    {
-        try {
-            $id = $this->getKey();
-            
-            // 查找原始记录
-            $original = ItemChestContent::findOrFail($id);
-            
-            // 创建新记录
-            $new = $original->replicate();
-            $new->save();
-            
-            return $this->response()
-                ->success("复制成功 [ID: {$new->id}]")
-                ->refresh();
-        } catch (\Exception $e) {
-            return $this->response()
-                ->error('复制失败: '.$e->getMessage());
-        }
-    }
-
-    public function confirm()
-    {
-        return ['确定要复制此宝箱内容吗?', '复制操作将创建一个新的宝箱内容记录'];
-    }
-}

+ 0 - 43
app/Module/GameItems/AdminControllers/Actions/ViewChestDetailAction.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\AdminControllers\Actions;
-
-use App\Module\GameItems\Models\ItemChestContent;
-use Illuminate\Http\Request;
-use UCore\DcatAdmin\RowActionHandler;
-
-/**
- * 查看宝箱详情
- * 
- * 在宝箱内容管理行中添加查看宝箱详情的快捷操作
- */
-class ViewChestDetailAction extends RowActionHandler
-{
-    /**
-     * 操作按钮标题
-     *
-     * @var string
-     */
-    public $title = '宝箱详情';
-
-    /**
-     * 处理请求
-     *
-     * @param Request $request
-     * @return mixed
-     */
-    public function handle(Request $request)
-    {
-        $id = $this->getKey();
-        $content = ItemChestContent::with('chest')->find($id);
-        
-        if (!$content || !$content->chest_id) {
-            return $this->response()->error('宝箱不存在');
-        }
-        
-        // 跳转到宝箱详情页面
-        return $this->response()->redirect(
-            admin_url("game-items/{$content->chest_id}")
-        );
-    }
-}

+ 0 - 63
app/Module/GameItems/Config/ChestContentWhitelist.php

@@ -1,63 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\Config;
-
-/**
- * 宝箱内容属性白名单配置
- *
- * 用于定义在生成宝箱配置表时,宝箱内容中哪些属性应该被包含在输出中。
- * 未在白名单中的属性将被过滤掉,不会出现在生成的JSON配置中。
- */
-class ChestContentWhitelist
-{
-    /**
-     * 宝箱内容属性白名单
-     *
-     * 只有在此数组中列出的属性才会被包含在生成的宝箱配置表中
-     *
-     * @var array
-     */
-    public static array $whitelist = [
-        'item_id',      // 物品ID
-        'type',         // 类型(item或group)
-        'from_group',   // 是否来自物品组
-    ];
-
-    /**
-     * 检查属性是否在白名单中
-     *
-     * @param string $attribute 属性名
-     * @return bool 如果属性在白名单中返回true,否则返回false
-     */
-    public static function isAllowed(string $attribute): bool
-    {
-        return in_array($attribute, self::$whitelist);
-    }
-
-    /**
-     * 过滤对象,只保留白名单中的属性
-     *
-     * @param object|array|null $attributes 要过滤的属性对象或数组
-     * @return array|null 过滤后的属性数组,如果输入为null则返回null
-     */
-    public static function filter($attributes): ?array
-    {
-        if (is_null($attributes)) {
-            return null;
-        }
-
-        // 如果是对象,转换为数组
-        if (is_object($attributes)) {
-            $attributes = (array)$attributes;
-        }
-
-        // 过滤数组,只保留白名单中的属性
-        return array_filter(
-            $attributes,
-            function ($key) {
-                return self::isAllowed($key);
-            },
-            ARRAY_FILTER_USE_KEY
-        );
-    }
-}

+ 0 - 64
app/Module/GameItems/Config/ChestCostWhitelist.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\Config;
-
-/**
- * 宝箱开启消耗属性白名单配置
- *
- * 用于定义在生成宝箱配置表时,宝箱开启消耗中哪些属性应该被包含在输出中。
- * 未在白名单中的属性将被过滤掉,不会出现在生成的JSON配置中。
- */
-class ChestCostWhitelist
-{
-    /**
-     * 宝箱开启消耗属性白名单
-     *
-     * 只有在此数组中列出的属性才会被包含在生成的宝箱配置表中
-     *
-     * @var array
-     */
-    public static array $whitelist = [
-        'cost_type',     // 消耗类型
-        'cost_id',       // 消耗ID
-        'cost_quantity', // 消耗数量
-        'item_name',     // 物品名称(当cost_type为物品时)
-    ];
-
-    /**
-     * 检查属性是否在白名单中
-     *
-     * @param string $attribute 属性名
-     * @return bool 如果属性在白名单中返回true,否则返回false
-     */
-    public static function isAllowed(string $attribute): bool
-    {
-        return in_array($attribute, self::$whitelist);
-    }
-
-    /**
-     * 过滤对象,只保留白名单中的属性
-     *
-     * @param object|array|null $attributes 要过滤的属性对象或数组
-     * @return array|null 过滤后的属性数组,如果输入为null则返回null
-     */
-    public static function filter($attributes): ?array
-    {
-        if (is_null($attributes)) {
-            return null;
-        }
-
-        // 如果是对象,转换为数组
-        if (is_object($attributes)) {
-            $attributes = (array)$attributes;
-        }
-
-        // 过滤数组,只保留白名单中的属性
-        return array_filter(
-            $attributes,
-            function ($key) {
-                return self::isAllowed($key);
-            },
-            ARRAY_FILTER_USE_KEY
-        );
-    }
-}

+ 0 - 43
app/Module/GameItems/Enums/CHEST_COST_TYPE.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\Enums;
-
-use UCore\Enum\EnumCore;
-use UCore\Enum\EnumToInt;
-
-/**
- * 宝箱开启消耗类型枚举
- */
-enum CHEST_COST_TYPE: int
-{
-    use EnumCore, EnumToInt;
-
-    /**
-     * 物品消耗
-     */
-    case ITEM = 1;
-
-    /**
-     * 货币消耗
-     */
-    case CURRENCY = 2;
-
-    /**
-     * 其他资源消耗(如体力、精力等)
-     */
-    case OTHER_RESOURCE = 3;
-
-    /**
-     * 获取所有枚举值及其描述
-     *
-     * @return array
-     */
-    public static function getAll(): array
-    {
-        return [
-            self::ITEM->value => '物品',
-            self::CURRENCY->value => '货币',
-            self::OTHER_RESOURCE->value => '其他资源',
-        ];
-    }
-}