[游戏管理]玩家钱包流水

This commit is contained in:
2026-04-15 17:46:26 +08:00
parent f88afbcadb
commit 569f9e7749
7 changed files with 113 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace app\admin\controller\game; namespace app\admin\controller\record;
use app\common\controller\Backend; use app\common\controller\Backend;
use support\think\Db; use support\think\Db;
@@ -22,11 +22,11 @@ class UserWalletRecord extends Backend
protected string|array $orderGuarantee = ['id' => 'desc']; protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['gameUser', 'channel', 'operatorAdmin']; protected array $withJoinTable = ['user', 'channel', 'operatorAdmin'];
protected function initController(WebmanRequest $request): ?Response protected function initController(WebmanRequest $request): ?Response
{ {
$this->model = new \app\common\model\GameUserWalletRecord(); $this->model = new \app\common\model\UserWalletRecord();
return null; return null;
} }
@@ -87,7 +87,7 @@ class UserWalletRecord extends Backend
->withJoin($this->withJoinTable, $this->withJoinType) ->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable) ->with($this->withJoinTable)
->visible([ ->visible([
'gameUser' => ['username', 'phone'], 'user' => ['username', 'phone'],
'channel' => ['name'], 'channel' => ['name'],
'operatorAdmin' => ['username'], 'operatorAdmin' => ['username'],
]) ])

View File

@@ -5,11 +5,11 @@ namespace app\common\model;
use support\think\Model; use support\think\Model;
/** /**
* 玩家游戏币钱包流水(只增不改;余额变更须与 game_user.coin 条件更新同事务 * 用户钱包流水(原 game_user_wallet_record
*/ */
class GameUserWalletRecord extends Model class UserWalletRecord extends Model
{ {
protected $name = 'game_user_wallet_record'; protected $name = 'user_wallet_record';
protected $autoWriteTimestamp = false; protected $autoWriteTimestamp = false;
@@ -24,9 +24,9 @@ class GameUserWalletRecord extends Model
'balance_after' => 'string', 'balance_after' => 'string',
]; ];
public function gameUser(): \think\model\relation\BelongsTo public function user(): \think\model\relation\BelongsTo
{ {
return $this->belongsTo(GameUser::class, 'user_id', 'id'); return $this->belongsTo(User::class, 'user_id', 'id');
} }
public function channel(): \think\model\relation\BelongsTo public function channel(): \think\model\relation\BelongsTo

View File

@@ -1,7 +1,7 @@
export default { export default {
id: 'Record ID', id: 'Record ID',
user_id: 'User ID', user_id: 'User ID',
'game_user__username': 'Username', 'user__username': 'Username',
'channel__name': 'Channel', 'channel__name': 'Channel',
biz_type: 'Biz type', biz_type: 'Biz type',
direction: 'Direction', direction: 'Direction',

View File

@@ -0,0 +1,33 @@
export default {
id: 'Record ID',
user_id: 'User ID',
'user__username': 'Username',
'channel__name': 'Channel',
biz_type: 'Biz type',
direction: 'Direction',
amount: 'Amount',
balance_before: 'Balance before',
balance_after: 'Balance after',
ref_type: 'Ref type',
ref_id: 'Ref ID',
idempotency_key: 'Idempotency key',
'operator_admin__username': 'Operator',
remark: 'Remark',
create_time: 'Created at',
'quick Search Fields': 'ID, biz type, ref type, remark, idempotency key',
'direction in': 'Credit',
'direction out': 'Debit',
'biz deposit': 'Deposit',
'biz withdraw': 'Withdraw',
'biz withdraw_freeze': 'Withdraw freeze',
'biz withdraw_unfreeze': 'Withdraw unfreeze',
'biz platform_in': 'Platform credit',
'biz platform_out': 'Platform debit',
'biz admin_credit': 'Admin credit',
'biz admin_deduct': 'Admin debit',
'biz bet': 'Bet',
'biz payout': 'Payout',
'biz fee': 'Fee',
'biz void_refund': 'Void refund',
'biz adjust': 'Adjustment',
}

View File

@@ -1,7 +1,7 @@
export default { export default {
id: '流水ID', id: '流水ID',
user_id: '用户ID', user_id: '用户ID',
'game_user__username': '用户名', 'user__username': '用户名',
'channel__name': '渠道', 'channel__name': '渠道',
biz_type: '业务类型', biz_type: '业务类型',
direction: '方向', direction: '方向',

View File

@@ -0,0 +1,33 @@
export default {
id: '流水ID',
user_id: '用户ID',
'user__username': '用户名',
'channel__name': '渠道',
biz_type: '业务类型',
direction: '方向',
amount: '变动额',
balance_before: '变动前余额',
balance_after: '变动后余额',
ref_type: '关联类型',
ref_id: '关联ID',
idempotency_key: '幂等键',
'operator_admin__username': '操作管理员',
remark: '备注',
create_time: '创建时间',
'quick Search Fields': 'ID、业务类型、关联类型、备注、幂等键',
'direction in': '入金',
'direction out': '出金',
'biz deposit': '充值入账',
'biz withdraw': '提现出账',
'biz withdraw_freeze': '提现冻结',
'biz withdraw_unfreeze': '提现解冻',
'biz platform_in': '平台划入',
'biz platform_out': '平台划出',
'biz admin_credit': '管理员加币',
'biz admin_deduct': '管理员扣币',
'biz bet': '下注扣款',
'biz payout': '派彩',
'biz fee': '手续费',
'biz void_refund': '作废退款',
'biz adjust': '其他调账',
}

View File

@@ -4,7 +4,7 @@
<TableHeader <TableHeader
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']" :buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.walletRecord.quick Search Fields') })" :quick-search-placeholder="t('Quick search placeholder', { fields: t('record.userWalletRecord.quick Search Fields') })"
></TableHeader> ></TableHeader>
<Table ref="tableRef"></Table> <Table ref="tableRef"></Table>
@@ -20,7 +20,7 @@ import Table from '/@/components/table/index.vue'
import baTableClass from '/@/utils/baTable' import baTableClass from '/@/utils/baTable'
defineOptions({ defineOptions({
name: 'game/walletRecord', name: 'record/userWalletRecord',
}) })
const { t } = useI18n() const { t } = useI18n()
@@ -39,34 +39,34 @@ function formatAmount(_row: anyObj, _column: any, cellValue: unknown) {
} }
const bizReplace = { const bizReplace = {
deposit: t('game.walletRecord.biz deposit'), deposit: t('record.userWalletRecord.biz deposit'),
withdraw: t('game.walletRecord.biz withdraw'), withdraw: t('record.userWalletRecord.biz withdraw'),
withdraw_freeze: t('game.walletRecord.biz withdraw_freeze'), withdraw_freeze: t('record.userWalletRecord.biz withdraw_freeze'),
withdraw_unfreeze: t('game.walletRecord.biz withdraw_unfreeze'), withdraw_unfreeze: t('record.userWalletRecord.biz withdraw_unfreeze'),
platform_in: t('game.walletRecord.biz platform_in'), platform_in: t('record.userWalletRecord.biz platform_in'),
platform_out: t('game.walletRecord.biz platform_out'), platform_out: t('record.userWalletRecord.biz platform_out'),
admin_credit: t('game.walletRecord.biz admin_credit'), admin_credit: t('record.userWalletRecord.biz admin_credit'),
admin_deduct: t('game.walletRecord.biz admin_deduct'), admin_deduct: t('record.userWalletRecord.biz admin_deduct'),
bet: t('game.walletRecord.biz bet'), bet: t('record.userWalletRecord.biz bet'),
payout: t('game.walletRecord.biz payout'), payout: t('record.userWalletRecord.biz payout'),
fee: t('game.walletRecord.biz fee'), fee: t('record.userWalletRecord.biz fee'),
void_refund: t('game.walletRecord.biz void_refund'), void_refund: t('record.userWalletRecord.biz void_refund'),
adjust: t('game.walletRecord.biz adjust'), adjust: t('record.userWalletRecord.biz adjust'),
} }
const dirReplace = { const dirReplace = {
'1': t('game.walletRecord.direction in'), '1': t('record.userWalletRecord.direction in'),
'2': t('game.walletRecord.direction out'), '2': t('record.userWalletRecord.direction out'),
} }
const baTable = new baTableClass( const baTable = new baTableClass(
new baTableApi('/admin/game.UserWalletRecord/'), new baTableApi('/admin/record.UserWalletRecord/'),
{ {
pk: 'id', pk: 'id',
column: [ column: [
{ label: t('game.walletRecord.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' }, { label: t('record.userWalletRecord.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
{ {
label: t('game.walletRecord.user_id'), label: t('record.userWalletRecord.user_id'),
prop: 'user_id', prop: 'user_id',
align: 'center', align: 'center',
width: 90, width: 90,
@@ -74,8 +74,8 @@ const baTable = new baTableClass(
sortable: false, sortable: false,
}, },
{ {
label: t('game.walletRecord.game_user__username'), label: t('record.userWalletRecord.user__username'),
prop: 'gameUser.username', prop: 'user.username',
align: 'center', align: 'center',
minWidth: 110, minWidth: 110,
operatorPlaceholder: t('Fuzzy query'), operatorPlaceholder: t('Fuzzy query'),
@@ -84,7 +84,7 @@ const baTable = new baTableClass(
comSearchRender: 'string', comSearchRender: 'string',
}, },
{ {
label: t('game.walletRecord.channel__name'), label: t('record.userWalletRecord.channel__name'),
prop: 'channel.name', prop: 'channel.name',
align: 'center', align: 'center',
minWidth: 100, minWidth: 100,
@@ -94,7 +94,7 @@ const baTable = new baTableClass(
comSearchRender: 'string', comSearchRender: 'string',
}, },
{ {
label: t('game.walletRecord.biz_type'), label: t('record.userWalletRecord.biz_type'),
prop: 'biz_type', prop: 'biz_type',
align: 'center', align: 'center',
minWidth: 120, minWidth: 120,
@@ -103,7 +103,7 @@ const baTable = new baTableClass(
replaceValue: bizReplace, replaceValue: bizReplace,
}, },
{ {
label: t('game.walletRecord.direction'), label: t('record.userWalletRecord.direction'),
prop: 'direction', prop: 'direction',
align: 'center', align: 'center',
width: 90, width: 90,
@@ -111,20 +111,20 @@ const baTable = new baTableClass(
render: 'tag', render: 'tag',
replaceValue: dirReplace, replaceValue: dirReplace,
}, },
{ label: t('game.walletRecord.amount'), prop: 'amount', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount }, { label: t('record.userWalletRecord.amount'), prop: 'amount', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount },
{ label: t('game.walletRecord.balance_before'), prop: 'balance_before', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount }, { label: t('record.userWalletRecord.balance_before'), prop: 'balance_before', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount },
{ label: t('game.walletRecord.balance_after'), prop: 'balance_after', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount }, { label: t('record.userWalletRecord.balance_after'), prop: 'balance_after', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount },
{ {
label: t('game.walletRecord.ref_type'), label: t('record.userWalletRecord.ref_type'),
prop: 'ref_type', prop: 'ref_type',
align: 'center', align: 'center',
minWidth: 100, minWidth: 100,
showOverflowTooltip: true, showOverflowTooltip: true,
operator: 'LIKE', operator: 'LIKE',
}, },
{ label: t('game.walletRecord.ref_id'), prop: 'ref_id', align: 'center', width: 100, operator: 'RANGE' }, { label: t('record.userWalletRecord.ref_id'), prop: 'ref_id', align: 'center', width: 100, operator: 'RANGE' },
{ {
label: t('game.walletRecord.idempotency_key'), label: t('record.userWalletRecord.idempotency_key'),
prop: 'idempotency_key', prop: 'idempotency_key',
align: 'center', align: 'center',
minWidth: 120, minWidth: 120,
@@ -132,7 +132,7 @@ const baTable = new baTableClass(
operator: 'LIKE', operator: 'LIKE',
}, },
{ {
label: t('game.walletRecord.operator_admin__username'), label: t('record.userWalletRecord.operator_admin__username'),
prop: 'operatorAdmin.username', prop: 'operatorAdmin.username',
align: 'center', align: 'center',
minWidth: 100, minWidth: 100,
@@ -142,7 +142,7 @@ const baTable = new baTableClass(
comSearchRender: 'string', comSearchRender: 'string',
}, },
{ {
label: t('game.walletRecord.remark'), label: t('record.userWalletRecord.remark'),
prop: 'remark', prop: 'remark',
align: 'center', align: 'center',
minWidth: 140, minWidth: 140,
@@ -150,7 +150,7 @@ const baTable = new baTableClass(
operator: 'LIKE', operator: 'LIKE',
}, },
{ {
label: t('game.walletRecord.create_time'), label: t('record.userWalletRecord.create_time'),
prop: 'create_time', prop: 'create_time',
align: 'center', align: 'center',
render: 'datetime', render: 'datetime',
@@ -178,3 +178,5 @@ onMounted(() => {
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>