feat: 增强代理和玩家管理功能
- 在多个控制器中更新权限检查逻辑,确保管理员能够更灵活地管理代理和玩家。 - 在 AdminPlayerStoreController 中引入对玩家创建能力的验证,确保只有具备相应权限的管理员能够创建玩家。 - 更新请求验证逻辑,新增 credit_limit、rebate_rate 和 extra_rebate_rate 字段,以支持更细粒度的玩家管理。 - 在 AgentNodeProfileController 中添加对父代理能力授予的验证,确保子代理的权限在父代理范围内。 - 引入 AgentProfileFieldRules 以简化代理资料更新请求的规则定义,提升代码复用性。
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?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 AgentSettlementAdjustmentIndexController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
$admin = $request->lotteryAdmin();
|
||||
abort_if($admin === null, 401);
|
||||
|
||||
$periodId = (int) $request->query('settlement_period_id', 0);
|
||||
$adminSiteId = (int) $request->query('admin_site_id', 0);
|
||||
$adjustmentType = trim((string) $request->query('adjustment_type', ''));
|
||||
|
||||
$query = DB::table('settlement_adjustments as sa')
|
||||
->leftJoin('settlement_periods as sp', 'sp.id', '=', 'sa.settlement_period_id')
|
||||
->leftJoin('settlement_bills as sb', 'sb.id', '=', 'sa.original_bill_id')
|
||||
->select([
|
||||
'sa.*',
|
||||
'sp.period_start',
|
||||
'sp.period_end',
|
||||
'sp.admin_site_id',
|
||||
'sb.bill_type as original_bill_type',
|
||||
'sb.owner_type as original_owner_type',
|
||||
'sb.owner_id as original_owner_id',
|
||||
])
|
||||
->orderByDesc('sa.id');
|
||||
|
||||
if ($periodId > 0) {
|
||||
$query->where('sa.settlement_period_id', $periodId);
|
||||
}
|
||||
|
||||
if ($adminSiteId > 0) {
|
||||
$query->where('sp.admin_site_id', $adminSiteId);
|
||||
}
|
||||
|
||||
if ($adjustmentType !== '') {
|
||||
$query->where('sa.adjustment_type', $adjustmentType);
|
||||
}
|
||||
|
||||
$siteIds = $admin->accessibleAdminSiteIds();
|
||||
if ($siteIds !== null) {
|
||||
if ($siteIds === []) {
|
||||
$query->whereRaw('0 = 1');
|
||||
} else {
|
||||
$query->whereIn('sp.admin_site_id', $siteIds);
|
||||
}
|
||||
}
|
||||
|
||||
return ApiResponse::success([
|
||||
'items' => $query->limit(200)->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user