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

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

@@ -17,12 +17,13 @@ use plugin\saiadmin\basic\think\BaseModel;
* @property $id ID
* @property $player_id 用户id
* @property $coin 平台币变化
* @property $type 类型
* @property $type 类型:0=充值 1=提现 2=购买抽奖次数
* @property $wallet_before 钱包操作前
* @property $wallet_after 钱包操作后
* @property $total_draw_count 总抽奖次数
* @property $paid_draw_count 购买抽奖次数
* @property $free_draw_count 赠送抽奖次数
* @property $remark 备注
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
@@ -48,4 +49,49 @@ class DicePlayerWalletRecord extends BaseModel
return $this->belongsTo(DicePlayer::class, 'player_id', 'id');
}
/**
* 类型 搜索
*/
public function searchTypeAttr($query, $value)
{
if ($value !== '' && $value !== null) {
$query->where('type', '=', $value);
}
}
/**
* 按关联玩家用户名搜索dicePlayer.username
*/
public function searchUsernameAttr($query, $value)
{
if ($value === '' || $value === null) {
return;
}
$playerIds = DicePlayer::where('username', 'like', '%' . $value . '%')->column('id');
if (!empty($playerIds)) {
$query->whereIn('player_id', $playerIds);
} else {
$query->whereRaw('1=0');
}
}
/**
* 平台币下限 搜索withSearch 用 Str::studly 故方法名为 searchCoinMinAttr
*/
public function searchCoinMinAttr($query, $value)
{
if ($value !== '' && $value !== null) {
$query->where('coin', '>=', $value);
}
}
/**
* 平台币上限 搜索withSearch 用 Str::studly 故方法名为 searchCoinMaxAttr
*/
public function searchCoinMaxAttr($query, $value)
{
if ($value !== '' && $value !== null) {
$query->where('coin', '<=', $value);
}
}
}