diff --git a/modules/EcommerceFinance/Http/Controllers/AccountBills.php b/modules/EcommerceFinance/Http/Controllers/AccountBills.php index a1bf5fb82..fbf8d0e8c 100644 --- a/modules/EcommerceFinance/Http/Controllers/AccountBills.php +++ b/modules/EcommerceFinance/Http/Controllers/AccountBills.php @@ -3,6 +3,7 @@ namespace Modules\EcommerceFinance\Http\Controllers; use App\Abstracts\Http\Controller; +use App\Utilities\SidebarPermissions; use Illuminate\Http\Request; use Modules\EcommerceFinance\AccountBillColumns; use Modules\EcommerceFinance\Models\AccountBill; @@ -16,6 +17,8 @@ class AccountBills extends Controller */ public function index(Request $request) { + $this->authorizeStoreReceivingBills(); + $billType = (string) $request->get('bill_type', ''); if (! AccountBillColumns::has($billType)) { @@ -86,6 +89,18 @@ class AccountBills extends Controller public function show(AccountBill $bill) { + $this->authorizeStoreReceivingBills(); + return response()->json($bill); } + + protected function authorizeStoreReceivingBills(): void + { + $section = collect(SidebarPermissions::navigationFor(user())) + ->firstWhere('slug', 'billing-transactions'); + $page = collect($section['pages'] ?? []) + ->firstWhere('slug', 'store-receiving-bills'); + + abort_if(empty($page), 403, '当前账号没有店铺收款账户账单权限。'); + } } diff --git a/modules/EcommerceFinance/Http/Controllers/AlipayBills.php b/modules/EcommerceFinance/Http/Controllers/AlipayBills.php index ab7da6b49..9e7a484c4 100644 --- a/modules/EcommerceFinance/Http/Controllers/AlipayBills.php +++ b/modules/EcommerceFinance/Http/Controllers/AlipayBills.php @@ -3,6 +3,7 @@ namespace Modules\EcommerceFinance\Http\Controllers; use App\Abstracts\Http\Controller; +use App\Utilities\SidebarPermissions; use Illuminate\Http\Request; use Modules\EcommerceFinance\Models\AlipayBill; @@ -14,6 +15,8 @@ class AlipayBills extends Controller */ public function index(Request $request) { + $this->authorizeStoreReceivingBills(); + $query = AlipayBill::query()->where('company_id', company_id()); if ($store = $request->get('store_name')) { @@ -86,6 +89,18 @@ class AlipayBills extends Controller public function show(AlipayBill $bill) { + $this->authorizeStoreReceivingBills(); + return response()->json($bill); } + + protected function authorizeStoreReceivingBills(): void + { + $section = collect(SidebarPermissions::navigationFor(user())) + ->firstWhere('slug', 'billing-transactions'); + $page = collect($section['pages'] ?? []) + ->firstWhere('slug', 'store-receiving-bills'); + + abort_if(empty($page), 403, '当前账号没有店铺收款账户账单权限。'); + } } diff --git a/scripts/deploy-from-workstation.ps1 b/scripts/deploy-from-workstation.ps1 index 0aedd74f0..e1a7e273f 100644 --- a/scripts/deploy-from-workstation.ps1 +++ b/scripts/deploy-from-workstation.ps1 @@ -253,7 +253,9 @@ try { } if ($previousSha -and $previousShaExists) { - $migrationChanges = git diff --name-only "$previousSha..$deploySha" -- database/migrations + $migrationChanges = git diff --name-only "$previousSha..$deploySha" -- ` + database/migrations ` + ':(glob)modules/*/Database/Migrations/*.php' if ($migrationChanges -and -not $AllowMigrations) { throw "检测到数据库迁移:$($migrationChanges -join ', ')。需负责人确认后添加 -AllowMigrations。" }