fix(testing): GranaryBackend 白名单放行 edit 与 detail 动作并支持 ids 参数

这个提交包含在:
wikiboss
2026-11-02 14:30:42 +08:00
父节点 43da3cc0ee
当前提交 4a1e4f1d93
共有 5 个文件被更改,包括 145 次插入 和 16 次删除

查看文件

@@ -30,13 +30,13 @@ class GranaryBackend extends Backend
$action = strtolower($this->request->action());
$actions = [
'granary' => ['index', 'add', 'detail', 'dell'],
'testing' => ['index', 'add', 'sort', 'dell'],
'testing' => ['index', 'add', 'edit', 'detail', 'sort', 'dell'],
'content' => ['index', 'add', 'status', 'getcontent', 'dell'],
'forecast' => ['index', 'detail', 'add', 'retry', 'actual'],
];
if (!isset($actions[$controller]) || !in_array($action, $actions[$controller], true)) $this->error('不支持此操作');
$table = $controller === 'forecast' ? 'grain_forecast' : $controller;
$id = $this->request->post('id', $this->request->get('id', ''));
$id = $this->request->post('id', $this->request->get('id', $this->request->get('ids', '')));
if ($action === 'actual') {
$id = Db::name('grain_forecast_point')->where('id', $this->request->post('point_id/d', 0))->value('forecast_id');
if (!$id) $this->error('预测周期不存在');