- 在多个控制器中更新权限检查逻辑,确保管理员能够更灵活地管理代理和玩家。 - 在 AdminPlayerStoreController 中引入对玩家创建能力的验证,确保只有具备相应权限的管理员能够创建玩家。 - 更新请求验证逻辑,新增 credit_limit、rebate_rate 和 extra_rebate_rate 字段,以支持更细粒度的玩家管理。 - 在 AgentNodeProfileController 中添加对父代理能力授予的验证,确保子代理的权限在父代理范围内。 - 引入 AgentProfileFieldRules 以简化代理资料更新请求的规则定义,提升代码复用性。
52 lines
1.8 KiB
PHP
52 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Admin\Integration;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Middleware\RecordAdminApiAudit;
|
|
use App\Models\AdminSite;
|
|
use App\Lottery\ErrorCode;
|
|
use App\Services\AuditLogger;
|
|
use App\Support\AdminIntegrationSiteAccess;
|
|
use App\Support\ApiMessage;
|
|
use App\Support\ApiResponse;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
/** GET /api/v1/admin/integration-sites/{admin_site}/secrets */
|
|
final class AdminIntegrationSiteSecretsController extends Controller
|
|
{
|
|
public function __invoke(Request $request, AdminSite $admin_site): JsonResponse
|
|
{
|
|
$admin = $request->lotteryAdmin();
|
|
abort_if($admin === null, 401);
|
|
|
|
if (! AdminIntegrationSiteAccess::canAccess($admin, $admin_site)) {
|
|
return ApiMessage::errorResponse($request, 'admin.site_access_denied', ErrorCode::AdminForbidden->value, null, 403);
|
|
}
|
|
|
|
if (! $admin->isSuperAdmin() && ! $admin->hasPermissionCode('integration.site.manage')) {
|
|
return ApiMessage::errorResponse($request, 'admin.permission_denied', ErrorCode::AdminForbidden->value, null, 403);
|
|
}
|
|
|
|
$sso = $admin_site->decryptedSsoJwtSecret();
|
|
$wallet = $admin_site->decryptedWalletApiKey();
|
|
|
|
AuditLogger::recordForAdmin(
|
|
$admin,
|
|
$request,
|
|
moduleCode: 'integration',
|
|
actionCode: 'reveal_secrets',
|
|
targetType: 'admin_site',
|
|
targetId: (string) $admin_site->id,
|
|
afterJson: ['code' => $admin_site->code],
|
|
);
|
|
$request->attributes->set(RecordAdminApiAudit::ATTRIBUTE_AUDIT_RECORDED, true);
|
|
|
|
return ApiResponse::success([
|
|
'sso_jwt_secret' => is_string($sso) ? $sso : '',
|
|
'wallet_api_key' => is_string($wallet) ? $wallet : '',
|
|
]);
|
|
}
|
|
}
|