feat: 增强代理和玩家管理功能
- 在多个控制器中更新权限检查逻辑,确保管理员能够更灵活地管理代理和玩家。 - 在 AdminPlayerStoreController 中引入对玩家创建能力的验证,确保只有具备相应权限的管理员能够创建玩家。 - 更新请求验证逻辑,新增 credit_limit、rebate_rate 和 extra_rebate_rate 字段,以支持更细粒度的玩家管理。 - 在 AgentNodeProfileController 中添加对父代理能力授予的验证,确保子代理的权限在父代理范围内。 - 引入 AgentProfileFieldRules 以简化代理资料更新请求的规则定义,提升代码复用性。
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Wallet;
|
||||
|
||||
use App\Models\Player;
|
||||
use App\Models\WalletTxn;
|
||||
use App\Support\ApiResponse;
|
||||
use App\Support\PaginationTrait;
|
||||
@@ -9,8 +10,10 @@ use Illuminate\Http\JsonResponse;
|
||||
use App\Support\AdminScopePolicy;
|
||||
use App\Support\AgentNodeApiPresenter;
|
||||
use App\Support\CurrencyFormatter;
|
||||
use App\Support\PlayerFundingMode;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\WalletTransactionListRequest;
|
||||
use App\Services\Wallet\PlayerLedgerLogsService;
|
||||
|
||||
/**
|
||||
* 后台:彩票钱包流水列表 {@see wallet_txns}。
|
||||
@@ -33,6 +36,10 @@ final class WalletTransactionListController extends Controller
|
||||
|
||||
private const ALLOWED_STATUS = ['posted', 'pending_reconcile', 'reversed'];
|
||||
|
||||
public function __construct(
|
||||
private readonly PlayerLedgerLogsService $ledgerLogs,
|
||||
) {}
|
||||
|
||||
public function __invoke(WalletTransactionListRequest $request): JsonResponse
|
||||
{
|
||||
$admin = $request->lotteryAdmin();
|
||||
@@ -44,6 +51,20 @@ final class WalletTransactionListController extends Controller
|
||||
$perPage = $this->perPage($request, 'per_page', 10, 100);
|
||||
$page = $this->page($request);
|
||||
|
||||
if (! empty($validated['player_id'])) {
|
||||
$player = Player::query()->find((int) $validated['player_id']);
|
||||
if ($player !== null && PlayerFundingMode::usesCredit($player)) {
|
||||
$credit = $this->ledgerLogs->listForAdminPlayer(
|
||||
$player,
|
||||
$page,
|
||||
$perPage,
|
||||
isset($validated['biz_type']) ? (string) $validated['biz_type'] : null,
|
||||
);
|
||||
|
||||
return ApiResponse::success($credit);
|
||||
}
|
||||
}
|
||||
|
||||
$query = WalletTxn::query()
|
||||
->with([
|
||||
'player:id,site_code,site_player_id,username,nickname,agent_node_id',
|
||||
@@ -141,6 +162,9 @@ final class WalletTransactionListController extends Controller
|
||||
'remark' => $t->remark,
|
||||
'created_at' => $t->created_at?->toIso8601String(),
|
||||
'updated_at' => $t->updated_at?->toIso8601String(),
|
||||
'ledger_source' => 'wallet_txn',
|
||||
'funding_mode' => $p?->funding_mode,
|
||||
'auth_source' => $p?->auth_source,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user