- 基础环境:Docker 部署配置,源码挂载实时同步 - 修复:super_admin 权限补全、登录重定向循环 - 开发:店铺营销账户账单 - 抖音账户(15字段汇总账单) - 开发:店铺营销账户账单 - 淘系支付宝账户(8字段流水账单) - 开发:店铺营销账户账单 - 拼多多账户(7字段流水账单) - 业务页面导航集成:config/business_navigation.php + Business\Pages 控制器 - 各平台独立表结构和视图,互不影响
53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs\Common;
|
|
|
|
use App\Abstracts\Job;
|
|
use App\Events\Common\ItemUpdated;
|
|
use App\Events\Common\ItemUpdating;
|
|
use App\Interfaces\Job\ShouldUpdate;
|
|
use App\Jobs\Common\CreateItemTaxes;
|
|
use App\Models\Common\Item;
|
|
|
|
class UpdateItem extends Job implements ShouldUpdate
|
|
{
|
|
public function handle(): Item
|
|
{
|
|
// Security: strip HTML tags from name to prevent stored XSS in delete
|
|
// confirmation modal (CVE-2026-11942). Defense-in-depth alongside e()
|
|
// output encoding in DeleteLink/DeleteButton getMessage().
|
|
if ($this->request->has('name')) {
|
|
$this->request->merge([
|
|
'name' => strip_tags($this->request->get('name')),
|
|
]);
|
|
}
|
|
|
|
event(new ItemUpdating($this->model, $this->request));
|
|
|
|
\DB::transaction(function () {
|
|
$this->model->update($this->request->all());
|
|
|
|
// Upload picture
|
|
if ($this->request->file('picture')) {
|
|
$this->deleteMediaModel($this->model, 'picture', $this->request);
|
|
|
|
$media = $this->getMedia($this->request->file('picture'), 'items');
|
|
|
|
$this->model->attachMedia($media, 'picture');
|
|
} elseif ($this->request->isNotApi() && ! $this->request->file('picture') && $this->model->picture) {
|
|
$this->deleteMediaModel($this->model, 'picture', $this->request);
|
|
} elseif ($this->request->isApi() && $this->request->has('remove_picture') && $this->model->picture) {
|
|
$this->deleteMediaModel($this->model, 'picture', $this->request);
|
|
}
|
|
|
|
$this->deleteRelationships($this->model, ['taxes']);
|
|
|
|
$this->dispatch(new CreateItemTaxes($this->model, $this->request));
|
|
});
|
|
|
|
event(new ItemUpdated($this->model, $this->request));
|
|
|
|
return $this->model;
|
|
}
|
|
}
|