- 基础环境:Docker 部署配置,源码挂载实时同步 - 修复:super_admin 权限补全、登录重定向循环 - 开发:店铺营销账户账单 - 抖音账户(15字段汇总账单) - 开发:店铺营销账户账单 - 淘系支付宝账户(8字段流水账单) - 开发:店铺营销账户账单 - 拼多多账户(7字段流水账单) - 业务页面导航集成:config/business_navigation.php + Business\Pages 控制器 - 各平台独立表结构和视图,互不影响
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\EcommerceFinance\Http\Controllers\Api;
|
|
|
|
use App\Abstracts\Http\ApiController;
|
|
use Modules\EcommerceFinance\Http\Requests\Channel as Request;
|
|
use Modules\EcommerceFinance\Models\Channel;
|
|
|
|
class Channels extends ApiController
|
|
{
|
|
public function index()
|
|
{
|
|
return response()->json(Channel::query()->orderBy('name')->paginate($this->limit()));
|
|
}
|
|
|
|
public function show(Channel $channel)
|
|
{
|
|
return response()->json($channel);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$channel = Channel::create($this->attributes($request));
|
|
|
|
return response()
|
|
->json($channel, 201)
|
|
->header('Location', route('api.ecommerce-finance.channels.show', $channel));
|
|
}
|
|
|
|
public function update(Channel $channel, Request $request)
|
|
{
|
|
$channel->update($request->validated());
|
|
|
|
return response()->json($channel->fresh());
|
|
}
|
|
|
|
private function attributes(Request $request): array
|
|
{
|
|
return array_merge($request->validated(), [
|
|
'company_id' => company_id(),
|
|
'created_by' => user_id(),
|
|
'created_from' => 'ecommerce-finance',
|
|
]);
|
|
}
|
|
|
|
private function limit(): int
|
|
{
|
|
return min(max((int) request('limit', 25), 1), 100);
|
|
}
|
|
}
|