[色子游戏]玩家钱包流水记录-优化样式

This commit is contained in:
2026-03-03 15:15:16 +08:00
parent ae3c0f0f78
commit 1b62a4f3e0
9 changed files with 334 additions and 110 deletions

View File

@@ -9,6 +9,7 @@ namespace app\dice\controller\player_wallet_record;
use plugin\saiadmin\basic\BaseController;
use app\dice\logic\player_wallet_record\DicePlayerWalletRecordLogic;
use app\dice\validate\player_wallet_record\DicePlayerWalletRecordValidate;
use app\dice\model\player\DicePlayer;
use plugin\saiadmin\service\Permission;
use support\Request;
use support\Response;
@@ -38,6 +39,9 @@ class DicePlayerWalletRecordController extends BaseController
{
$where = $request->more([
['type', ''],
['username', ''],
['coin_min', ''],
['coin_max', ''],
]);
$query = $this->logic->search($where);
$query->with([
@@ -47,6 +51,41 @@ class DicePlayerWalletRecordController extends BaseController
return $this->success($data);
}
/**
* 获取玩家选项id、username用于下拉
* @param Request $request
* @return Response
*/
#[Permission('玩家钱包流水列表', 'dice:player_wallet_record:index:index')]
public function getPlayerOptions(Request $request): Response
{
$list = DicePlayer::field('id,username')->select();
$data = $list->map(function ($item) {
return ['id' => $item['id'], 'username' => $item['username'] ?? ''];
})->toArray();
return $this->success($data);
}
/**
* 获取指定玩家当前平台币(用于钱包操作前)
* 类型 0=充值 1=提现 2=购买抽奖次数,操作前均为当前平台币
* @param Request $request
* @return Response
*/
#[Permission('玩家钱包流水读取', 'dice:player_wallet_record:index:read')]
public function getPlayerWalletBefore(Request $request): Response
{
$playerId = $request->input('player_id');
if ($playerId === null || $playerId === '') {
return $this->fail('缺少 player_id');
}
$player = DicePlayer::field('coin')->where('id', $playerId)->find();
if (!$player) {
return $this->fail('玩家不存在');
}
return $this->success(['wallet_before' => (float) $player['coin']]);
}
/**
* 读取数据
* @param Request $request