feat: enhance admin role management and reconciliation features
- Updated AGENTS.md to clarify site admin roles and their associated permissions. - Refactored reconciliation controllers to include admin user validation and improved access control based on admin roles. - Enhanced AdminReconcileJobService to support player-specific reconciliation and site-based job creation. - Removed deprecated rebate commission report functionality from the API and related services. - Improved dashboard overview builders to accommodate new site operator roles and their specific functionalities.
This commit is contained in:
@@ -7,6 +7,8 @@ use App\Models\WalletTxn;
|
||||
use App\Models\TransferOrder;
|
||||
use App\Models\ReconcileJob;
|
||||
use App\Models\ReconcileItem;
|
||||
use App\Support\AdminScopeContext;
|
||||
use App\Support\AdminScopePolicy;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -56,6 +58,7 @@ final class WalletTransferReconcileDetector
|
||||
int $staleMinutes = 15,
|
||||
?int $playerId = null,
|
||||
bool $includeMainSiteCheck = true,
|
||||
?AdminScopeContext $scope = null,
|
||||
): array {
|
||||
$limit = max(1, $limit);
|
||||
$staleMinutes = max(1, $staleMinutes);
|
||||
@@ -77,6 +80,10 @@ final class WalletTransferReconcileDetector
|
||||
$query->where('player_id', $playerId);
|
||||
}
|
||||
|
||||
if ($scope !== null && ! $scope->isSuperAdmin()) {
|
||||
AdminScopePolicy::applyViaPlayer($query, $scope);
|
||||
}
|
||||
|
||||
$orders = $query->get();
|
||||
|
||||
if ($orders->isEmpty()) {
|
||||
@@ -118,13 +125,16 @@ final class WalletTransferReconcileDetector
|
||||
Carbon $periodStart,
|
||||
Carbon $periodEnd,
|
||||
?int $adminUserId,
|
||||
?int $adminSiteId = null,
|
||||
?int $playerId = null,
|
||||
): ReconcileJob {
|
||||
return DB::transaction(function () use ($items, $periodStart, $periodEnd, $adminUserId): ReconcileJob {
|
||||
return DB::transaction(function () use ($items, $periodStart, $periodEnd, $adminUserId, $adminSiteId, $playerId): ReconcileJob {
|
||||
$jobNo = 'REC'.now()->format('YmdHis').strtoupper(str_replace('-', '', Str::uuid()->toString()));
|
||||
|
||||
$job = ReconcileJob::query()->create([
|
||||
'job_no' => $jobNo,
|
||||
'admin_user_id' => $adminUserId,
|
||||
'admin_site_id' => $adminSiteId,
|
||||
'reconcile_type' => self::RECONCILE_TYPE,
|
||||
'status' => 'completed',
|
||||
'period_start' => $periodStart,
|
||||
@@ -132,6 +142,7 @@ final class WalletTransferReconcileDetector
|
||||
'summary_json' => [
|
||||
'item_count' => count($items),
|
||||
'mismatch_count' => count($items),
|
||||
'player_id' => $playerId,
|
||||
],
|
||||
'finished_at' => now(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user