1.压注记录修改为游玩记录

2.测试结算并测试
3.备份数据库
This commit is contained in:
2026-04-23 17:21:02 +08:00
parent 1531115a26
commit f2b4dab54f
20 changed files with 2130 additions and 94 deletions

View File

@@ -599,6 +599,9 @@ class Channel extends Backend
if ($response !== null) {
return $response;
}
if (!$this->auth->isSuperAdmin()) {
return $this->error('仅超管可执行结算,结算后系统会自动发放至管理员钱包');
}
$id = (int) ($request->post('id', $request->get('id', 0)));
if ($id <= 0) {
@@ -614,18 +617,11 @@ class Channel extends Backend
$remark = trim((string) $request->post('remark', ''));
if ($this->auth->isSuperAdmin()) {
$res = ChannelSettlementService::settleBySuperAdmin((int) $row['id'], intval($this->auth->id), $remark, false);
if (($res['ok'] ?? false) !== true) {
return $this->error((string) ($res['msg'] ?? '结算失败'));
}
return $this->success('超管结算完成,渠道分红余额已入账');
}
$res = ChannelSettlementService::settleDividendByChannelAdmin((int) $row['id'], intval($this->auth->id), $remark);
$res = ChannelSettlementService::settleBySuperAdmin((int) $row['id'], intval($this->auth->id), $remark, false);
if (($res['ok'] ?? false) !== true) {
return $this->error((string) ($res['msg'] ?? '结算失败'));
}
return $this->success('渠道分红已结算完成');
return $this->success('超管结算完成,已按分配比例自动发放给管理员');
}
/**

View File

@@ -0,0 +1,77 @@
<?php
namespace app\admin\controller\admin;
use app\common\controller\Backend;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 管理员钱包(只读)
*/
class AdminWallet extends Backend
{
protected ?object $model = null;
protected bool $modelValidate = false;
protected string|array $quickSearchField = ['id', 'admin_id'];
protected string|array $defaultSortField = ['id' => 'desc'];
protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['admin'];
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\AdminWallet();
return null;
}
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
// 非超管仅可查看自己钱包
$where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)];
}
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible([
'admin' => ['username', 'channel_id'],
])
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
protected function _add(): Response
{
return $this->error('管理员钱包不允许手动新增');
}
protected function _edit(): Response
{
return $this->error('管理员钱包不允许手动编辑');
}
protected function _del(): Response
{
return $this->error('管理员钱包不允许删除');
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace app\admin\controller\admin;
use app\common\controller\Backend;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 管理员钱包流水(只读)
*/
class AdminWalletRecord extends Backend
{
protected ?object $model = null;
protected bool $modelValidate = false;
protected string|array $quickSearchField = ['id', 'biz_type', 'ref_type', 'idempotency_key', 'remark'];
protected string|array $defaultSortField = ['id' => 'desc'];
protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['admin', 'channel', 'operatorAdmin'];
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\AdminWalletRecord();
return null;
}
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
$where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)];
}
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible([
'admin' => ['username'],
'channel' => ['name'],
'operatorAdmin' => ['username'],
])
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
protected function _add(): Response
{
return $this->error('管理员钱包流水不允许手动新增');
}
protected function _edit(): Response
{
return $this->error('管理员钱包流水不允许手动编辑');
}
protected function _del(): Response
{
return $this->error('管理员钱包流水不允许删除');
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace app\admin\controller\game;
use app\common\controller\Backend;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 游玩记录(原压注订单)
*/
class PlayRecord extends Backend
{
protected ?object $model = null;
protected bool $modelValidate = false;
protected string|array $quickSearchField = ['id', 'period_no', 'idempotency_key'];
protected string|array $defaultSortField = ['id' => 'desc'];
protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['user', 'channel', 'gameRecord'];
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\PlayRecord();
return null;
}
public function add(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('游玩记录由游戏接口生成,禁止后台手工新增');
}
public function edit(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可编辑');
}
public function del(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可删除');
}
public function sortable(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
}
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
$where[] = ['user.admin_id', 'in', $this->scopedAdminIds()];
}
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible([
'user' => ['username', 'phone'],
'channel' => ['name'],
'gameRecord' => ['period_no', 'status'],
])
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
/**
* @return int[]
*/
private function scopedAdminIds(): array
{
if (!$this->auth) {
return [0];
}
if ($this->auth->isSuperAdmin()) {
return [];
}
$groupIds = $this->auth->getAdminChildGroups();
$adminIds = $groupIds ? $this->auth->getGroupAdmins($groupIds) : [];
$adminIds[] = $this->auth->id;
$adminIds = array_map(static fn($id) => intval(strval($id)), $adminIds);
$adminIds = array_values(array_unique(array_filter($adminIds, static fn($id) => $id > 0)));
return $adminIds === [] ? [0] : $adminIds;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace app\common\model;
use app\common\service\GameLiveService;
use support\think\Model;
use Throwable;
class PlayRecord extends Model
{
protected $name = 'game_play_record';
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'pick_numbers' => 'json',
'total_amount' => 'string',
'win_amount' => 'string',
'jackpot_extra_amount' => 'string',
'status' => 'integer',
'streak_at_bet' => 'integer',
'is_auto' => 'integer',
];
public function user(): \think\model\relation\BelongsTo
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
public function channel(): \think\model\relation\BelongsTo
{
return $this->belongsTo(Channel::class, 'channel_id', 'id');
}
protected static function onAfterInsert($model): void
{
try {
$periodId = isset($model['period_id']) ? intval($model['period_id']) : null;
GameLiveService::publishSnapshot($periodId);
} catch (Throwable) {
}
}
public function gameRecord(): \think\model\relation\BelongsTo
{
return $this->belongsTo(GameRecord::class, 'period_id', 'id');
}
}

View File

@@ -27,7 +27,15 @@ class AdminWalletService
return Db::name('admin_wallet')->where('admin_id', $adminId)->find() ?: [];
}
public static function creditCommission(int $adminId, ?int $channelId, string $amount, string $refType, int $refId, string $remark): void
public static function creditCommission(
int $adminId,
?int $channelId,
string $amount,
string $refType,
int $refId,
string $remark,
?int $operatorAdminId = null
): void
{
$wallet = self::ensureWallet($adminId);
$before = strval($wallet['balance'] ?? '0.00');
@@ -49,7 +57,7 @@ class AdminWalletService
'ref_type' => $refType,
'ref_id' => $refId,
'idempotency_key' => 'commission_income_' . $adminId . '_' . $refId,
'operator_admin_id' => null,
'operator_admin_id' => $operatorAdminId,
'remark' => $remark,
'create_time' => $now,
]);

View File

@@ -37,7 +37,7 @@ class ChannelSettlementService
'total_bet_amount' => $payload['total_bet_amount'],
'total_payout_amount' => $payload['total_payout_amount'],
'platform_profit_amount' => $payload['platform_profit_amount'],
'status' => 1,
'status' => 2,
'remark' => $remark !== '' ? $remark : (($auto ? '自动' : '手动') . '渠道结算-CH' . $channelId),
'create_time' => $now,
'update_time' => $now,
@@ -54,9 +54,32 @@ class ChannelSettlementService
if ($rows === []) {
throw new \RuntimeException('生成待分红记录失败');
}
Db::name('agent_commission_record')->insertAll($rows);
foreach ($rows as $row) {
$adminId = intval($row['admin_id'] ?? 0);
$amount = strval($row['commission_amount'] ?? '0.00');
if ($adminId <= 0) {
continue;
}
$row['status'] = 1;
$row['settled_at'] = $now;
$row['remark'] = strval($row['remark'] ?? '') . ' | 超管结算直接发放';
$row['update_time'] = $now;
$commissionRecordId = intval(Db::name('agent_commission_record')->insertGetId($row));
if (bccomp($amount, '0.00', 2) > 0) {
AdminWalletService::creditCommission(
$adminId,
$channelId,
$amount,
'agent_commission_record',
$commissionRecordId,
$remark !== '' ? $remark : '超管结算自动发放分红',
$operatorAdminId
);
}
}
// 已改为超管结算即发放,结算后不再保留渠道待分红余额。
Db::name('channel')->where('id', $channelId)->update([
'carryover_balance' => Db::raw('carryover_balance + ' . strval($payload['commission_amount'])),
'carryover_balance' => '0.00',
'update_time' => $now,
]);
Db::commit();
@@ -69,83 +92,7 @@ class ChannelSettlementService
public static function settleDividendByChannelAdmin(int $channelId, int $operatorAdminId, string $remark = ''): array
{
$channel = Db::name('channel')->where('id', $channelId)->find();
if (!is_array($channel)) {
return ['ok' => false, 'msg' => '渠道不存在'];
}
$carryover = strval($channel['carryover_balance'] ?? '0.00');
if (bccomp($carryover, '0', 2) <= 0) {
return ['ok' => false, 'msg' => '当前渠道没有分红余额,待下周期结算'];
}
$pendingRows = Db::name('agent_commission_record')
->where('channel_id', $channelId)
->where('status', 0)
->order('id', 'asc')
->select()
->toArray();
if ($pendingRows === []) {
return ['ok' => false, 'msg' => '当前渠道没有待分红记录,待下周期结算'];
}
$totalPending = '0.00';
foreach ($pendingRows as $pendingRow) {
$totalPending = bcadd($totalPending, strval($pendingRow['commission_amount'] ?? '0.00'), 2);
}
if (bccomp($carryover, $totalPending, 2) < 0) {
return ['ok' => false, 'msg' => '渠道可分红余额不足,请联系超管核对结算'];
}
$now = time();
Db::startTrans();
try {
foreach ($pendingRows as $pendingRow) {
$amount = strval($pendingRow['commission_amount'] ?? '0.00');
$adminId = intval($pendingRow['admin_id'] ?? 0);
if ($adminId <= 0 || bccomp($amount, '0', 2) <= 0) {
continue;
}
AdminWalletService::creditCommission(
$adminId,
$channelId,
$amount,
'agent_commission_record',
intval($pendingRow['id'] ?? 0),
$remark !== '' ? $remark : '渠道分红结算入账'
);
}
Db::name('agent_commission_record')
->where('channel_id', $channelId)
->where('status', 0)
->update([
'status' => 1,
'settled_at' => $now,
'update_time' => $now,
'remark' => Db::raw("CONCAT(remark, ' | 渠道结算确认')"),
]);
Db::name('channel')->where('id', $channelId)->update([
'carryover_balance' => bcsub($carryover, $totalPending, 2),
'update_time' => $now,
]);
$periodIds = Db::name('agent_commission_record')->where('channel_id', $channelId)->where('status', 1)->column('settlement_period_id');
if ($periodIds !== []) {
foreach ($periodIds as $periodIdRaw) {
$periodId = intval($periodIdRaw);
if ($periodId <= 0) {
continue;
}
$left = intval(Db::name('agent_commission_record')->where('settlement_period_id', $periodId)->where('status', 0)->count());
if ($left === 0) {
Db::name('agent_settlement_period')->where('id', $periodId)->update([
'status' => 2,
'update_time' => $now,
]);
}
}
}
Db::commit();
} catch (Throwable $e) {
Db::rollback();
return ['ok' => false, 'msg' => $e->getMessage()];
}
return ['ok' => true, 'settled_amount' => $totalPending];
return ['ok' => false, 'msg' => '当前流程为超管结算后自动发放,渠道管理员无需二次结算'];
}
public static function settleAllDueChannels(int $operatorAdminId): array

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
export default {
id: 'id',
admin_id: 'admin_id',
admin_username: 'admin_username',
channel_id: 'channel_id',
balance: 'available_balance',
frozen_balance: 'frozen_balance',
total_income: 'total_income',
total_withdraw: 'total_withdraw',
create_time: 'create_time',
update_time: 'update_time',
'quick Search Fields': 'id,admin_id,admin_username',
}

View File

@@ -0,0 +1,21 @@
export default {
id: 'id',
admin_id: 'admin_id',
admin_username: 'admin_username',
channel_name: 'channel',
biz_type: 'biz_type',
direction: 'direction',
'direction in': 'Credit',
'direction out': 'Debit',
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_admin',
remark: 'remark',
create_time: 'create_time',
'quick Search Fields': 'id,biz_type,ref_type,idempotency_key,remark',
}

View File

@@ -70,6 +70,7 @@ export default {
manual_settle_commission_rate: 'Commission rate (decimal)',
manual_settle_calc_base: 'Settlement base',
manual_settle_commission_amount: 'Commission amount',
manual_settle_submit: 'Settle',
manual_settle_remark: 'Remark',
share_config: 'Share config',
share_config_title: 'Channel admin share config',

View File

@@ -0,0 +1,34 @@
export default {
'quick Search Fields': 'ID / Period / Idempotency',
id: 'ID',
period_id: 'Period ID',
period_no: 'Period No.',
user_id: 'User ID',
channel_id: 'Channel ID',
pick_numbers: 'Picks',
total_amount: 'Play amount',
streak_at_bet: 'Streak at bet',
is_auto: 'Auto',
'is_auto 0': 'Manual',
'is_auto 1': 'Auto bet',
win_amount: 'Payout',
jackpot_extra_amount: 'Jackpot extra',
status: 'Status',
'status 1': 'Pending draw',
'status 2': 'Settled',
'status 3': 'Refunded',
idempotency_key: 'Idempotency key',
create_time: 'Created',
update_time: 'Updated',
gameRecord_period_no: 'Round (relation)',
gameRecord_status: 'Round status',
'gameRecord_status 0': 'Open for betting',
'gameRecord_status 1': 'Closed',
'gameRecord_status 2': 'Settling tickets',
'gameRecord_status 3': 'Paying out',
'gameRecord_status 4': 'Finished',
'gameRecord_status 5': 'Voided',
user_username: 'Username',
channel_name: 'Channel',
}

View File

@@ -0,0 +1,14 @@
export default {
id: 'ID',
admin_id: '管理员ID',
admin_username: '管理员账号',
channel_id: '渠道ID',
balance: '可用余额',
frozen_balance: '冻结余额',
total_income: '累计入账',
total_withdraw: '累计提现',
create_time: '创建时间',
update_time: '更新时间',
'quick Search Fields': 'ID、管理员ID、管理员账号',
}

View File

@@ -0,0 +1,21 @@
export default {
id: 'ID',
admin_id: '管理员ID',
admin_username: '管理员账号',
channel_name: '渠道',
biz_type: '业务类型',
direction: '方向',
'direction in': '入账',
'direction out': '出账',
amount: '变动金额',
balance_before: '变动前余额',
balance_after: '变动后余额',
ref_type: '来源类型',
ref_id: '来源ID',
idempotency_key: '幂等键',
operator_admin_username: '操作管理员',
remark: '备注',
create_time: '创建时间',
'quick Search Fields': 'ID、业务类型、来源类型、幂等键、备注',
}

View File

@@ -70,6 +70,7 @@ export default {
manual_settle_commission_rate: '佣金比例(小数)',
manual_settle_calc_base: '结算基数',
manual_settle_commission_amount: '佣金金额',
manual_settle_submit: '结算',
manual_settle_remark: '备注',
share_config: '分配比例',
share_config_title: '渠道管理员分配比例',

View File

@@ -0,0 +1,34 @@
export default {
'quick Search Fields': 'ID/期号/幂等键',
id: 'ID',
period_id: '对局ID',
period_no: '期号',
user_id: '用户ID',
channel_id: '渠道ID',
pick_numbers: '选号',
total_amount: '游玩金额',
streak_at_bet: '下注时连胜',
is_auto: '托管',
'is_auto 0': '手动',
'is_auto 1': '托管',
win_amount: '派彩',
jackpot_extra_amount: 'Jackpot',
status: '状态',
'status 1': '待开奖',
'status 2': '已结算',
'status 3': '已退款',
idempotency_key: '幂等键',
create_time: '创建时间',
update_time: '更新时间',
gameRecord_period_no: '对局期号',
gameRecord_status: '期状态',
'gameRecord_status 0': '下注开放',
'gameRecord_status 1': '已封盘',
'gameRecord_status 2': '算票中',
'gameRecord_status 3': '派彩中',
'gameRecord_status 4': '已结束',
'gameRecord_status 5': '已作废',
user_username: '用户名',
channel_name: '渠道',
}

View File

@@ -0,0 +1,76 @@
<template>
<div class="default-main ba-table-box">
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
<TableHeader :buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']" :quick-search-placeholder="t('Quick search placeholder', { fields: t('admin.adminWallet.quick Search Fields') })" />
<Table ref="tableRef"></Table>
</div>
</template>
<script setup lang="ts">
import { onMounted, provide, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import { baTableApi } from '/@/api/common'
import TableHeader from '/@/components/table/header/index.vue'
import Table from '/@/components/table/index.vue'
import baTableClass from '/@/utils/baTable'
defineOptions({
name: 'admin/adminWallet',
})
const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
const baTable = new baTableClass(
new baTableApi('/admin/admin.AdminWallet/'),
{
pk: 'id',
column: [
{ type: 'selection', align: 'center', operator: false },
{ label: t('admin.adminWallet.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
{ label: t('admin.adminWallet.admin_id'), prop: 'admin_id', align: 'center', width: 90, operator: 'RANGE', sortable: false },
{ label: t('admin.adminWallet.admin_username'), prop: 'admin.username', align: 'center', minWidth: 140, operator: 'LIKE' },
{ label: t('admin.adminWallet.channel_id'), prop: 'admin.channel_id', align: 'center', width: 100, operator: 'RANGE' },
{ label: t('admin.adminWallet.balance'), prop: 'balance', align: 'center', minWidth: 120, operator: 'RANGE' },
{ label: t('admin.adminWallet.frozen_balance'), prop: 'frozen_balance', align: 'center', minWidth: 120, operator: 'RANGE' },
{ label: t('admin.adminWallet.total_income'), prop: 'total_income', align: 'center', minWidth: 120, operator: 'RANGE' },
{ label: t('admin.adminWallet.total_withdraw'), prop: 'total_withdraw', align: 'center', minWidth: 120, operator: 'RANGE' },
{
label: t('admin.adminWallet.create_time'),
prop: 'create_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 160,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
{
label: t('admin.adminWallet.update_time'),
prop: 'update_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 160,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
],
},
{}
)
provide('baTable', baTable)
onMounted(() => {
baTable.table.ref = tableRef.value
baTable.mount()
baTable.getData()?.then(() => {
baTable.initSort()
baTable.dragSort()
})
})
</script>

View File

@@ -0,0 +1,80 @@
<template>
<div class="default-main ba-table-box">
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
<TableHeader :buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']" :quick-search-placeholder="t('Quick search placeholder', { fields: t('admin.adminWalletRecord.quick Search Fields') })" />
<Table ref="tableRef"></Table>
</div>
</template>
<script setup lang="ts">
import { onMounted, provide, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import { baTableApi } from '/@/api/common'
import TableHeader from '/@/components/table/header/index.vue'
import Table from '/@/components/table/index.vue'
import baTableClass from '/@/utils/baTable'
defineOptions({
name: 'admin/adminWalletRecord',
})
const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
const baTable = new baTableClass(
new baTableApi('/admin/admin.AdminWalletRecord/'),
{
pk: 'id',
column: [
{ type: 'selection', align: 'center', operator: false },
{ label: t('admin.adminWalletRecord.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
{ label: t('admin.adminWalletRecord.admin_id'), prop: 'admin_id', align: 'center', width: 90, operator: 'RANGE' },
{ label: t('admin.adminWalletRecord.admin_username'), prop: 'admin.username', align: 'center', minWidth: 130, operator: 'LIKE' },
{ label: t('admin.adminWalletRecord.channel_name'), prop: 'channel.name', align: 'center', minWidth: 120, operator: 'LIKE' },
{ label: t('admin.adminWalletRecord.biz_type'), prop: 'biz_type', align: 'center', minWidth: 140, operator: 'LIKE' },
{
label: t('admin.adminWalletRecord.direction'),
prop: 'direction',
align: 'center',
width: 100,
operator: 'eq',
render: 'tag',
custom: { 1: 'success', 2: 'warning' },
replaceValue: { 1: t('admin.adminWalletRecord.direction in'), 2: t('admin.adminWalletRecord.direction out') },
},
{ label: t('admin.adminWalletRecord.amount'), prop: 'amount', align: 'center', minWidth: 100, operator: 'RANGE' },
{ label: t('admin.adminWalletRecord.balance_before'), prop: 'balance_before', align: 'center', minWidth: 110, operator: 'RANGE' },
{ label: t('admin.adminWalletRecord.balance_after'), prop: 'balance_after', align: 'center', minWidth: 110, operator: 'RANGE' },
{ label: t('admin.adminWalletRecord.ref_type'), prop: 'ref_type', align: 'center', minWidth: 120, operator: 'LIKE' },
{ label: t('admin.adminWalletRecord.ref_id'), prop: 'ref_id', align: 'center', minWidth: 100, operator: 'RANGE' },
{ label: t('admin.adminWalletRecord.idempotency_key'), prop: 'idempotency_key', align: 'center', minWidth: 180, operator: 'LIKE' },
{ label: t('admin.adminWalletRecord.operator_admin_username'), prop: 'operatorAdmin.username', align: 'center', minWidth: 130, operator: 'LIKE' },
{ label: t('admin.adminWalletRecord.remark'), prop: 'remark', align: 'center', minWidth: 180, operator: 'LIKE', showOverflowTooltip: true },
{
label: t('admin.adminWalletRecord.create_time'),
prop: 'create_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 160,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
],
},
{}
)
provide('baTable', baTable)
onMounted(() => {
baTable.table.ref = tableRef.value
baTable.mount()
baTable.getData()?.then(() => {
baTable.initSort()
baTable.dragSort()
})
})
</script>

View File

@@ -33,7 +33,7 @@
<el-radio-button label="enabled">{{ t('channel.settle_filter_enabled') }}</el-radio-button>
<el-radio-button label="disabled">{{ t('channel.settle_filter_disabled') }}</el-radio-button>
</el-radio-group>
<el-button v-if="auth('batchSettlePending')" type="warning" @click="onBatchSettlePending">
<el-button v-if="adminInfo.super && auth('batchSettlePending')" type="warning" @click="onBatchSettlePending">
{{ t('channel.batch_settle_pending') }}
</el-button>
</div>
@@ -100,7 +100,7 @@
<div class="manual-settle-footer">
<el-button @click="closeManualSettleDialog">{{ t('Cancel') }}</el-button>
<el-button type="primary" :disabled="manualSettle.previewLoading" :loading="manualSettle.loading" @click="submitManualSettle">
{{ t('Save') }}
{{ t('channel.manual_settle_submit') }}
</el-button>
</div>
</template>
@@ -161,6 +161,7 @@ import { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue'
import { baTableApi } from '/@/api/common'
import { auth } from '/@/utils/common'
import { useAdminInfo } from '/@/stores/adminInfo'
import { defaultOptButtons } from '/@/components/table'
import TableHeader from '/@/components/table/header/index.vue'
import Table from '/@/components/table/index.vue'
@@ -172,6 +173,7 @@ defineOptions({
})
const { t } = useI18n()
const adminInfo = useAdminInfo()
const tableRef = useTemplateRef('tableRef')
let optButtons: OptButton[] = [
{
@@ -197,7 +199,7 @@ let optButtons: OptButton[] = [
icon: 'el-icon-Clock',
class: 'table-row-manual-settle',
disabledTip: false,
display: () => auth('manualSettle'),
display: () => adminInfo.super && auth('manualSettle'),
click: (row: TableRow) => {
void openManualSettleDialog(row)
},

View File

@@ -0,0 +1,188 @@
<template>
<div class="default-main ba-table-box">
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
<TableHeader
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.playRecord.quick Search Fields') })"
></TableHeader>
<Table ref="tableRef"></Table>
</div>
</template>
<script setup lang="ts">
import { onMounted, provide, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import { baTableApi } from '/@/api/common'
import TableHeader from '/@/components/table/header/index.vue'
import Table from '/@/components/table/index.vue'
import baTableClass from '/@/utils/baTable'
defineOptions({
name: 'game/playRecord',
})
const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
function formatPickNumbers(_row: anyObj, _column: any, cellValue: unknown) {
if (cellValue === null || cellValue === undefined) {
return '-'
}
if (typeof cellValue === 'string') {
return cellValue
}
try {
return JSON.stringify(cellValue)
} catch {
return String(cellValue)
}
}
function formatAmount(_row: anyObj, _column: any, cellValue: unknown) {
if (cellValue === null || cellValue === undefined || cellValue === '') {
return '-'
}
const s = String(cellValue).trim().replace(',', '.')
const n = parseFloat(s)
if (!Number.isFinite(n)) {
return String(cellValue)
}
return n.toFixed(2)
}
const baTable = new baTableClass(
new baTableApi('/admin/game.PlayRecord/'),
{
pk: 'id',
column: [
{ label: t('game.playRecord.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
{ label: t('game.playRecord.period_id'), prop: 'period_id', align: 'center', show: false, width: 100, operator: 'RANGE' },
{
label: t('game.playRecord.gameRecord_period_no'),
prop: 'gameRecord.period_no',
align: 'center',
minWidth: 200,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
render: 'tag',
},
{
label: t('game.playRecord.gameRecord_status'),
prop: 'gameRecord.status',
align: 'center',
width: 100,
operator: 'eq',
render: 'tag',
effect: 'dark',
custom: { '0': 'success', '1': 'warning', '2': 'info', '3': 'primary', '4': 'warning', '5': 'danger' },
replaceValue: {
'0': t('game.playRecord.gameRecord_status 0'),
'1': t('game.playRecord.gameRecord_status 1'),
'2': t('game.playRecord.gameRecord_status 2'),
'3': t('game.playRecord.gameRecord_status 3'),
'4': t('game.playRecord.gameRecord_status 4'),
'5': t('game.playRecord.gameRecord_status 5'),
},
},
{ label: t('game.playRecord.user_id'), prop: 'user_id', align: 'center', show: false, width: 90, operator: 'RANGE' },
{
label: t('game.playRecord.user_username'),
prop: 'user.username',
align: 'center',
minWidth: 120,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
render: 'tags',
},
{
label: t('game.playRecord.channel_name'),
prop: 'channel.name',
align: 'center',
minWidth: 100,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
render: 'tags',
},
{ label: t('game.playRecord.pick_numbers'), prop: 'pick_numbers', align: 'center', minWidth: 120, operator: false, formatter: formatPickNumbers },
{ label: t('game.playRecord.total_amount'), prop: 'total_amount', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount },
{ label: t('game.playRecord.streak_at_bet'), prop: 'streak_at_bet', align: 'center', width: 110, operator: 'RANGE' },
{
label: t('game.playRecord.is_auto'),
prop: 'is_auto',
align: 'center',
width: 90,
operator: 'eq',
render: 'tag',
custom: { '0': 'info', '1': 'primary' },
replaceValue: { '0': t('game.playRecord.is_auto 0'), '1': t('game.playRecord.is_auto 1') },
},
{ label: t('game.playRecord.win_amount'), prop: 'win_amount', align: 'center', minWidth: 110, operator: 'RANGE', formatter: formatAmount },
{ label: t('game.playRecord.jackpot_extra_amount'), prop: 'jackpot_extra_amount', align: 'center', minWidth: 120, operator: 'RANGE', formatter: formatAmount },
{
label: t('game.playRecord.status'),
prop: 'status',
align: 'center',
width: 100,
operator: 'eq',
render: 'tag',
effect: 'dark',
custom: { '1': 'warning', '2': 'success', '3': 'danger' },
replaceValue: {
'1': t('game.playRecord.status 1'),
'2': t('game.playRecord.status 2'),
'3': t('game.playRecord.status 3'),
},
},
{
label: t('game.playRecord.idempotency_key'),
prop: 'idempotency_key',
align: 'center',
minWidth: 140,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
showOverflowTooltip: true,
},
{
label: t('game.playRecord.create_time'),
prop: 'create_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 170,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
{
label: t('game.playRecord.update_time'),
prop: 'update_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 170,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
],
dblClickNotEditColumn: [undefined],
},
{}
)
provide('baTable', baTable)
onMounted(() => {
baTable.table.ref = tableRef.value
baTable.mount()
baTable.getData()?.then(() => {
baTable.initSort()
baTable.dragSort()
})
})
</script>
<style scoped lang="scss"></style>