feat: 增强管理员功能与数据处理
- 在多个控制器中引入 agent_node_id,以支持基于代理节点的权限和数据过滤。 - 更新 AdminRole 和 AdminUser 模型,新增角色范围和代理节点相关功能,提升角色管理的灵活性。 - 在请求验证中添加 agent_node_id 字段,确保 API 接口支持代理节点的相关操作。 - 优化 LotterySettings 服务,支持批量写入设置,提升配置管理的效率。 - 更新仪表板和报告服务,增强数据统计功能,确保管理员能够获取更全面的统计信息。
This commit is contained in:
@@ -26,6 +26,7 @@ final class AdminPlayerStoreRequest extends FormRequest
|
||||
'nickname' => ['nullable', 'string', 'max:128'],
|
||||
'default_currency' => ['sometimes', 'string', 'max:16', Rule::exists('currencies', 'code')],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1,2'],
|
||||
'agent_node_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ final class AdminReportQueryRequest extends FormRequest
|
||||
'date_to' => ['sometimes', 'nullable', 'date_format:Y-m-d', 'after_or_equal:date_from'],
|
||||
'player_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'play_code' => ['sometimes', 'nullable', 'string', 'max:32'],
|
||||
'agent_node_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Http/Requests/Admin/AdminSettingBatchUpdateRequest.php
Normal file
22
app/Http/Requests/Admin/AdminSettingBatchUpdateRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AdminSettingBatchUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'items' => ['required', 'array', 'min:1', 'max:50'],
|
||||
'items.*.key' => ['required', 'string', 'max:128'],
|
||||
'items.*.value' => ['present'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ final class AdminSettingUpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'value' => ['required'],
|
||||
'value' => ['present'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Http/Requests/Admin/AgentAdminUserRoleSyncRequest.php
Normal file
22
app/Http/Requests/Admin/AgentAdminUserRoleSyncRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AgentAdminUserRoleSyncRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'role_ids' => ['required', 'array'],
|
||||
'role_ids.*' => ['integer', 'exists:admin_roles,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
28
app/Http/Requests/Admin/AgentAdminUserStoreRequest.php
Normal file
28
app/Http/Requests/Admin/AgentAdminUserStoreRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
final class AgentAdminUserStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'username' => ['required', 'string', 'max:64', Rule::unique('admin_users', 'username')],
|
||||
'nickname' => ['required', 'string', 'max:128'],
|
||||
'email' => ['nullable', 'email', 'max:255', Rule::unique('admin_users', 'email')],
|
||||
'password' => ['required', 'string', 'min:8', 'max:128'],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1'],
|
||||
'role_ids' => ['sometimes', 'array'],
|
||||
'role_ids.*' => ['integer', 'exists:admin_roles,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Http/Requests/Admin/AgentDelegationGrantSyncRequest.php
Normal file
25
app/Http/Requests/Admin/AgentDelegationGrantSyncRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AgentDelegationGrantSyncRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->lotteryAdmin() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'grants' => ['required', 'array'],
|
||||
'grants.*.menu_action_id' => ['required', 'integer', 'min:1'],
|
||||
'grants.*.can_delegate' => ['sometimes', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
24
app/Http/Requests/Admin/AgentNodeStoreRequest.php
Normal file
24
app/Http/Requests/Admin/AgentNodeStoreRequest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AgentNodeStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => ['required', 'integer', 'exists:agent_nodes,id'],
|
||||
'code' => ['required', 'string', 'max:64', 'regex:/^[a-zA-Z0-9_-]+$/'],
|
||||
'name' => ['required', 'string', 'max:128'],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/Admin/AgentNodeUpdateRequest.php
Normal file
22
app/Http/Requests/Admin/AgentNodeUpdateRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AgentNodeUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['sometimes', 'string', 'max:128'],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/Admin/AgentRolePermissionSyncRequest.php
Normal file
22
app/Http/Requests/Admin/AgentRolePermissionSyncRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AgentRolePermissionSyncRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'permission_slugs' => ['required', 'array'],
|
||||
'permission_slugs.*' => ['string', 'max:128'],
|
||||
];
|
||||
}
|
||||
}
|
||||
39
app/Http/Requests/Admin/AgentRoleStoreRequest.php
Normal file
39
app/Http/Requests/Admin/AgentRoleStoreRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Models\AdminRole;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
final class AgentRoleStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
$agentNode = $this->route('agent_node');
|
||||
$ownerId = is_object($agentNode) ? (int) $agentNode->id : (int) $agentNode;
|
||||
|
||||
return [
|
||||
'slug' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:64',
|
||||
'regex:/^[a-z0-9_\\-]+$/',
|
||||
Rule::unique('admin_roles', 'slug')->where(
|
||||
static fn ($query) => $query->where('owner_agent_id', $ownerId),
|
||||
),
|
||||
],
|
||||
'name' => ['required', 'string', 'max:128'],
|
||||
'description' => ['nullable', 'string', 'max:65535'],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1'],
|
||||
'permission_slugs' => ['sometimes', 'array'],
|
||||
'permission_slugs.*' => ['string', 'max:128'],
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Http/Requests/Admin/AgentRoleUpdateRequest.php
Normal file
23
app/Http/Requests/Admin/AgentRoleUpdateRequest.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AgentRoleUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['sometimes', 'string', 'max:128'],
|
||||
'description' => ['nullable', 'string', 'max:65535'],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ final class TicketItemListRequest extends FormRequest
|
||||
'player_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'player_account' => ['sometimes', 'nullable', 'string', 'max:128'],
|
||||
'site_code' => ['sometimes', 'nullable', 'string', 'max:64'],
|
||||
'agent_node_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'draw_no' => ['sometimes', 'nullable', 'string', 'max:32'],
|
||||
'status' => ['sometimes'],
|
||||
'status.*' => ['string', 'max:32'],
|
||||
|
||||
@@ -28,6 +28,7 @@ final class TransferOrderListRequest extends FormRequest
|
||||
'player_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'player_account' => ['sometimes', 'nullable', 'string', 'max:128'],
|
||||
'site_code' => ['sometimes', 'nullable', 'string', 'max:64'],
|
||||
'agent_node_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'transfer_no' => ['sometimes', 'nullable', 'string', 'max:96'],
|
||||
'external_ref_no' => ['sometimes', 'nullable', 'string', 'max:96'],
|
||||
'created_from' => ['sometimes', 'nullable', 'date_format:Y-m-d'],
|
||||
|
||||
@@ -28,6 +28,7 @@ final class WalletTransactionListRequest extends FormRequest
|
||||
'player_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'player_account' => ['sometimes', 'nullable', 'string', 'max:128'],
|
||||
'site_code' => ['sometimes', 'nullable', 'string', 'max:64'],
|
||||
'agent_node_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
||||
'txn_no' => ['sometimes', 'nullable', 'string', 'max:96'],
|
||||
'external_ref_no' => ['sometimes', 'nullable', 'string', 'max:96'],
|
||||
'created_from' => ['sometimes', 'nullable', 'date_format:Y-m-d'],
|
||||
|
||||
Reference in New Issue
Block a user