修复:补齐账单权限与模块迁移拦截

This commit is contained in:
WuYongJie 2026-07-21 19:15:23 +08:00
parent 12db7abbab
commit 3d1ecb6c58
3 changed files with 33 additions and 1 deletions

View File

@ -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, '当前账号没有店铺收款账户账单权限。');
}
}

View File

@ -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, '当前账号没有店铺收款账户账单权限。');
}
}

View File

@ -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。"
}