- 在多个控制器中更新权限检查逻辑,确保管理员能够更灵活地管理代理和玩家。 - 在 AdminPlayerStoreController 中引入对玩家创建能力的验证,确保只有具备相应权限的管理员能够创建玩家。 - 更新请求验证逻辑,新增 credit_limit、rebate_rate 和 extra_rebate_rate 字段,以支持更细粒度的玩家管理。 - 在 AgentNodeProfileController 中添加对父代理能力授予的验证,确保子代理的权限在父代理范围内。 - 引入 AgentProfileFieldRules 以简化代理资料更新请求的规则定义,提升代码复用性。
54 lines
1.8 KiB
PHP
54 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Admin\AgentSettlement;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Support\AdminAgentSettlementScope;
|
|
use App\Support\ApiResponse;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
final class AgentSettlementBillShowController extends Controller
|
|
{
|
|
public function __invoke(Request $request, int $settlement_bill): JsonResponse
|
|
{
|
|
$admin = $request->lotteryAdmin();
|
|
abort_if($admin === null, 401);
|
|
abort_if(! AdminAgentSettlementScope::billAccessible($admin, $settlement_bill), 404);
|
|
|
|
$bill = DB::table('settlement_bills')->where('id', $settlement_bill)->first();
|
|
abort_if($bill === null, 404);
|
|
|
|
$payments = DB::table('payment_records')
|
|
->where('settlement_bill_id', $settlement_bill)
|
|
->orderBy('id')
|
|
->get();
|
|
|
|
$rebateAllocations = DB::table('rebate_allocations')
|
|
->where('settlement_bill_id', $settlement_bill)
|
|
->orderBy('id')
|
|
->get();
|
|
|
|
$adjustments = DB::table('settlement_adjustments')
|
|
->where('original_bill_id', $settlement_bill)
|
|
->orderByDesc('id')
|
|
->get();
|
|
|
|
$meta = $bill->meta_json ?? null;
|
|
$tierSettlements = null;
|
|
if (is_string($meta) && $meta !== '') {
|
|
$decoded = json_decode($meta, true);
|
|
$tierSettlements = is_array($decoded) ? ($decoded['edge'] ?? $decoded['tier_settlements'] ?? null) : null;
|
|
}
|
|
|
|
return ApiResponse::success([
|
|
'bill' => $bill,
|
|
'payments' => $payments,
|
|
'rebate_allocations' => $rebateAllocations,
|
|
'adjustments' => $adjustments,
|
|
'tier_edge' => $tierSettlements,
|
|
]);
|
|
}
|
|
}
|