5 Commits

Author SHA1 Message Date
a033bf47b6 1.优化game_config
2.备份MySQL数据库
2026-04-28 15:50:16 +08:00
9bc439ea5e 对搜索返回的消息做中英双版本 2026-04-28 15:22:50 +08:00
85133ee92b 优化游戏实时对局页面样式-增加预估赔付栏的排序 2026-04-28 15:09:02 +08:00
aefb8b16c8 优化游戏实时对局页面样式 2026-04-28 14:54:59 +08:00
d7375222ce 优化管理员管理目录中菜单的样式 2026-04-28 13:44:24 +08:00
53 changed files with 2430 additions and 344 deletions

View File

@@ -574,7 +574,7 @@ class Channel extends Backend
}
$rowsRaw = $request->post('list', []);
if (!is_array($rowsRaw) || $rowsRaw === []) {
return $this->error('请至少配置一条分配记录');
return $this->error(__('Please configure at least one share record'));
}
$adminIds = Db::name('admin')
@@ -585,7 +585,7 @@ class Channel extends Backend
$adminIdSet[(int) $adminId] = true;
}
if ($adminIdSet === []) {
return $this->error('该渠道下暂无管理员,无法配置分配比例');
return $this->error(__('There are no admins under this channel; cannot configure share ratios'));
}
$enabledSum = '0.00';
@@ -602,7 +602,7 @@ class Channel extends Backend
$shareRaw = $line['share_rate'] ?? null;
$shareRate = self::normalizeAmountScale($shareRaw === null ? '0' : (string) $shareRaw, 2);
if (bccomp($shareRate, '0', 2) < 0 || bccomp($shareRate, '100', 2) > 0) {
return $this->error('分配比例必须在0到100之间');
return $this->error(__('Share ratio must be between 0 and 100'));
}
if ($status === 1) {
$enabledSum = bcadd($enabledSum, $shareRate, 2);
@@ -617,10 +617,10 @@ class Channel extends Backend
];
}
if ($insertRows === []) {
return $this->error('请至少配置一条有效分配记录');
return $this->error(__('Please configure at least one valid share record'));
}
if (bccomp($enabledSum, '100.00', 2) !== 0) {
return $this->error('启用的分配比例总和必须等于100');
return $this->error(__('Sum of enabled share ratios must equal 100'));
}
Db::startTrans();
@@ -633,7 +633,7 @@ class Channel extends Backend
return $this->error($e->getMessage());
}
return $this->success('分配比例保存成功');
return $this->success(__('Share ratios saved successfully'));
}
/**
@@ -646,7 +646,7 @@ class Channel extends Backend
return $response;
}
if (!$this->auth->isSuperAdmin()) {
return $this->error('仅超管可执行结算,结算后系统会自动发放至管理员钱包');
return $this->error(__('Only super admin can settle; after settlement, commissions will be automatically paid to admin wallets'));
}
$id = (int) ($request->post('id', $request->get('id', 0)));
@@ -665,9 +665,9 @@ class Channel extends Backend
$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->error((string) ($res['msg'] ?? __('Settlement failed')));
}
return $this->success('超管结算完成,已按分配比例自动发放给管理员');
return $this->success(__('Super admin settlement completed; paid automatically by share ratios'));
}
/**
@@ -684,7 +684,7 @@ class Channel extends Backend
}
// 批量按钮语义:手动触发“待结算渠道”结算,不受结算周期到点限制。
$res = ChannelSettlementService::settleAllDueChannels(intval($this->auth->id), false);
return $this->success('批量结算完成', $res);
return $this->success(__('Batch settlement completed'), $res);
}
/**
@@ -738,7 +738,7 @@ class Channel extends Backend
{
$channelId = (int) ($row['id'] ?? 0);
if ($channelId <= 0) {
return '渠道数据异常';
return (string) __('Invalid channel data');
}
$endTs = time();
@@ -751,7 +751,7 @@ class Channel extends Backend
}
if ($periodStartTs >= $endTs) {
return '结算区间无效(开始时间不早于当前)';
return (string) __('Invalid settlement period (start time is not earlier than now)');
}
$stats = $this->aggregateBetOrderForChannel($channelId, $periodStartTs, $lastEnd !== null, $endTs);
@@ -864,7 +864,7 @@ class Channel extends Backend
if ($mode === 'turnover') {
$ratePercent = $row['turnover_share_rate'] ?? null;
if ($ratePercent === null || $ratePercent === '') {
return '普通返水代理未配置返水分红比例';
return (string) __('Turnover agent commission rate is not configured');
}
$rateDec = bcdiv((string) $ratePercent, '100', 2);
$amount = bcmul($totalBet, $rateDec, 2);
@@ -879,11 +879,11 @@ class Channel extends Backend
$fee = $row['affiliate_fee_rate'] ?? null;
$rulesRaw = $row['affiliate_ladder_rules'] ?? null;
if ($fee === null || $fee === '') {
return '联营代理未配置成本扣除比例';
return (string) __('Affiliate agent fee rate is not configured');
}
$rules = $this->normalizeLadderRulesForSettlement($rulesRaw);
if ($rules === []) {
return '联营阶梯规则无效或为空';
return (string) __('Affiliate ladder rules are empty or invalid');
}
if (bccomp($platformProfit, '0', 2) <= 0) {
@@ -915,7 +915,7 @@ class Channel extends Backend
];
}
return '未知的代理模式';
return (string) __('Unknown agent mode');
}
/**
@@ -1169,20 +1169,20 @@ class Channel extends Backend
{
$cycle = isset($data['settle_cycle']) ? trim((string) $data['settle_cycle']) : 'weekly';
if (!in_array($cycle, ['daily', 'weekly', 'monthly'], true)) {
return '结算周期不合法';
return (string) __('Invalid settlement cycle');
}
$data['settle_cycle'] = $cycle;
$settleTime = isset($data['settle_time']) ? trim((string) $data['settle_time']) : '02:00:00';
if (!preg_match('/^\d{2}:\d{2}:\d{2}$/', $settleTime)) {
return '结算时间格式不正确(HH:mm:ss';
return (string) __('Invalid settlement time format (HH:mm:ss)');
}
$data['settle_time'] = $settleTime;
if ($cycle === 'weekly') {
$weekday = isset($data['settle_weekday']) ? (int) $data['settle_weekday'] : 1;
if ($weekday < 1 || $weekday > 7) {
return '周结必须选择周一到周日';
return (string) __('Weekly settlement must select Monday to Sunday');
}
$data['settle_weekday'] = $weekday;
} else {
@@ -1192,7 +1192,7 @@ class Channel extends Backend
if ($cycle === 'monthly') {
$monthday = isset($data['settle_monthday']) ? (int) $data['settle_monthday'] : 1;
if ($monthday < 1 || $monthday > 31) {
return '月结日期必须在1到31之间';
return (string) __('Monthly settlement day must be between 1 and 31');
}
$data['settle_monthday'] = $monthday;
} else {
@@ -1204,7 +1204,7 @@ class Channel extends Backend
if (isset($data['turnover_share_rate']) && $data['turnover_share_rate'] !== '' && $data['turnover_share_rate'] !== null) {
$num = (float) $data['turnover_share_rate'];
if ($num < 0 || $num > 100) {
return '返水分红比例必须在0到100之间';
return (string) __('Turnover commission rate must be between 0 and 100');
}
}
return null;
@@ -1213,11 +1213,11 @@ class Channel extends Backend
if ($mode === 'affiliate') {
foreach (['affiliate_share_rate' => '联营占成比例', 'affiliate_fee_rate' => '联营成本扣除比例'] as $field => $label) {
if (!isset($data[$field]) || $data[$field] === '' || $data[$field] === null) {
return $label . '不能为空';
return (string) __('Affiliate share/fee rates are required');
}
$num = (float) $data[$field];
if ($num < 0 || $num > 1) {
return $label . '必须在0到1之间';
return (string) __('Affiliate share/fee rates must be between 0 and 1');
}
}
$ladderErr = $this->validateLadderRulesField($data);
@@ -1262,45 +1262,45 @@ class Channel extends Backend
{
$rulesRaw = $data['affiliate_ladder_rules'] ?? null;
if ($rulesRaw === null || $rulesRaw === '') {
return '联营阶梯规则不能为空';
return (string) __('Affiliate ladder rules are required');
}
if (is_string($rulesRaw)) {
$decoded = json_decode($rulesRaw, true);
if (!is_array($decoded)) {
return '联营阶梯规则必须是有效JSON数组';
return (string) __('Affiliate ladder rules must be a valid JSON array');
}
$rulesRaw = $decoded;
}
if (!is_array($rulesRaw) || $rulesRaw === []) {
return '联营阶梯规则至少需要一条';
return (string) __('Affiliate ladder rules must contain at least one row');
}
$normalized = [];
$prevMinLoss = null;
foreach ($rulesRaw as $idx => $rule) {
if (!is_array($rule)) {
return '联营阶梯规则第' . ($idx + 1) . '行格式错误';
return (string) __('Affiliate ladder rules row format error') . ' #' . ($idx + 1);
}
$minLoss = $rule['minLoss'] ?? ($rule['min_loss'] ?? null);
$shareRate = $rule['shareRate'] ?? ($rule['share_rate'] ?? null);
if ($minLoss === null || $minLoss === '' || !is_numeric((string) $minLoss)) {
return '联营阶梯规则第' . ($idx + 1) . '行起始客损格式错误';
return (string) __('Affiliate ladder rules minLoss format error') . ' #' . ($idx + 1);
}
if ($shareRate === null || $shareRate === '' || !is_numeric((string) $shareRate)) {
return '联营阶梯规则第' . ($idx + 1) . '行占成比例格式错误';
return (string) __('Affiliate ladder rules shareRate format error') . ' #' . ($idx + 1);
}
$minLossNum = (float) $minLoss;
$shareRateNum = (float) $shareRate;
if ($minLossNum < 0) {
return '联营阶梯规则第' . ($idx + 1) . '行起始客损不能为负';
return (string) __('Affiliate ladder rules minLoss cannot be negative') . ' #' . ($idx + 1);
}
if ($shareRateNum < 0 || $shareRateNum > 1) {
return '联营阶梯规则第' . ($idx + 1) . '行占成比例必须在0到1之间';
return (string) __('Affiliate ladder rules shareRate must be between 0 and 1') . ' #' . ($idx + 1);
}
if ($prevMinLoss !== null && $minLossNum <= $prevMinLoss) {
return '联营阶梯规则需按起始客损递增';
return (string) __('Affiliate ladder rules must be strictly increasing by minLoss');
}
$prevMinLoss = $minLossNum;
$normalized[] = [

View File

@@ -3,6 +3,7 @@
namespace app\admin\controller\admin;
use app\common\controller\Backend;
use support\think\Db;
use support\Response;
use Webman\Http\Request as WebmanRequest;
@@ -51,9 +52,28 @@ class AdminWallet extends Backend
->where($where)
->order($order)
->paginate($limit);
$items = $res->items();
$channelIds = [];
foreach ($items as $item) {
$channelId = intval($item['admin']['channel_id'] ?? 0);
if ($channelId > 0) {
$channelIds[] = $channelId;
}
}
$channelNames = [];
if ($channelIds !== []) {
$channelNames = Db::name('channel')
->whereIn('id', array_values(array_unique($channelIds)))
->column('name', 'id');
}
foreach ($items as &$item) {
$channelId = intval($item['admin']['channel_id'] ?? 0);
$item['channel_name'] = $channelId > 0 ? strval($channelNames[$channelId] ?? '') : '';
}
unset($item);
return $this->success('', [
'list' => $res->items(),
'list' => $items,
'total' => $res->total(),
'remark' => get_route_remark(),
]);
@@ -61,17 +81,17 @@ class AdminWallet extends Backend
protected function _add(): Response
{
return $this->error('管理员钱包不允许手动新增');
return $this->error(__('Admin wallet does not allow manual creation'));
}
protected function _edit(): Response
{
return $this->error('管理员钱包不允许手动编辑');
return $this->error(__('Admin wallet does not allow manual editing'));
}
protected function _del(): Response
{
return $this->error('管理员钱包不允许删除');
return $this->error(__('Admin wallet does not allow deletion'));
}
}

View File

@@ -63,17 +63,17 @@ class AdminWalletRecord extends Backend
protected function _add(): Response
{
return $this->error('管理员钱包流水不允许手动新增');
return $this->error(__('Admin wallet records do not allow manual creation'));
}
protected function _edit(): Response
{
return $this->error('管理员钱包流水不允许手动编辑');
return $this->error(__('Admin wallet records do not allow manual editing'));
}
protected function _del(): Response
{
return $this->error('管理员钱包流水不允许删除');
return $this->error(__('Admin wallet records do not allow deletion'));
}
}

View File

@@ -152,7 +152,7 @@ class Admin extends Backend
}
$data = $this->normalizeSingleGroup($data);
if (!$this->hasSingleGroup($data['group_arr'] ?? null)) {
return $this->error('请选择且仅选择一个角色组');
return $this->error(__('Please select exactly one role group'));
}
if ($this->modelValidate) {
@@ -184,10 +184,10 @@ class Admin extends Backend
return $this->error(__('You have no permission'));
}
if ($groupChannelId === null || $groupChannelId === '') {
return $this->error('所选角色组未绑定渠道');
return $this->error(__('Selected role group is not bound to a channel'));
}
if ((string) $groupChannelId !== (string) $creatorChannelId) {
return $this->error('所选角色组渠道与当前账号不一致');
return $this->error(__('Selected role group channel does not match current account'));
}
$data['channel_id'] = $creatorChannelId;
$data['parent_admin_id'] = $this->auth->id;
@@ -255,7 +255,7 @@ class Admin extends Backend
}
$data = $this->normalizeSingleGroup($data);
if (!$this->hasSingleGroup($data['group_arr'] ?? null)) {
return $this->error('请选择且仅选择一个角色组');
return $this->error(__('Please select exactly one role group'));
}
$postedGroups = array_map('intval', $data['group_arr'] ?? []);
@@ -331,10 +331,10 @@ class Admin extends Backend
return $this->error(__('You have no permission'));
}
if ($groupChannelId === null || $groupChannelId === '') {
return $this->error('所选角色组未绑定渠道');
return $this->error(__('Selected role group is not bound to a channel'));
}
if ((string) $groupChannelId !== (string) $creatorChannelId) {
return $this->error('所选角色组渠道与当前账号不一致');
return $this->error(__('Selected role group channel does not match current account'));
}
$data['channel_id'] = $creatorChannelId;
} else {

View File

@@ -231,7 +231,7 @@ class DepositChannel extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
return $this->persistChannelList($items);
@@ -250,7 +250,7 @@ class DepositChannel extends Backend
$got = array_column($clean, 'code');
sort($got);
if ($expectedCodes !== $got) {
return $this->error('请保存全部已注册渠道行(不可缺行)');
return $this->error(__('Please save all registered channel rows (no missing rows)'));
}
$json = DepositChannelLib::encodeForDb($clean);
} catch (InvalidArgumentException $e) {
@@ -261,7 +261,7 @@ class DepositChannel extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(DepositChannelLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -264,7 +264,7 @@ class DepositTier extends Backend
}
$rid = $it['id'] ?? '';
if (is_string($rid) && $rid === $newId) {
return $this->error('档位 ID 已存在');
return $this->error(__('Tier ID already exists'));
}
}
$items[] = $this->normalizeFormRow($payload, $newId);
@@ -342,7 +342,7 @@ class DepositTier extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
return $this->persistTierList($items);
@@ -364,7 +364,7 @@ class DepositTier extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(DepositTierLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -119,7 +119,7 @@ class FinanceCashierConfig extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(FinanceCashierConfigLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -88,14 +88,14 @@ class StreakWinReward extends Backend
}
$payload = $request->post('rows');
if (!is_array($payload)) {
return $this->error('参数错误');
return $this->error(__('Invalid parameters'));
}
$encoded = StreakWinRewardLib::encodeForDb($payload);
$now = time();
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(StreakWinRewardLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
Db::startTrans();
@@ -125,7 +125,7 @@ class StreakWinReward extends Backend
StreakWinRewardLib::clearCache();
GameHotDataCoordinator::afterGameConfigKeyCommitted(StreakWinRewardLib::CONFIG_KEY);
return $this->success('保存成功');
return $this->success(__('Saved successfully'));
} finally {
GameHotDataLock::release(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey, $lock['token'], $lock['redis_lock']);
}

View File

@@ -95,7 +95,7 @@ class ZiHuaDictionary extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
try {
$clean = ZiHuaDictionaryLib::prepareItemsForSave($items);
@@ -108,7 +108,7 @@ class ZiHuaDictionary extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(ZiHuaDictionaryLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -35,7 +35,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游玩记录由游戏接口生成,禁止后台手工新增');
return $this->error(__('Play record is generated by game API; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -44,7 +44,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可编辑');
return $this->error(__('Play record cannot be edited'));
}
public function del(WebmanRequest $request): Response
@@ -53,7 +53,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可删除');
return $this->error(__('Play record cannot be deleted'));
}
public function sortable(WebmanRequest $request): Response
@@ -62,7 +62,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
return $this->error(__('Sorting is not supported'));
}
protected function _index(): Response

View File

@@ -38,7 +38,7 @@ class Record extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游戏对局记录由系统自动生成,禁止后台手工新增');
return $this->error(__('Game record is generated by system; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -48,7 +48,7 @@ class Record extends Backend
return $response;
}
if ($request->method() === 'POST') {
return $this->error('游戏对局记录不可编辑');
return $this->error(__('Game record cannot be edited'));
}
$pk = $this->model->getPk();
$id = $request->get($pk);
@@ -65,7 +65,7 @@ class Record extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游戏对局记录不可删除');
return $this->error(__('Game record cannot be deleted'));
}
public function abnormalList(WebmanRequest $request): Response
@@ -86,7 +86,6 @@ class Record extends Backend
$rows = Db::name('game_record')
->where('status', 5)
->whereLike('void_reason', 'system_recover:%')
->field(['id', 'period_no', 'void_reason', 'update_time'])
->order('id', 'desc')
->limit($limit)
@@ -96,6 +95,8 @@ class Record extends Backend
$list = [];
foreach ($rows as $row) {
$meta = $this->parseRecoverVoidReason(is_string($row['void_reason'] ?? null) ? $row['void_reason'] : '');
$reason = is_string($row['void_reason'] ?? null) ? $row['void_reason'] : '';
$isAutoRecover = $this->isSystemRecoverReason($reason);
$list[] = [
'id' => (int) ($row['id'] ?? 0),
'period_no' => (string) ($row['period_no'] ?? ''),
@@ -104,7 +105,8 @@ class Record extends Backend
'refunded_order_count' => $meta['orders'],
'refunded_total_amount' => $meta['amount'],
'recovered_at' => (int) ($row['update_time'] ?? 0),
'void_reason' => (string) ($row['void_reason'] ?? ''),
'void_reason' => $reason,
'is_auto_recover' => $isAutoRecover ? 1 : 0,
];
}
@@ -125,10 +127,13 @@ class Record extends Backend
'orders' => 0,
'amount' => '0.00',
];
if ($reason === '' || str_starts_with($reason, 'system_recover:') === false) {
if (!$this->isSystemRecoverReason($reason)) {
return $meta;
}
$payload = substr($reason, strlen('system_recover:'));
if (!str_contains($payload, '=')) {
return $meta;
}
$parts = explode('|', $payload);
foreach ($parts as $part) {
$item = trim($part);
@@ -156,4 +161,9 @@ class Record extends Backend
}
return $meta;
}
private function isSystemRecoverReason(string $reason): bool
{
return $reason !== '' && str_starts_with($reason, 'system_recover:');
}
}

View File

@@ -81,7 +81,7 @@ class ZiHuaDictionary extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
try {
$clean = ZiHuaDictionaryLib::prepareItemsForSave($items);
@@ -94,7 +94,7 @@ class ZiHuaDictionary extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(ZiHuaDictionaryLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -78,7 +78,7 @@ class AdminWithdrawOrder extends Backend
return $this->error(__('Parameter error'));
}
if ($this->request && $this->request->method() === 'POST') {
return $this->error('请使用通过/拒绝按钮审核');
return $this->error(__('Please use approve/reject buttons to review'));
}
$row = $this->loadWithRelations(intval(strval($id)));
if (!$row) {
@@ -111,7 +111,7 @@ class AdminWithdrawOrder extends Backend
return $this->error(__('You have no permission'));
}
if (intval($order['status'] ?? 0) !== 0) {
return $this->error('该提现订单已审核');
return $this->error(__('This withdraw order has already been reviewed'));
}
$remark = trim((string) $request->post('remark', ''));
Db::startTrans();
@@ -122,7 +122,7 @@ class AdminWithdrawOrder extends Backend
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('审核通过');
return $this->success(__('Approved'));
}
public function reject(WebmanRequest $request): Response
@@ -140,7 +140,7 @@ class AdminWithdrawOrder extends Backend
}
$remark = trim((string) $request->post('remark', ''));
if ($remark === '') {
return $this->error('请填写拒绝原因');
return $this->error(__('Please provide reject reason'));
}
$order = Db::name('admin_withdraw_order')->where('id', $id)->find();
if (!is_array($order)) {
@@ -150,7 +150,7 @@ class AdminWithdrawOrder extends Backend
return $this->error(__('You have no permission'));
}
if (intval($order['status'] ?? 0) !== 0) {
return $this->error('该提现订单已审核');
return $this->error(__('This withdraw order has already been reviewed'));
}
Db::startTrans();
try {
@@ -160,7 +160,7 @@ class AdminWithdrawOrder extends Backend
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('审核拒绝完成');
return $this->success(__('Rejected'));
}
public function stats(WebmanRequest $request): Response

View File

@@ -35,7 +35,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('注单由游戏接口生成,禁止后台手工新增');
return $this->error(__('Bet order is generated by game API; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -44,7 +44,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('注单不可编辑');
return $this->error(__('Bet order cannot be edited'));
}
public function del(WebmanRequest $request): Response
@@ -53,7 +53,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('注单不可删除');
return $this->error(__('Bet order cannot be deleted'));
}
public function sortable(WebmanRequest $request): Response
@@ -62,7 +62,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
return $this->error(__('Sorting is not supported'));
}
/**

View File

@@ -93,7 +93,7 @@ class DepositOrder extends Backend
}
if ($this->request && $this->request->method() === 'POST') {
return $this->error('充值订单为自动入账,禁止直接修改,如需补单请走专用工具');
return $this->error(__('Deposit orders are auto-settled; direct modification is not allowed. Use the dedicated tool for manual adjustment.'));
}
$row = $this->loadWithRelations(intval(strval($id)));

View File

@@ -84,7 +84,7 @@ class WithdrawOrder extends Backend
if ($this->request && $this->request->method() === 'POST') {
// 历史 CRUD 的 POST 编辑已被 approve/reject 替代,这里阻止直接改金额绕过审核流程
return $this->error('请使用通过/拒绝按钮完成审核');
return $this->error(__('Please use approve/reject buttons to complete the review'));
}
$row = $this->loadWithRelations(intval(strval($id)));
@@ -119,13 +119,13 @@ class WithdrawOrder extends Backend
$newAmount = $this->decimalParam($request->post('amount'), '0');
$newFee = $this->decimalParam($request->post('fee'), '0');
if (bccomp($newAmount, '0', 2) <= 0) {
return $this->error('申请金额必须大于 0');
return $this->error(__('Apply amount must be greater than 0'));
}
if (bccomp($newFee, '0', 2) < 0) {
return $this->error('手续费不能为负');
return $this->error(__('Fee cannot be negative'));
}
if (bccomp($newFee, $newAmount, 2) > 0) {
return $this->error('手续费不能大于申请金额');
return $this->error(__('Fee cannot be greater than apply amount'));
}
$newActual = bcsub($newAmount, $newFee, 2);
@@ -141,12 +141,12 @@ class WithdrawOrder extends Backend
}
$currentStatus = $this->intParam($order['status'] ?? 0);
if ($currentStatus !== 0) {
return $this->error('该订单已审核,无需重复操作');
return $this->error(__('This order has already been reviewed'));
}
$userId = $this->intParam($order['user_id'] ?? 0);
if ($userId <= 0) {
return $this->error('订单缺少用户信息');
return $this->error(__('Order is missing user info'));
}
$oldAmount = bcadd(strval($order['amount'] ?? '0'), '0', 2);
$diff = bcsub($newAmount, $oldAmount, 2);
@@ -173,12 +173,12 @@ class WithdrawOrder extends Backend
$userRow = Db::name('user')->where('id', $userId)->find();
if (!$userRow) {
Db::rollback();
return $this->error('关联用户不存在');
return $this->error(__('Related user does not exist'));
}
$beforeCoin = bcadd(strval($userRow['coin'] ?? '0'), '0', 2);
if (bccomp($beforeCoin, $diff, 2) < 0) {
Db::rollback();
return $this->error('用户余额不足以补扣调整差额');
return $this->error(__('User balance is insufficient to cover the adjustment difference'));
}
$afterCoin = bcsub($beforeCoin, $diff, 2);
Db::name('user')->where('id', $userId)->update([
@@ -208,7 +208,7 @@ class WithdrawOrder extends Backend
$userRow = Db::name('user')->where('id', $userId)->find();
if (!$userRow) {
Db::rollback();
return $this->error('关联用户不存在');
return $this->error(__('Related user does not exist'));
}
$beforeCoin = bcadd(strval($userRow['coin'] ?? '0'), '0', 2);
$afterCoin = bcadd($beforeCoin, $abs, 2);
@@ -251,7 +251,7 @@ class WithdrawOrder extends Backend
return $this->error($e->getMessage());
}
return $this->success('审核通过', [
return $this->success(__('Approved'), [
'id' => $id,
'amount' => $newAmount,
'fee' => $newFee,
@@ -281,7 +281,7 @@ class WithdrawOrder extends Backend
$remarkRaw = $request->post('remark');
$remark = is_string($remarkRaw) ? trim($remarkRaw) : '';
if ($remark === '') {
return $this->error('请填写拒绝原因');
return $this->error(__('Please provide reject reason'));
}
$order = Db::name('withdraw_order')->where('id', $id)->find();
@@ -293,12 +293,12 @@ class WithdrawOrder extends Backend
}
$currentStatus = $this->intParam($order['status'] ?? 0);
if ($currentStatus !== 0) {
return $this->error('该订单已审核,无需重复操作');
return $this->error(__('This order has already been reviewed'));
}
$userId = $this->intParam($order['user_id'] ?? 0);
if ($userId <= 0) {
return $this->error('订单缺少用户信息');
return $this->error(__('Order is missing user info'));
}
$amount = bcadd(strval($order['amount'] ?? '0'), '0', 2);
$channelIdRaw = $order['channel_id'] ?? null;
@@ -315,7 +315,7 @@ class WithdrawOrder extends Backend
$userRow = Db::name('user')->where('id', $userId)->find();
if (!$userRow) {
Db::rollback();
return $this->error('关联用户不存在');
return $this->error(__('Related user does not exist'));
}
$beforeCoin = bcadd(strval($userRow['coin'] ?? '0'), '0', 2);
$afterCoin = bcadd($beforeCoin, $amount, 2);
@@ -355,7 +355,7 @@ class WithdrawOrder extends Backend
return $this->error($e->getMessage());
}
return $this->success('审核已拒绝', [
return $this->success(__('Rejected'), [
'id' => $id,
'status' => 2,
'remark' => $remark,

View File

@@ -164,18 +164,18 @@ class AdminInfo extends Backend
$receiveType = trim(is_string($request->post('receive_type', '')) ? $request->post('receive_type', '') : '');
$idempotencyKey = trim(is_string($request->post('idempotency_key', '')) ? $request->post('idempotency_key', '') : '');
if ($withdrawCoin === '' || $receiveAccount === '' || $receiveType === '' || $idempotencyKey === '') {
return $this->error('参数缺失');
return $this->error(__('Missing required parameters'));
}
if (mb_strlen($idempotencyKey) > 64) {
return $this->error('幂等键过长');
return $this->error(__('Idempotency key is too long'));
}
if (!is_numeric($withdrawCoin) || bccomp($withdrawCoin, '0', 2) <= 0) {
return $this->error('提现金额必须大于0');
return $this->error(__('Withdraw amount must be greater than 0'));
}
$withdrawCoin = bcadd($withdrawCoin, '0', 2);
$allowedReceiveTypes = ['bank', 'ewallet', 'crypto'];
if (!in_array($receiveType, $allowedReceiveTypes, true)) {
return $this->error('收款类型不合法,仅支持 bank/ewallet/crypto');
return $this->error(__('Invalid receive type; only bank/ewallet/crypto are supported'));
}
$remark = trim((string) $request->post('remark', ''));
$admin = Db::name('admin')->field(['id', 'channel_id'])->where('id', $adminId)->find();
@@ -185,14 +185,14 @@ class AdminInfo extends Backend
$res = AdminWalletService::applyWithdraw($adminId, $channelId, $withdrawCoin, $receiveType, $receiveAccount, $idempotencyKey, $remark);
if (($res['ok'] ?? false) !== true) {
Db::rollback();
return $this->error(strval($res['msg'] ?? '提现申请失败'));
return $this->error(strval($res['msg'] ?? __('Withdraw apply failed')));
}
Db::commit();
} catch (Throwable $e) {
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('提现申请已提交,待渠道超管审核', [
return $this->success(__('Withdraw request submitted; pending channel super admin review'), [
'order_id' => intval($res['order_id'] ?? 0),
'order_no' => strval($res['order_no'] ?? ''),
'idempotent_hit' => !empty($res['idempotent_hit']),

View File

@@ -234,16 +234,16 @@ class User extends Backend
$opRaw = $request->post('op');
$op = is_string($opRaw) ? trim($opRaw) : '';
if (!in_array($op, ['credit', 'deduct'], true)) {
return $this->error('操作类型不正确');
return $this->error(__('Invalid operation type'));
}
$amountRaw = $request->post('amount');
$amountText = is_string($amountRaw) || is_numeric($amountRaw) ? trim(strval($amountRaw)) : '';
if ($amountText === '' || !is_numeric($amountText)) {
return $this->error('金额格式不正确');
return $this->error(__('Invalid amount format'));
}
if (bccomp($amountText, '0', 2) <= 0) {
return $this->error('金额必须大于0');
return $this->error(__('Amount must be greater than 0'));
}
$remarkRaw = $request->post('remark');
@@ -257,7 +257,7 @@ class User extends Backend
$lock = GameHotDataRedis::userAdminMutationLockTry($userId);
if (!$lock['acquired']) {
return $this->error('该用户正在被其他管理员操作(钱包/并发保存),请稍后再试');
return $this->error(__('This user is being operated by another admin (wallet/concurrent save); please try again later'));
}
try {
@@ -284,7 +284,7 @@ class User extends Backend
$direction = 1;
} else {
if (bccomp($before, $delta, 2) < 0) {
return $this->error('余额不足,扣点失败');
return $this->error(__('Insufficient balance; deduction failed'));
}
$after = bcsub($before, $delta, 2);
$bizType = 'admin_deduct';
@@ -306,7 +306,7 @@ class User extends Backend
]);
if ($affected !== 1) {
Db::rollback();
return $this->error('保存失败:该用户余额已被其他请求修改(如下注、派彩或其他管理员已保存),请刷新后重试');
return $this->error(__('Save failed: user balance changed by another request; please refresh and retry'));
}
Db::name('user_wallet_record')->insert([
@@ -332,7 +332,7 @@ class User extends Backend
GameHotDataCoordinator::afterUserCommitted($userId);
return $this->success('钱包调整成功', [
return $this->success(__('Wallet adjusted successfully'), [
'user_id' => $userId,
'coin_before' => self::formatAmountForDisplay($before),
'coin_after' => self::formatAmountForDisplay($after),

View File

@@ -35,7 +35,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('钱包流水仅允许业务入账,禁止后台手工新增');
return $this->error(__('Wallet records are business-generated; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -44,7 +44,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('钱包流水不可编辑');
return $this->error(__('Wallet record cannot be edited'));
}
public function del(WebmanRequest $request): Response
@@ -53,7 +53,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('钱包流水不可删除');
return $this->error(__('Wallet record cannot be deleted'));
}
public function sortable(WebmanRequest $request): Response
@@ -62,7 +62,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
return $this->error(__('Sorting is not supported'));
}
/**

View File

@@ -304,7 +304,8 @@ class Finance extends MobileBase
}
$msgEsc = htmlspecialchars($msg, ENT_QUOTES, 'UTF-8');
return response('<!doctype html><html><head><meta charset="utf-8"><title>充值</title></head><body><p>' . $msgEsc . '</p></body></html>', 200, [
$title = htmlspecialchars((string) __('Deposit'), ENT_QUOTES, 'UTF-8');
return response('<!doctype html><html><head><meta charset="utf-8"><title>' . $title . '</title></head><body><p>' . $msgEsc . '</p></body></html>', 200, [
'Content-Type' => 'text/html; charset=utf-8',
]);
}
@@ -313,16 +314,27 @@ class Finance extends MobileBase
$noEsc = htmlspecialchars($orderNo, ENT_QUOTES, 'UTF-8');
$signEsc = htmlspecialchars($sign, ENT_QUOTES, 'UTF-8');
$payChannel = is_string($order->pay_channel) ? htmlspecialchars($order->pay_channel, ENT_QUOTES, 'UTF-8') : '';
$html = '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>模拟支付</title></head><body style="font-family:system-ui;padding:1rem">';
$html .= '<h2>模拟第三方收银台</h2>';
$html .= '<p>订单号:' . $noEsc . '</p>';
$html .= '<p>支付渠道:' . $payChannel . '</p>';
$html .= '<p>金额(法币/标价):' . htmlspecialchars($amount, ENT_QUOTES, 'UTF-8') . ' + 赠送 ' . htmlspecialchars($bonus, ENT_QUOTES, 'UTF-8') . '(币)</p>';
$html .= '<p>点击下方按钮即视为<strong>第三方支付成功</strong>,服务端会回调并到账。</p>';
$tMockPay = htmlspecialchars((string) __('Mock payment'), ENT_QUOTES, 'UTF-8');
$tCashier = htmlspecialchars((string) __('Mock third-party cashier'), ENT_QUOTES, 'UTF-8');
$tOrderNo = htmlspecialchars((string) __('Order No'), ENT_QUOTES, 'UTF-8');
$tPayChannel = htmlspecialchars((string) __('Pay channel'), ENT_QUOTES, 'UTF-8');
$tAmountLabel = htmlspecialchars((string) __('Amount (fiat/pricing)'), ENT_QUOTES, 'UTF-8');
$tBonus = htmlspecialchars((string) __('Bonus'), ENT_QUOTES, 'UTF-8');
$tCoin = htmlspecialchars((string) __('coin'), ENT_QUOTES, 'UTF-8');
$tHint = (string) __('Click the button below to simulate successful third-party payment; the server will callback and settle the deposit.');
$tHintEsc = htmlspecialchars($tHint, ENT_QUOTES, 'UTF-8');
$tConfirm = htmlspecialchars((string) __('Confirm payment (simulate success)'), ENT_QUOTES, 'UTF-8');
$html = '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>' . $tMockPay . '</title></head><body style="font-family:system-ui;padding:1rem">';
$html .= '<h2>' . $tCashier . '</h2>';
$html .= '<p>' . $tOrderNo . ': ' . $noEsc . '</p>';
$html .= '<p>' . $tPayChannel . ': ' . $payChannel . '</p>';
$html .= '<p>' . $tAmountLabel . ': ' . htmlspecialchars($amount, ENT_QUOTES, 'UTF-8') . ' + ' . $tBonus . ' ' . htmlspecialchars($bonus, ENT_QUOTES, 'UTF-8') . ' (' . $tCoin . ')</p>';
$html .= '<p>' . $tHintEsc . '</p>';
$html .= '<form method="post" action="/api/finance/depositMockNotify" style="margin-top:1rem">';
$html .= '<input type="hidden" name="order_no" value="' . $noEsc . '">';
$html .= '<input type="hidden" name="sign" value="' . $signEsc . '">';
$html .= '<button type="submit" style="padding:0.5rem 1rem">确认支付(模拟成功)</button>';
$html .= '<button type="submit" style="padding:0.5rem 1rem">' . $tConfirm . '</button>';
$html .= '</form></body></html>';
return response($html, 200, [
@@ -373,7 +385,7 @@ class Finance extends MobileBase
'channel_code=' . $pc
);
} catch (Throwable $e) {
return $this->mobileError(2000, $e->getMessage());
return $this->mobileError(2000, (string) __($e->getMessage()));
}
$fresh = DepositOrder::where('order_no', $orderNo)->find();
if (!$fresh) {

View File

@@ -60,7 +60,8 @@ class Game extends MobileBase
'bet_config' => [
'pick_max_number_count' => $this->getPickMaxNumberCount(),
'chips' => ['1.00', '5.00', '10.00', '25.00', '50.00', '100.00'],
'single_number_max_bet' => $this->getConfigValue('single_number_max_bet', '500.00'),
'min_bet_per_number' => $this->getConfigValue('min_bet_per_number', '0.0100'),
'max_bet_per_number' => $this->getConfigValue('max_bet_per_number', '10000.0000'),
],
'dictionary' => $items,
'user_snapshot' => [
@@ -154,6 +155,17 @@ class Game extends MobileBase
return $this->mobileError(1003, 'Invalid parameter value');
}
$singleAmount = bcadd($singleBetAmount, '0', 2);
$minPer = trim((string) $this->getConfigValue('min_bet_per_number', '0.0100'));
$maxPer = trim((string) $this->getConfigValue('max_bet_per_number', '10000.0000'));
if (!is_numeric($minPer) || bccomp($minPer, '0', 4) <= 0) {
$minPer = '0.0100';
}
if (!is_numeric($maxPer) || bccomp($maxPer, $minPer, 4) < 0) {
$maxPer = '10000.0000';
}
if (bccomp($singleAmount, $minPer, 4) < 0 || bccomp($singleAmount, $maxPer, 4) > 0) {
return $this->mobileError(1003, 'Bet amount out of range');
}
$numberCount = (string) count($numbers);
$totalAmount = bcmul($singleAmount, $numberCount, 2);
@@ -186,7 +198,7 @@ class Game extends MobileBase
$lock = GameHotDataRedis::userAdminMutationLockTry($userId);
if (!$lock['acquired']) {
return $this->mobileError(5000, '该用户正在被其他管理员操作(钱包/并发保存),请稍后再试');
return $this->mobileError(5000, (string) __('This user is being operated by another admin (wallet/concurrent save); please try again later'));
}
try {
@@ -223,7 +235,7 @@ class Game extends MobileBase
]);
if ($affected !== 1) {
Db::rollback();
return $this->mobileError(5000, '扣款失败:该用户余额已被其他请求修改(如下注、派彩或其他管理员已保存),请刷新后重试');
return $this->mobileError(5000, (string) __('Debit failed: user balance changed by another request; please refresh and retry'));
}
UserWalletRecord::create([

View File

@@ -0,0 +1,186 @@
<?php
declare(strict_types=1);
return [
'Channel not found' => 'Channel not found',
'Settlement number conflict, please retry' => 'Settlement number conflict, please retry',
'No available admin share ratios under this channel; cannot settle' => 'No available admin share ratios under this channel; cannot settle',
'This flow pays commissions automatically after super admin settlement; channel admin does not need to settle again' => 'This flow pays commissions automatically after super admin settlement; channel admin does not need to settle again',
'Invalid channel data' => 'Invalid channel data',
'Invalid settlement period (start time is not earlier than now)' => 'Invalid settlement period (start time is not earlier than now)',
'Turnover agent commission rate is not configured' => 'Turnover agent commission rate is not configured',
'Affiliate agent fee rate is not configured' => 'Affiliate agent fee rate is not configured',
'Affiliate ladder rules are empty or invalid' => 'Affiliate ladder rules are empty or invalid',
'Unknown agent mode' => 'Unknown agent mode',
'Manual create next round is disabled' => 'Manual create next round is disabled',
'There is an unfinished round; cannot create a new one' => 'There is an unfinished round; cannot create a new one',
'New round created' => 'New round created',
'Idempotency key conflict' => 'Idempotency key conflict',
'Insufficient wallet balance' => 'Insufficient wallet balance',
'Game record is generated by system; manual creation is not allowed' => 'Game record is generated by system; manual creation is not allowed',
'Game record cannot be edited' => 'Game record cannot be edited',
'Game record cannot be deleted' => 'Game record cannot be deleted',
'Bet order is generated by game API; manual creation is not allowed' => 'Bet order is generated by game API; manual creation is not allowed',
'Bet order cannot be edited' => 'Bet order cannot be edited',
'Bet order cannot be deleted' => 'Bet order cannot be deleted',
'Sorting is not supported' => 'Sorting is not supported',
'Play record is generated by game API; manual creation is not allowed' => 'Play record is generated by game API; manual creation is not allowed',
'Play record cannot be edited' => 'Play record cannot be edited',
'Play record cannot be deleted' => 'Play record cannot be deleted',
'Wallet records are business-generated; manual creation is not allowed' => 'Wallet records are business-generated; manual creation is not allowed',
'Wallet record cannot be edited' => 'Wallet record cannot be edited',
'Wallet record cannot be deleted' => 'Wallet record cannot be deleted',
'Admin wallet does not allow manual creation' => 'Admin wallet does not allow manual creation',
'Admin wallet does not allow manual editing' => 'Admin wallet does not allow manual editing',
'Admin wallet does not allow deletion' => 'Admin wallet does not allow deletion',
'Admin wallet records do not allow manual creation' => 'Admin wallet records do not allow manual creation',
'Admin wallet records do not allow manual editing' => 'Admin wallet records do not allow manual editing',
'Admin wallet records do not allow deletion' => 'Admin wallet records do not allow deletion',
'Invalid parameters' => 'Invalid parameters',
'This config is locked by another operation, please try again later' => 'This config is locked by another operation, please try again later',
'Saved successfully' => 'Saved successfully',
'Please use approve/reject buttons to review' => 'Please use approve/reject buttons to review',
'This withdraw order has already been reviewed' => 'This withdraw order has already been reviewed',
'Approved' => 'Approved',
'Please provide reject reason' => 'Please provide reject reason',
'Rejected' => 'Rejected',
'Deposit orders are auto-settled; direct modification is not allowed. Use the dedicated tool for manual adjustment.' => 'Deposit orders are auto-settled; direct modification is not allowed. Use the dedicated tool for manual adjustment.',
'Missing required parameters' => 'Missing required parameters',
'Idempotency key is too long' => 'Idempotency key is too long',
'Withdraw amount must be greater than 0' => 'Withdraw amount must be greater than 0',
'Invalid receive type; only bank/ewallet/crypto are supported' => 'Invalid receive type; only bank/ewallet/crypto are supported',
'Withdraw request submitted; pending channel super admin review' => 'Withdraw request submitted; pending channel super admin review',
'Tier ID already exists' => 'Tier ID already exists',
'Items must be an array' => 'Items must be an array',
'Please save all registered channel rows (no missing rows)' => 'Please save all registered channel rows (no missing rows)',
'Please use approve/reject buttons to complete the review' => 'Please use approve/reject buttons to complete the review',
'Apply amount must be greater than 0' => 'Apply amount must be greater than 0',
'Fee cannot be negative' => 'Fee cannot be negative',
'Fee cannot be greater than apply amount' => 'Fee cannot be greater than apply amount',
'This order has already been reviewed' => 'This order has already been reviewed',
'Order is missing user info' => 'Order is missing user info',
'Related user does not exist' => 'Related user does not exist',
'User balance is insufficient to cover the adjustment difference' => 'User balance is insufficient to cover the adjustment difference',
'Please select exactly one role group' => 'Please select exactly one role group',
'Selected role group is not bound to a channel' => 'Selected role group is not bound to a channel',
'Selected role group channel does not match current account' => 'Selected role group channel does not match current account',
'Invalid operation type' => 'Invalid operation type',
'Invalid amount format' => 'Invalid amount format',
'Amount must be greater than 0' => 'Amount must be greater than 0',
'This user is being operated by another admin (wallet/concurrent save); please try again later' => 'This user is being operated by another admin (wallet/concurrent save); please try again later',
'Insufficient balance; deduction failed' => 'Insufficient balance; deduction failed',
'Save failed: user balance changed by another request; please refresh and retry' => 'Save failed: user balance changed by another request; please refresh and retry',
'Wallet adjusted successfully' => 'Wallet adjusted successfully',
'Please configure at least one share record' => 'Please configure at least one share record',
'There are no admins under this channel; cannot configure share ratios' => 'There are no admins under this channel; cannot configure share ratios',
'Share ratio must be between 0 and 100' => 'Share ratio must be between 0 and 100',
'Please configure at least one valid share record' => 'Please configure at least one valid share record',
'Sum of enabled share ratios must equal 100' => 'Sum of enabled share ratios must equal 100',
'Share ratios saved successfully' => 'Share ratios saved successfully',
'Only super admin can settle; after settlement, commissions will be automatically paid to admin wallets' => 'Only super admin can settle; after settlement, commissions will be automatically paid to admin wallets',
'Settlement failed' => 'Settlement failed',
'Super admin settlement completed; paid automatically by share ratios' => 'Super admin settlement completed; paid automatically by share ratios',
'Batch settlement completed' => 'Batch settlement completed',
'Invalid settlement cycle' => 'Invalid settlement cycle',
'Invalid settlement time format (HH:mm:ss)' => 'Invalid settlement time format (HH:mm:ss)',
'Weekly settlement must select Monday to Sunday' => 'Weekly settlement must select Monday to Sunday',
'Monthly settlement day must be between 1 and 31' => 'Monthly settlement day must be between 1 and 31',
'Turnover commission rate must be between 0 and 100' => 'Turnover commission rate must be between 0 and 100',
'Affiliate share/fee rates are required' => 'Affiliate share/fee rates are required',
'Affiliate share/fee rates must be between 0 and 1' => 'Affiliate share/fee rates must be between 0 and 1',
'Affiliate ladder rules are required' => 'Affiliate ladder rules are required',
'Affiliate ladder rules must be a valid JSON array' => 'Affiliate ladder rules must be a valid JSON array',
'Affiliate ladder rules must contain at least one row' => 'Affiliate ladder rules must contain at least one row',
'Affiliate ladder rules row format error' => 'Affiliate ladder rules row format error',
'Affiliate ladder rules minLoss format error' => 'Affiliate ladder rules minLoss format error',
'Affiliate ladder rules shareRate format error' => 'Affiliate ladder rules shareRate format error',
'Affiliate ladder rules minLoss cannot be negative' => 'Affiliate ladder rules minLoss cannot be negative',
'Affiliate ladder rules shareRate must be between 0 and 1' => 'Affiliate ladder rules shareRate must be between 0 and 1',
'Affiliate ladder rules must be strictly increasing by minLoss' => 'Affiliate ladder rules must be strictly increasing by minLoss',
'Withdraw apply failed' => 'Withdraw apply failed',
'Debit failed: user balance changed by another request; please refresh and retry' => 'Debit failed: user balance changed by another request; please refresh and retry',
'Deposit' => 'Deposit',
'Mock payment' => 'Mock payment',
'Mock third-party cashier' => 'Mock third-party cashier',
'Order No' => 'Order No',
'Pay channel' => 'Pay channel',
'Amount (fiat/pricing)' => 'Amount (fiat/pricing)',
'Bonus' => 'Bonus',
'coin' => 'coin',
'Click the button below to simulate successful third-party payment; the server will callback and settle the deposit.' => 'Click the button below to simulate successful third-party payment; the server will callback and settle the deposit.',
'Confirm payment (simulate success)' => 'Confirm payment (simulate success)',
'Order id is invalid' => 'Order id is invalid',
'Order does not exist' => 'Order does not exist',
'Order number is empty' => 'Order number is empty',
'Order status does not allow settlement' => 'Order status does not allow settlement',
'Order amount is invalid' => 'Order amount is invalid',
'Order user is invalid' => 'Order user is invalid',
'User does not exist' => 'User does not exist',
'Order state changed, please refresh and retry' => 'Order state changed, please refresh and retry',
'Row format error' => 'Row format error',
'Channel code is not registered' => 'Channel code is not registered',
'Duplicate channel code' => 'Duplicate channel code',
'Invalid channel row data' => 'Invalid channel row data',
'JSON encode failed' => 'JSON encode failed',
'Tier id is invalid' => 'Tier id is invalid',
'Duplicate tier id' => 'Duplicate tier id',
'Tier title (zh) is required' => 'Tier title (zh) is required',
'Tier title (zh) is too long' => 'Tier title (zh) is too long',
'Tier title (en) is too long' => 'Tier title (en) is too long',
'Currency is required' => 'Currency is required',
'Pay amount must be greater than 0' => 'Pay amount must be greater than 0',
'Base credit amount must be greater than 0' => 'Base credit amount must be greater than 0',
'Bonus amount cannot be negative' => 'Bonus amount cannot be negative',
'Description (zh) is too long' => 'Description (zh) is too long',
'Description (en) is too long' => 'Description (en) is too long',
'platform_coin format error' => 'platform_coin format error',
'Platform coin labels (zh/en) are required' => 'Platform coin labels (zh/en) are required',
'At least one currency is required' => 'At least one currency is required',
'Currency row format error' => 'Currency row format error',
'Currency code is invalid' => 'Currency code is invalid',
'Duplicate currency code' => 'Duplicate currency code',
'Deposit rate must be a number greater than 0' => 'Deposit rate must be a number greater than 0',
'Withdraw rate must be a number greater than 0' => 'Withdraw rate must be a number greater than 0',
'Bank row format error' => 'Bank row format error',
'Bank code is invalid' => 'Bank code is invalid',
'Duplicate bank code' => 'Duplicate bank code',
'Withdraw min limit must be a number not less than 0' => 'Withdraw min limit must be a number not less than 0',
'Please configure deposit channels' => 'Please configure deposit channels',
'Must be exactly 36 items' => 'Must be exactly 36 items',
'No must be numeric' => 'No must be numeric',
'No must be between 1 and 36' => 'No must be between 1 and 36',
'Duplicate no' => 'Duplicate no',
'Name is required' => 'Name is required',
'Category is invalid' => 'Category is invalid',
'Missing no' => 'Missing no',
'Failed to generate commission rows' => 'Failed to generate commission rows',
];

View File

@@ -0,0 +1,186 @@
<?php
declare(strict_types=1);
return [
'Channel not found' => '渠道不存在',
'Settlement number conflict, please retry' => '结算单号冲突,请重试',
'No available admin share ratios under this channel; cannot settle' => '渠道下无可用管理员分配比例,无法结算',
'This flow pays commissions automatically after super admin settlement; channel admin does not need to settle again' => '当前流程为超管结算后自动发放,渠道管理员无需二次结算',
'Invalid channel data' => '渠道数据异常',
'Invalid settlement period (start time is not earlier than now)' => '结算区间无效(开始时间不早于当前)',
'Turnover agent commission rate is not configured' => '普通返水代理未配置返水分红比例',
'Affiliate agent fee rate is not configured' => '联营代理未配置成本扣除比例',
'Affiliate ladder rules are empty or invalid' => '联营阶梯规则无效或为空',
'Unknown agent mode' => '未知的代理模式',
'Manual create next round is disabled' => '未开启「手动创建下一局」开关',
'There is an unfinished round; cannot create a new one' => '存在未结束对局,无法新建',
'New round created' => '已创建新对局',
'Idempotency key conflict' => '幂等键冲突',
'Insufficient wallet balance' => '钱包余额不足',
'Game record is generated by system; manual creation is not allowed' => '游戏对局记录由系统自动生成,禁止后台手工新增',
'Game record cannot be edited' => '游戏对局记录不可编辑',
'Game record cannot be deleted' => '游戏对局记录不可删除',
'Bet order is generated by game API; manual creation is not allowed' => '注单由游戏接口生成,禁止后台手工新增',
'Bet order cannot be edited' => '注单不可编辑',
'Bet order cannot be deleted' => '注单不可删除',
'Sorting is not supported' => '不支持排序',
'Play record is generated by game API; manual creation is not allowed' => '游玩记录由游戏接口生成,禁止后台手工新增',
'Play record cannot be edited' => '游玩记录不可编辑',
'Play record cannot be deleted' => '游玩记录不可删除',
'Wallet records are business-generated; manual creation is not allowed' => '钱包流水仅允许业务入账,禁止后台手工新增',
'Wallet record cannot be edited' => '钱包流水不可编辑',
'Wallet record cannot be deleted' => '钱包流水不可删除',
'Admin wallet does not allow manual creation' => '管理员钱包不允许手动新增',
'Admin wallet does not allow manual editing' => '管理员钱包不允许手动编辑',
'Admin wallet does not allow deletion' => '管理员钱包不允许删除',
'Admin wallet records do not allow manual creation' => '管理员钱包流水不允许手动新增',
'Admin wallet records do not allow manual editing' => '管理员钱包流水不允许手动编辑',
'Admin wallet records do not allow deletion' => '管理员钱包流水不允许删除',
'Invalid parameters' => '参数错误',
'This config is locked by another operation, please try again later' => '该配置正在被其他操作占用,请稍后再试',
'Saved successfully' => '保存成功',
'Please use approve/reject buttons to review' => '请使用通过/拒绝按钮审核',
'This withdraw order has already been reviewed' => '该提现订单已审核',
'Approved' => '审核通过',
'Please provide reject reason' => '请填写拒绝原因',
'Rejected' => '审核拒绝完成',
'Deposit orders are auto-settled; direct modification is not allowed. Use the dedicated tool for manual adjustment.' => '充值订单为自动入账,禁止直接修改,如需补单请走专用工具',
'Missing required parameters' => '参数缺失',
'Idempotency key is too long' => '幂等键过长',
'Withdraw amount must be greater than 0' => '提现金额必须大于0',
'Invalid receive type; only bank/ewallet/crypto are supported' => '收款类型不合法,仅支持 bank/ewallet/crypto',
'Withdraw request submitted; pending channel super admin review' => '提现申请已提交,待渠道超管审核',
'Tier ID already exists' => '档位 ID 已存在',
'Items must be an array' => 'items 必须为数组',
'Please save all registered channel rows (no missing rows)' => '请保存全部已注册渠道行(不可缺行)',
'Please use approve/reject buttons to complete the review' => '请使用通过/拒绝按钮完成审核',
'Apply amount must be greater than 0' => '申请金额必须大于 0',
'Fee cannot be negative' => '手续费不能为负',
'Fee cannot be greater than apply amount' => '手续费不能大于申请金额',
'This order has already been reviewed' => '该订单已审核,无需重复操作',
'Order is missing user info' => '订单缺少用户信息',
'Related user does not exist' => '关联用户不存在',
'User balance is insufficient to cover the adjustment difference' => '用户余额不足以补扣调整差额',
'Please select exactly one role group' => '请选择且仅选择一个角色组',
'Selected role group is not bound to a channel' => '所选角色组未绑定渠道',
'Selected role group channel does not match current account' => '所选角色组渠道与当前账号不一致',
'Invalid operation type' => '操作类型不正确',
'Invalid amount format' => '金额格式不正确',
'Amount must be greater than 0' => '金额必须大于0',
'This user is being operated by another admin (wallet/concurrent save); please try again later' => '该用户正在被其他管理员操作(钱包/并发保存),请稍后再试',
'Insufficient balance; deduction failed' => '余额不足,扣点失败',
'Save failed: user balance changed by another request; please refresh and retry' => '保存失败:该用户余额已被其他请求修改(如下注、派彩或其他管理员已保存),请刷新后重试',
'Wallet adjusted successfully' => '钱包调整成功',
'Please configure at least one share record' => '请至少配置一条分配记录',
'There are no admins under this channel; cannot configure share ratios' => '该渠道下暂无管理员,无法配置分配比例',
'Share ratio must be between 0 and 100' => '分配比例必须在0到100之间',
'Please configure at least one valid share record' => '请至少配置一条有效分配记录',
'Sum of enabled share ratios must equal 100' => '启用的分配比例总和必须等于100',
'Share ratios saved successfully' => '分配比例保存成功',
'Only super admin can settle; after settlement, commissions will be automatically paid to admin wallets' => '仅超管可执行结算,结算后系统会自动发放至管理员钱包',
'Settlement failed' => '结算失败',
'Super admin settlement completed; paid automatically by share ratios' => '超管结算完成,已按分配比例自动发放给管理员',
'Batch settlement completed' => '批量结算完成',
'Invalid settlement cycle' => '结算周期不合法',
'Invalid settlement time format (HH:mm:ss)' => '结算时间格式不正确HH:mm:ss',
'Weekly settlement must select Monday to Sunday' => '周结必须选择周一到周日',
'Monthly settlement day must be between 1 and 31' => '月结日期必须在1到31之间',
'Turnover commission rate must be between 0 and 100' => '返水分红比例必须在0到100之间',
'Affiliate share/fee rates are required' => '联营占成比例不能为空',
'Affiliate share/fee rates must be between 0 and 1' => '联营占成比例必须在0到1之间',
'Affiliate ladder rules are required' => '联营阶梯规则不能为空',
'Affiliate ladder rules must be a valid JSON array' => '联营阶梯规则必须是有效JSON数组',
'Affiliate ladder rules must contain at least one row' => '联营阶梯规则至少需要一条',
'Affiliate ladder rules row format error' => '联营阶梯规则行格式错误',
'Affiliate ladder rules minLoss format error' => '联营阶梯规则起始客损格式错误',
'Affiliate ladder rules shareRate format error' => '联营阶梯规则占成比例格式错误',
'Affiliate ladder rules minLoss cannot be negative' => '联营阶梯规则起始客损不能为负',
'Affiliate ladder rules shareRate must be between 0 and 1' => '联营阶梯规则占成比例必须在0到1之间',
'Affiliate ladder rules must be strictly increasing by minLoss' => '联营阶梯规则需按起始客损递增',
'Withdraw apply failed' => '提现申请失败',
'Debit failed: user balance changed by another request; please refresh and retry' => '扣款失败:该用户余额已被其他请求修改(如下注、派彩或其他管理员已保存),请刷新后重试',
'Deposit' => '充值',
'Mock payment' => '模拟支付',
'Mock third-party cashier' => '模拟第三方收银台',
'Order No' => '订单号',
'Pay channel' => '支付渠道',
'Amount (fiat/pricing)' => '金额(法币/标价)',
'Bonus' => '赠送',
'coin' => '币',
'Click the button below to simulate successful third-party payment; the server will callback and settle the deposit.' => '点击下方按钮即视为第三方支付成功,服务端会回调并到账。',
'Confirm payment (simulate success)' => '确认支付(模拟成功)',
'Order id is invalid' => '订单 ID 非法',
'Order does not exist' => '订单不存在',
'Order number is empty' => '订单号为空',
'Order status does not allow settlement' => '订单状态不允许结算',
'Order amount is invalid' => '订单金额异常',
'Order user is invalid' => '订单所属玩家无效',
'User does not exist' => '玩家不存在',
'Order state changed, please refresh and retry' => '订单状态已变更,请刷新后重试',
'Row format error' => '行格式错误',
'Channel code is not registered' => '渠道 code 未注册',
'Duplicate channel code' => '渠道 code 重复',
'Invalid channel row data' => '渠道数据无效',
'JSON encode failed' => 'JSON 编码失败',
'Tier id is invalid' => '档位 ID 非法',
'Duplicate tier id' => '档位 ID 重复',
'Tier title (zh) is required' => '中文充值名称不能为空',
'Tier title (zh) is too long' => '中文充值名称过长',
'Tier title (en) is too long' => '英文充值名称过长',
'Currency is required' => '支付货币不能为空',
'Pay amount must be greater than 0' => '支付货币额度必须大于 0',
'Base credit amount must be greater than 0' => '基础平台币到账必须大于 0',
'Bonus amount cannot be negative' => '赠送金额不能为负数',
'Description (zh) is too long' => '中文描述过长',
'Description (en) is too long' => '英文描述过长',
'platform_coin format error' => 'platform_coin 格式错误',
'Platform coin labels (zh/en) are required' => '请填写平台币中英文名称',
'At least one currency is required' => '至少保留一条货币',
'Currency row format error' => '货币列表行格式错误',
'Currency code is invalid' => '货币代码非法',
'Duplicate currency code' => '货币代码不能重复',
'Deposit rate must be a number greater than 0' => '充值汇率须为大于 0 的数字',
'Withdraw rate must be a number greater than 0' => '提现汇率须为大于 0 的数字',
'Bank row format error' => '银行行格式错误',
'Bank code is invalid' => '银行代码非法',
'Duplicate bank code' => '银行代码重复',
'Withdraw min limit must be a number not less than 0' => '提现最低限额须为不小于 0 的数字',
'Please configure deposit channels' => '请配置充值渠道',
'Must be exactly 36 items' => '必须恰好 36 条',
'No must be numeric' => '编号必须为数字',
'No must be between 1 and 36' => '编号必须在 136',
'Duplicate no' => '编号重复',
'Name is required' => '名称不能为空',
'Category is invalid' => '类型无效',
'Missing no' => '缺少编号',
'Failed to generate commission rows' => '生成待分红记录失败',
];

View File

@@ -57,17 +57,17 @@ final class DepositSettlement
?string $extraRemark = null
): array {
if ($orderId <= 0) {
throw new RuntimeException('订单 ID 非法');
throw new RuntimeException('Order id is invalid');
}
$order = Db::name('deposit_order')->where('id', $orderId)->find();
if (!$order) {
throw new RuntimeException('订单不存在');
throw new RuntimeException('Order does not exist');
}
$orderNo = is_string($order['order_no']) ? $order['order_no'] : strval($order['order_no']);
if ($orderNo === '') {
throw new RuntimeException('订单号为空');
throw new RuntimeException('Order number is empty');
}
$statusRaw = $order['status'] ?? 0;
@@ -97,12 +97,12 @@ final class DepositSettlement
}
if ($status !== 0) {
throw new RuntimeException('订单状态不允许结算');
throw new RuntimeException('Order status does not allow settlement');
}
$amount = self::amountString($order['amount'] ?? '0');
if (bccomp($amount, '0', 2) <= 0) {
throw new RuntimeException('订单金额异常');
throw new RuntimeException('Order amount is invalid');
}
$bonus = self::amountString($order['bonus_amount'] ?? '0');
if (bccomp($bonus, '0', 2) < 0) {
@@ -112,12 +112,12 @@ final class DepositSettlement
$userId = is_numeric($order['user_id'] ?? null) ? intval($order['user_id']) : 0;
if ($userId <= 0) {
throw new RuntimeException('订单所属玩家无效');
throw new RuntimeException('Order user is invalid');
}
$user = Db::name('user')->where('id', $userId)->find();
if (!$user) {
throw new RuntimeException('玩家不存在');
throw new RuntimeException('User does not exist');
}
$channelId = is_numeric($order['channel_id'] ?? null) ? intval($order['channel_id']) : null;
@@ -149,7 +149,7 @@ final class DepositSettlement
'update_time' => $now,
]);
if ($affected <= 0) {
throw new RuntimeException('订单状态已变更,请刷新后重试');
throw new RuntimeException('Order state changed, please refresh and retry');
}
Db::name('user')->where('id', $userId)->update([

View File

@@ -334,19 +334,19 @@ final class DepositChannel
$out = [];
foreach ($items as $idx => $row) {
if (!is_array($row)) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行格式错误');
throw new InvalidArgumentException('Row format error');
}
$code = isset($row['code']) && is_string($row['code']) ? strtolower(trim($row['code'])) : '';
if ($code === '' || !isset($registry[$code])) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行渠道 code 未注册');
throw new InvalidArgumentException('Channel code is not registered');
}
if (isset($seen[$code])) {
throw new InvalidArgumentException('渠道 code 重复:' . $code);
throw new InvalidArgumentException('Duplicate channel code');
}
$seen[$code] = true;
$norm = self::normalizeOverrides([array_merge($row, ['code' => $code])]);
if ($norm === []) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行渠道数据无效');
throw new InvalidArgumentException('Invalid channel row data');
}
$out[] = $norm[0];
}
@@ -369,7 +369,7 @@ final class DepositChannel
$wrapped = ['channels' => $items];
$encoded = json_encode($wrapped, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
if ($encoded === false) {
throw new InvalidArgumentException('JSON 编码失败');
throw new InvalidArgumentException('JSON encode failed');
}
return $encoded;

View File

@@ -149,7 +149,7 @@ final class DepositTier
foreach ($items as $idx => $row) {
$no = $idx + 1;
if (!is_array($row)) {
throw new InvalidArgumentException('第 ' . $no . ' 行格式错误');
throw new InvalidArgumentException('Row format error');
}
$id = isset($row['id']) && is_string($row['id']) ? trim($row['id']) : '';
@@ -157,10 +157,10 @@ final class DepositTier
$id = self::generateId();
}
if (!preg_match('/^[a-zA-Z0-9_\-]{1,32}$/', $id)) {
throw new InvalidArgumentException('第 ' . $no . ' 行 ID 非法');
throw new InvalidArgumentException('Tier id is invalid');
}
if (isset($seenId[$id])) {
throw new InvalidArgumentException('档位 ID 重复:' . $id);
throw new InvalidArgumentException('Duplicate tier id');
}
$seenId[$id] = true;
@@ -170,45 +170,45 @@ final class DepositTier
$title = self::stringField($row, 'name');
}
if ($title === '') {
throw new InvalidArgumentException('第 ' . $no . ' 行中文充值名称不能为空');
throw new InvalidArgumentException('Tier title (zh) is required');
}
if (mb_strlen($title) > 64) {
throw new InvalidArgumentException('第 ' . $no . ' 行中文充值名称过长');
throw new InvalidArgumentException('Tier title (zh) is too long');
}
$titleEn = self::stringField($row, 'title_en');
if (mb_strlen($titleEn) > 64) {
throw new InvalidArgumentException('第 ' . $no . ' 行英文充值名称过长');
throw new InvalidArgumentException('Tier title (en) is too long');
}
$currency = self::normalizeCurrency($row['currency'] ?? '');
if ($currency === '') {
throw new InvalidArgumentException('第 ' . $no . ' 行支付货币不能为空');
throw new InvalidArgumentException('Currency is required');
}
$payAmount = self::normalizeAmount($row['pay_amount'] ?? '');
if (bccomp($payAmount, '0', 2) <= 0) {
throw new InvalidArgumentException('第 ' . $no . ' 行支付货币额度必须大于 0');
throw new InvalidArgumentException('Pay amount must be greater than 0');
}
$amount = self::normalizeAmount($row['amount'] ?? '');
if (bccomp($amount, '0', 2) <= 0) {
throw new InvalidArgumentException('第 ' . $no . ' 行基础平台币到账必须大于 0');
throw new InvalidArgumentException('Base credit amount must be greater than 0');
}
$bonus = self::normalizeAmount($row['bonus_amount'] ?? '0');
if (bccomp($bonus, '0', 2) < 0) {
throw new InvalidArgumentException('第 ' . $no . ' 行赠送金额不能为负数');
throw new InvalidArgumentException('Bonus amount cannot be negative');
}
$desc = self::stringField($row, 'desc');
if (mb_strlen($desc) > 255) {
throw new InvalidArgumentException('第 ' . $no . ' 行中文描述过长');
throw new InvalidArgumentException('Description (zh) is too long');
}
$descEn = self::stringField($row, 'desc_en');
if (mb_strlen($descEn) > 255) {
throw new InvalidArgumentException('第 ' . $no . ' 行英文描述过长');
throw new InvalidArgumentException('Description (en) is too long');
}
$sort = isset($row['sort']) && is_numeric($row['sort']) ? intval($row['sort']) : 0;
@@ -248,7 +248,7 @@ final class DepositTier
{
$encoded = json_encode($items, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
if ($encoded === false) {
throw new InvalidArgumentException('JSON 编码失败');
throw new InvalidArgumentException('JSON encode failed');
}
return $encoded;
}

View File

@@ -328,50 +328,50 @@ final class FinanceCashierConfig
private static function validate(array $p): void
{
if (!isset($p['platform_coin']) || !is_array($p['platform_coin'])) {
throw new InvalidArgumentException('platform_coin 格式错误');
throw new InvalidArgumentException('platform_coin format error');
}
$lz = $p['platform_coin']['label_zh'] ?? '';
$le = $p['platform_coin']['label_en'] ?? '';
if (!is_string($lz) || trim($lz) === '' || !is_string($le) || trim($le) === '') {
throw new InvalidArgumentException('请填写平台币中英文名称');
throw new InvalidArgumentException('Platform coin labels (zh/en) are required');
}
if (!isset($p['currencies']) || !is_array($p['currencies']) || $p['currencies'] === []) {
throw new InvalidArgumentException('至少保留一条货币');
throw new InvalidArgumentException('At least one currency is required');
}
$seenCodes = [];
foreach ($p['currencies'] as $idx => $row) {
if (!is_array($row)) {
throw new InvalidArgumentException('货币列表第 ' . ($idx + 1) . ' 行格式错误');
throw new InvalidArgumentException('Currency row format error');
}
$code = $row['code'] ?? '';
if (!is_string($code) || !preg_match('/^[A-Z0-9]{2,12}$/', $code)) {
throw new InvalidArgumentException('货币代码非法:' . (is_string($code) ? $code : ''));
throw new InvalidArgumentException('Currency code is invalid');
}
if (isset($seenCodes[$code])) {
throw new InvalidArgumentException('货币代码不能重复:' . $code);
throw new InvalidArgumentException('Duplicate currency code');
}
$seenCodes[$code] = true;
$dep = $row['deposit_coins_per_fiat'] ?? '';
$wdr = $row['withdraw_coins_per_fiat'] ?? '';
if (!is_string($dep) || $dep === '' || !is_numeric($dep) || bccomp($dep, '0', 2) <= 0) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行:充值汇率须为大于 0 的数字');
throw new InvalidArgumentException('Deposit rate must be a number greater than 0');
}
if (!is_string($wdr) || $wdr === '' || !is_numeric($wdr) || bccomp($wdr, '0', 2) <= 0) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行:提现汇率须为大于 0 的数字');
throw new InvalidArgumentException('Withdraw rate must be a number greater than 0');
}
}
if (isset($p['withdraw_banks']) && is_array($p['withdraw_banks'])) {
$seen = [];
foreach ($p['withdraw_banks'] as $idx => $row) {
if (!is_array($row)) {
throw new InvalidArgumentException('银行第 ' . ($idx + 1) . ' 行格式错误');
throw new InvalidArgumentException('Bank row format error');
}
$code = $row['code'] ?? '';
if (!is_string($code) || !preg_match('/^[a-z0-9][a-z0-9_\-]{0,31}$/', $code)) {
throw new InvalidArgumentException('银行代码非法');
throw new InvalidArgumentException('Bank code is invalid');
}
if (isset($seen[$code])) {
throw new InvalidArgumentException('银行代码重复:' . $code);
throw new InvalidArgumentException('Duplicate bank code');
}
$seen[$code] = true;
}
@@ -380,13 +380,13 @@ final class FinanceCashierConfig
foreach (['min_ewallet', 'min_bank'] as $k) {
$v = $p['withdraw_limits'][$k] ?? '0';
if (!is_string($v) || !is_numeric($v) || bccomp($v, '0', 2) < 0) {
throw new InvalidArgumentException('提现最低限额须为不小于 0 的数字');
throw new InvalidArgumentException('Withdraw min limit must be a number not less than 0');
}
}
}
$reg = DepositChannel::codeRegistry();
if ($reg !== [] && (!isset($p['channels']) || !is_array($p['channels']) || $p['channels'] === [])) {
throw new InvalidArgumentException('请配置充值渠道');
throw new InvalidArgumentException('Please configure deposit channels');
}
}
}

View File

@@ -168,43 +168,43 @@ final class ZiHuaDictionary
public static function prepareItemsForSave(array $items): array
{
if (count($items) !== 36) {
throw new InvalidArgumentException('必须恰好 36 条');
throw new InvalidArgumentException('Must be exactly 36 items');
}
$nos = [];
$out = [];
foreach ($items as $idx => $row) {
if (!is_array($row)) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行格式错误');
throw new InvalidArgumentException('Row format error');
}
$no = $row['no'] ?? null;
if (!is_numeric($no)) {
throw new InvalidArgumentException('编号必须为数字');
throw new InvalidArgumentException('No must be numeric');
}
$n = intval($no, 10);
if ($n < 1 || $n > 36) {
throw new InvalidArgumentException('编号必须在 136');
throw new InvalidArgumentException('No must be between 1 and 36');
}
if (isset($nos[$n])) {
throw new InvalidArgumentException('编号重复:' . $n);
throw new InvalidArgumentException('Duplicate no');
}
$nos[$n] = true;
$name = $row['name'] ?? '';
if (!is_string($name) || trim($name) === '') {
throw new InvalidArgumentException('编号 ' . $n . ' 名称不能为空');
throw new InvalidArgumentException('Name is required');
}
$cat = $row['category'] ?? '';
$catTrim = is_string($cat) ? trim($cat) : '';
if (!in_array($catTrim, self::CATEGORIES, true)) {
throw new InvalidArgumentException('编号 ' . $n . ' 类型无效');
throw new InvalidArgumentException('Category is invalid');
}
$out[] = ['no' => $n, 'name' => trim($name), 'category' => $catTrim];
}
for ($i = 1; $i <= 36; $i++) {
if (!isset($nos[$i])) {
throw new InvalidArgumentException('缺少编号:' . $i);
throw new InvalidArgumentException('Missing no');
}
}
usort($out, static fn (array $a, array $b): int => $a['no'] <=> $b['no']);
@@ -219,7 +219,7 @@ final class ZiHuaDictionary
usort($items, static fn (array $a, array $b): int => $a['no'] <=> $b['no']);
$encoded = json_encode($items, JSON_UNESCAPED_UNICODE);
if ($encoded === false) {
throw new InvalidArgumentException('JSON 编码失败');
throw new InvalidArgumentException('JSON encode failed');
}
return $encoded;
}

View File

@@ -77,7 +77,7 @@ class AdminWalletService
if (is_array($existing)) {
$existAdminId = intval($existing['admin_id'] ?? 0);
if ($existAdminId !== $adminId) {
return ['ok' => false, 'msg' => 'Idempotency key conflict'];
return ['ok' => false, 'msg' => __('Idempotency key conflict')];
}
return [
'ok' => true,
@@ -90,7 +90,7 @@ class AdminWalletService
$wallet = self::ensureWallet($adminId);
$before = strval($wallet['balance'] ?? '0.00');
if (bccomp($before, $withdrawCoin, 2) < 0) {
return ['ok' => false, 'msg' => '钱包余额不足'];
return ['ok' => false, 'msg' => __('Insufficient wallet balance')];
}
$after = bcsub($before, $withdrawCoin, 2);
$beforeFrozen = strval($wallet['frozen_balance'] ?? '0.00');

View File

@@ -13,7 +13,7 @@ class ChannelSettlementService
{
$channel = Db::name('channel')->where('id', $channelId)->find();
if (!is_array($channel)) {
return ['ok' => false, 'msg' => '渠道不存在'];
return ['ok' => false, 'msg' => __('Channel not found')];
}
$payload = self::buildSettlePayload($channel);
if (is_string($payload)) {
@@ -21,11 +21,11 @@ class ChannelSettlementService
}
$settlementNo = self::generateAgentSettlementNo($auto ? 'A' : 'M', $channelId, intval($payload['period_end_ts']));
if (Db::name('agent_settlement_period')->where('settlement_no', $settlementNo)->value('id')) {
return ['ok' => false, 'msg' => '结算单号冲突,请重试'];
return ['ok' => false, 'msg' => __('Settlement number conflict, please retry')];
}
$shareRows = self::resolveCommissionSharesForChannel($channelId);
if ($shareRows === []) {
return ['ok' => false, 'msg' => '渠道下无可用管理员分配比例,无法结算'];
return ['ok' => false, 'msg' => __('No available admin share ratios under this channel; cannot settle')];
}
$now = time();
Db::startTrans();
@@ -52,7 +52,7 @@ class ChannelSettlementService
$now
);
if ($rows === []) {
throw new \RuntimeException('生成待分红记录失败');
throw new \RuntimeException('Failed to generate commission rows');
}
foreach ($rows as $row) {
$adminId = intval($row['admin_id'] ?? 0);
@@ -92,7 +92,7 @@ class ChannelSettlementService
public static function settleDividendByChannelAdmin(int $channelId, int $operatorAdminId, string $remark = ''): array
{
return ['ok' => false, 'msg' => '当前流程为超管结算后自动发放,渠道管理员无需二次结算'];
return ['ok' => false, 'msg' => __('This flow pays commissions automatically after super admin settlement; channel admin does not need to settle again')];
}
public static function settleAllDueChannels(int $operatorAdminId, bool $respectCycle = true): array
@@ -159,14 +159,14 @@ class ChannelSettlementService
{
$channelId = intval($row['id'] ?? 0);
if ($channelId <= 0) {
return '渠道数据异常';
return (string) __('Invalid channel data');
}
$endTs = time();
$lastEnd = self::getLastSettlementEndForChannel($channelId);
$channelCreateTs = intval($row['create_time'] ?? 0);
$periodStartTs = $lastEnd === null ? ($channelCreateTs > 0 ? $channelCreateTs : 0) : $lastEnd;
if ($periodStartTs >= $endTs) {
return '结算区间无效(开始时间不早于当前)';
return (string) __('Invalid settlement period (start time is not earlier than now)');
}
$stats = self::aggregateBetOrderForChannel($channelId, $periodStartTs, $lastEnd !== null, $endTs);
$totalBet = $stats['total_bet'];
@@ -234,7 +234,7 @@ class ChannelSettlementService
if ($mode === 'turnover') {
$ratePercent = $row['turnover_share_rate'] ?? null;
if ($ratePercent === null || $ratePercent === '') {
return '普通返水代理未配置返水分红比例';
return (string) __('Turnover agent commission rate is not configured');
}
$rateDec = bcdiv(strval($ratePercent), '100', 4);
return [
@@ -247,11 +247,11 @@ class ChannelSettlementService
$fee = $row['affiliate_fee_rate'] ?? null;
$rulesRaw = $row['affiliate_ladder_rules'] ?? null;
if ($fee === null || $fee === '') {
return '联营代理未配置成本扣除比例';
return (string) __('Affiliate agent fee rate is not configured');
}
$rules = self::normalizeLadderRulesForSettlement($rulesRaw);
if ($rules === []) {
return '联营阶梯规则无效或为空';
return (string) __('Affiliate ladder rules are empty or invalid');
}
if (bccomp($platformProfit, '0', 2) <= 0) {
return ['commission_rate' => '0.0000', 'calc_base_amount' => '0.00', 'commission_amount' => '0.00'];
@@ -268,7 +268,7 @@ class ChannelSettlementService
'commission_amount' => bcmul($afterFee, $rateDec, 2),
];
}
return '未知的代理模式';
return (string) __('Unknown agent mode');
}
private static function normalizeLadderRulesForSettlement(mixed $rulesRaw): array

View File

@@ -25,6 +25,15 @@ final class GameHotDataRedis
private const KEY_USER = 'dfw:v1:user:';
/**
* 进程内实例化缓存(避免同一请求/进程内重复打 Redis/DB
* - key => null表示已确认不存在负缓存
* - key => array表示已加载行数据
*
* @var array<string, array<string, mixed>|null>
*/
private static array $gcLocal = [];
public static function enabled(): bool
{
return config('game_hot_cache.enabled', true) === true;
@@ -38,23 +47,30 @@ final class GameHotDataRedis
if ($configKey === '') {
return null;
}
if (array_key_exists($configKey, self::$gcLocal)) {
$cachedLocal = self::$gcLocal[$configKey];
return is_array($cachedLocal) ? $cachedLocal : null;
}
if (self::enabled()) {
$cached = self::redisGet(self::KEY_GC . $configKey);
if ($cached !== null && $cached !== '') {
$decoded = json_decode($cached, true);
if (is_array($decoded)) {
self::$gcLocal[$configKey] = $decoded;
return $decoded;
}
}
}
$row = Db::name('game_config')->where('config_key', $configKey)->find();
if (!$row) {
self::$gcLocal[$configKey] = null;
return null;
}
if (self::enabled()) {
$ttl = self::intConfig('ttl_game_config', 86400);
self::redisSetEx(self::KEY_GC . $configKey, $ttl, json_encode($row, JSON_UNESCAPED_UNICODE));
}
self::$gcLocal[$configKey] = $row;
return $row;
}
@@ -64,6 +80,7 @@ final class GameHotDataRedis
return;
}
self::redisDel(self::KEY_GC . $configKey);
unset(self::$gcLocal[$configKey]);
}
/**
@@ -81,6 +98,7 @@ final class GameHotDataRedis
}
$ttl = self::intConfig('ttl_game_config', 86400);
self::redisSetEx(self::KEY_GC . $configKey, $ttl, json_encode($row, JSON_UNESCAPED_UNICODE));
self::$gcLocal[$configKey] = $row;
}
/**

View File

@@ -52,23 +52,102 @@ final class GameLiveService
if ($recordId <= 0) {
return;
}
$status = (int) ($row['status'] ?? 0);
$resultNumber = isset($row['result_number']) ? (int) $row['result_number'] : 0;
if ($resultNumber > 0 && in_array($status, [0, 1, 2, 3], true)) {
self::recoverPayoutForRecordOnStartup($recordId);
return;
}
$periodStartAt = (int) ($row['period_start_at'] ?? 0);
if ($periodStartAt <= 0) {
return;
}
$periodSeconds = self::getConfigInt(self::KEY_PERIOD_SECONDS, 30);
$timeoutAt = $periodStartAt + $periodSeconds + self::PAYOUT_GRACE_SECONDS + self::STARTUP_RECOVER_GRACE_SECONDS;
if (time() <= $timeoutAt) {
return;
}
self::markAbnormalAndRefundOnStartup($recordId, $status);
}
$status = (int) ($row['status'] ?? 0);
private static function recoverPayoutForRecordOnStartup(int $recordId): void
{
$lock = GameHotDataLock::tryAcquireWithWait(GameHotDataLock::TYPE_GAME_RECORD, (string) $recordId, 3000);
if (!$lock['acquired']) {
return;
}
try {
$row = Db::name('game_record')->where('id', $recordId)->find();
if (!$row) {
return;
}
$status = (int) ($row['status'] ?? 0);
if (!in_array($status, [0, 1, 2, 3], true)) {
return;
}
$resultNumber = isset($row['result_number']) ? (int) $row['result_number'] : 0;
if ($resultNumber <= 0) {
return;
}
$now = time();
$payoutUntil = isset($row['payout_until']) ? (int) $row['payout_until'] : 0;
Db::startTrans();
try {
GameBetSettleService::settleBetsForDraw($recordId, $resultNumber);
if ($status === 2) {
if ($payoutUntil <= 0) {
$payoutUntil = $now + self::PAYOUT_GRACE_SECONDS;
}
Db::name('game_record')->where('id', $recordId)->update([
'status' => 3,
'payout_until' => $payoutUntil,
'update_time' => $now,
]);
} elseif ($status === 3) {
if ($payoutUntil <= 0) {
$payoutUntil = $now;
Db::name('game_record')->where('id', $recordId)->update([
'payout_until' => $payoutUntil,
'update_time' => $now,
]);
}
} else {
$payoutUntil = $now;
Db::name('game_record')->where('id', $recordId)->update([
'status' => 3,
'payout_until' => $payoutUntil,
'update_time' => $now,
]);
}
Db::commit();
} catch (Throwable $e) {
Db::rollback();
Log::warning('game live startup payout recover failed', [
'record_id' => $recordId,
'error' => $e->getMessage(),
]);
return;
}
GameHotDataCoordinator::afterGameRecordCommitted($recordId);
self::publishSnapshot(null);
if ($payoutUntil <= $now) {
self::finalizePayoutForRecordLocked($recordId);
}
} finally {
GameHotDataLock::release(GameHotDataLock::TYPE_GAME_RECORD, (string) $recordId, $lock['token'], $lock['redis_lock']);
}
}
private static function markAbnormalAndRefundOnStartup(int $recordId, int $status): void
{
$lock = GameHotDataLock::tryAcquireWithWait(GameHotDataLock::TYPE_GAME_RECORD, (string) $recordId, 3000);
if (!$lock['acquired']) {
return;
}
try {
$fresh = Db::name('game_record')->where('id', $recordId)->find();
if (!$fresh) {
@@ -78,12 +157,8 @@ final class GameLiveService
if (!in_array($freshStatus, [0, 1, 2, 3], true)) {
return;
}
$freshPeriodStartAt = (int) ($fresh['period_start_at'] ?? 0);
if ($freshPeriodStartAt <= 0) {
return;
}
$freshTimeoutAt = $freshPeriodStartAt + $periodSeconds + self::PAYOUT_GRACE_SECONDS + self::STARTUP_RECOVER_GRACE_SECONDS;
if (time() <= $freshTimeoutAt) {
$freshResultNumber = isset($fresh['result_number']) ? (int) $fresh['result_number'] : 0;
if ($freshResultNumber > 0) {
return;
}
@@ -92,13 +167,12 @@ final class GameLiveService
Db::startTrans();
try {
$refund = self::refundPendingBetsSummaryForPeriodLocked($recordId, $now);
$oldStatus = $freshStatus;
$refundedUserCount = count($refund['user_ids']);
$refundedOrderCount = (int) ($refund['order_count'] ?? 0);
$refundedTotalAmount = is_string($refund['total_amount'] ?? null) ? $refund['total_amount'] : '0.00';
$reason = sprintf(
'system_recover:from=%d|users=%d|orders=%d|amount=%s',
$oldStatus,
$freshStatus,
$refundedUserCount,
$refundedOrderCount,
$refundedTotalAmount
@@ -114,8 +188,9 @@ final class GameLiveService
Db::commit();
} catch (Throwable $e) {
Db::rollback();
Log::warning('game live startup recover failed', [
Log::warning('game live startup abnormal recover failed', [
'record_id' => $recordId,
'status' => $status,
'error' => $e->getMessage(),
]);
return;
@@ -129,7 +204,7 @@ final class GameLiveService
}
GameRecordService::bootstrapPeriodWhenRuntimeEnabled();
self::publishSnapshot(null);
Log::info('game live startup recovered abnormal period', [
Log::info('game live startup marked abnormal and refunded', [
'record_id' => $recordId,
'old_status' => $freshStatus,
'refunded_user_count' => count($refund['user_ids']),
@@ -141,6 +216,34 @@ final class GameLiveService
}
}
private static function finalizePayoutForRecordLocked(int $recordId): void
{
$now = time();
Db::startTrans();
try {
Db::name('game_record')->where('id', $recordId)->where('status', 3)->update([
'status' => 4,
'payout_until' => null,
'update_time' => $now,
]);
GameRecordService::createNextRecordAfterDraw();
Db::commit();
} catch (Throwable $e) {
Db::rollback();
Log::warning('game live startup finalize payout failed', [
'record_id' => $recordId,
'error' => $e->getMessage(),
]);
return;
}
GameHotDataCoordinator::afterGameRecordCommitted($recordId);
try {
GameRecordStatService::refreshForRecordId($recordId);
} catch (Throwable) {
}
self::publishSnapshot(null);
}
public static function buildSnapshot(?int $recordId = null): array
{
$record = self::resolveRecord($recordId);
@@ -170,9 +273,12 @@ final class GameLiveService
}
$bets = Db::name('bet_order')
->where('period_id', $rid)
->order('id', 'desc')
->alias('bo')
->leftJoin('user gu', 'gu.id = bo.user_id')
->where('bo.period_id', $rid)
->order('bo.id', 'desc')
->limit(200)
->field('bo.id,bo.user_id,bo.period_no,bo.pick_numbers,bo.total_amount,bo.streak_at_bet,bo.create_time,gu.username as user_username')
->select()
->toArray();
@@ -218,6 +324,7 @@ final class GameLiveService
return [
'id' => (int) $row['id'],
'user_id' => (int) $row['user_id'],
'username' => isset($row['user_username']) && is_string($row['user_username']) ? $row['user_username'] : '',
'period_no' => (string) $row['period_no'],
'pick_numbers' => $row['pick_numbers'],
'total_amount' => (string) $row['total_amount'],

View File

@@ -71,14 +71,14 @@ final class GameRecordService
public static function createNextRecordForManual(): array
{
if (!self::getConfigBool(self::KEY_MANUAL_CREATE)) {
return ['ok' => false, 'msg' => '未开启「手动创建下一局」开关'];
return ['ok' => false, 'msg' => __('Manual create next round is disabled')];
}
if (self::hasActiveRecord()) {
return ['ok' => false, 'msg' => '存在未结束对局,无法新建'];
return ['ok' => false, 'msg' => __('There is an unfinished round; cannot create a new one')];
}
try {
$periodNo = self::createNextRecordRow();
return ['ok' => true, 'msg' => '已创建新对局', 'period_no' => $periodNo];
return ['ok' => true, 'msg' => __('New round created'), 'period_no' => $periodNo];
} catch (Throwable $e) {
return ['ok' => false, 'msg' => $e->getMessage()];
}

View File

@@ -76,6 +76,14 @@ abstract class BaseController
*/
protected function result(string $msg, mixed $data = null, int $code = 0, array $header = []): Response
{
// 统一对返回 msg 做多语言翻译:若 $msg 为语言 key英文则按请求语言输出
// 若无对应翻译,则保持原样返回。
if ($msg !== '' && function_exists('__')) {
$translated = __($msg);
if (is_string($translated) && $translated !== '') {
$msg = $translated;
}
}
$body = [
'code' => $code,
'msg' => $msg,

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
-- 已上线环境:移除后台「会员管理」目录及子菜单、相关安全配置项(与代码移除配套执行)
-- 执行前请备份数据库
DELETE FROM admin_rule WHERE `name` = 'user' OR `name` LIKE 'user/%';
DELETE FROM security_sensitive_data WHERE `id` = 2;
DELETE FROM security_data_recycle WHERE `id` = 5;
-- ---------------------------------------------------------------------------
-- 以下可选:物理删除会员业务表(执行后 /api/user、/api/account 等会员接口将不可用)
-- 若仍使用前台会员中心,请勿执行 DROP并保留 user、user_group、user_rule 等表
-- ---------------------------------------------------------------------------
-- SET FOREIGN_KEY_CHECKS = 0;
-- DROP TABLE IF EXISTS `user_money_log`;
-- DROP TABLE IF EXISTS `user_score_log`;
-- DROP TABLE IF EXISTS `user`;
-- DROP TABLE IF EXISTS `user_group`;
-- SET FOREIGN_KEY_CHECKS = 1;
-- 说明:`user_rule` 仍用于前台会员菜单与权限,若整体下线会员功能再单独处理

View File

@@ -3,6 +3,7 @@ export default {
admin_id: 'admin_id',
admin_username: 'admin_username',
channel_id: 'channel_id',
channel_name: 'channel',
balance: 'available_balance',
frozen_balance: 'frozen_balance',
total_income: 'total_income',

View File

@@ -11,7 +11,14 @@ export default {
balance_before: 'balance_before',
balance_after: 'balance_after',
ref_type: 'ref_type',
ref_title: 'reference_title',
ref_id: 'ref_id',
'ref title agent_commission_record': 'Agent commission',
'ref title admin_withdraw_order': 'Admin withdraw order',
'ref title withdraw_order': 'Withdraw order',
'ref title deposit_order': 'Deposit order',
'ref title bet_order': 'Bet order',
'ref title admin_user_wallet_adjust': 'Admin wallet adjustment',
idempotency_key: 'idempotency_key',
operator_admin_username: 'operator_admin',
remark: 'remark',

View File

@@ -31,6 +31,7 @@ export default {
bet_stream_title: 'Realtime bet stream',
bet_id: 'Bet ID',
user_id: 'Player ID',
username: 'Username',
pick_numbers: 'Pick numbers',
total_amount: 'Total bet amount',
streak_at_bet: 'Streak at bet',

View File

@@ -3,6 +3,7 @@ export default {
admin_id: '管理员ID',
admin_username: '管理员账号',
channel_id: '渠道ID',
channel_name: '渠道',
balance: '可用余额',
frozen_balance: '冻结余额',
total_income: '累计入账',

View File

@@ -11,7 +11,14 @@ export default {
balance_before: '变动前余额',
balance_after: '变动后余额',
ref_type: '来源类型',
ref_title: '关联标题',
ref_id: '来源ID',
'ref title agent_commission_record': '代理分红记录',
'ref title admin_withdraw_order': '管理员提现单',
'ref title withdraw_order': '用户提现单',
'ref title deposit_order': '用户充值单',
'ref title bet_order': '注单记录',
'ref title admin_user_wallet_adjust': '后台钱包调整',
idempotency_key: '幂等键',
operator_admin_username: '操作管理员',
remark: '备注',

View File

@@ -31,6 +31,7 @@ export default {
bet_stream_title: '实时下注记录',
bet_id: '注单ID',
user_id: '玩家ID',
username: '用户名',
pick_numbers: '下注号码',
total_amount: '下注总额',
streak_at_bet: '下注时连胜',

View File

@@ -25,7 +25,7 @@ const assignLocale: anyObj = {
export async function loadLang(app: App) {
const config = useConfig()
const locale = config.lang.defaultLang
const locale = config.lang.defaultLang === 'zh' ? 'zh-cn' : config.lang.defaultLang
// 加载框架全局语言包
const lang = await import(`./globs-${locale}.ts`)
@@ -70,7 +70,7 @@ export async function loadLang(app: App) {
locale: locale,
legacy: false, // 组合式api
globalInjection: true, // 挂载$t,$d等到全局
fallbackLocale: config.lang.fallbackLang,
fallbackLocale: config.lang.fallbackLang === 'zh' ? 'zh-cn' : config.lang.fallbackLang,
messages,
})

View File

@@ -44,12 +44,13 @@ router.beforeEach((to, from, next) => {
.join('/')
}
const config = useConfig()
const langCode = config.lang.defaultLang === 'zh' ? 'zh-cn' : config.lang.defaultLang
if (to.path in langAutoLoadMap) {
loadPath.push(...langAutoLoadMap[to.path as keyof typeof langAutoLoadMap])
}
let prefix = ''
if (isAdminApp(to.fullPath)) {
prefix = './backend/' + config.lang.defaultLang
prefix = './backend/' + langCode
// 去除 path 中的 /admin
const adminPath = to.path.slice(to.path.indexOf(adminBaseRoutePath) + adminBaseRoutePath.length)
@@ -58,7 +59,7 @@ router.beforeEach((to, from, next) => {
loadPath.push(prefix + toCamelPath(adminPath) + '.ts')
}
} else {
prefix = './frontend/' + config.lang.defaultLang
prefix = './frontend/' + langCode
loadPath.push(prefix + to.path + '.ts')
}
@@ -80,7 +81,7 @@ router.beforeEach((to, from, next) => {
loadPath = uniq(loadPath)
for (const key in loadPath) {
loadPath[key] = loadPath[key].replaceAll('${lang}', config.lang.defaultLang)
loadPath[key] = loadPath[key].replaceAll('${lang}', langCode)
if (loadPath[key] in window.loadLangHandle) {
window.loadLangHandle[loadPath[key]]().then((res: { default: anyObj }) => {
const pathName = loadPath[key].slice(loadPath[key].lastIndexOf(prefix) + (prefix.length + 1), loadPath[key].lastIndexOf('.'))

View File

@@ -27,10 +27,51 @@ const baTable = new baTableClass(
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.id'),
prop: 'id',
align: 'center',
width: 70,
operator: 'RANGE',
sortable: 'custom',
},
{
label: t('admin.adminWallet.admin_id'),
prop: 'admin_id',
align: 'center',
show: false,
width: 90,
operator: 'RANGE',
sortable: false,
},
{
label: t('admin.adminWallet.admin_username'),
prop: 'admin.username',
align: 'center',
minWidth: 140,
operator: 'LIKE',
render: 'tag',
customRenderAttr: {
tag: () => ({
color: '#e8f3ff',
style: { color: '#1677ff', borderColor: '#91caff' },
}),
},
},
{
label: t('admin.adminWallet.channel_name'),
prop: 'channel_name',
align: 'center',
minWidth: 120,
operator: 'LIKE',
render: 'tag',
customRenderAttr: {
tag: () => ({
color: '#f0f9eb',
style: { color: '#67c23a', borderColor: '#b3e19d' },
}),
},
},
{ 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' },

View File

@@ -21,6 +21,24 @@ defineOptions({
const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
const refTypeReplace = {
agent_commission_record: t('admin.adminWalletRecord.ref title agent_commission_record'),
admin_withdraw_order: t('admin.adminWalletRecord.ref title admin_withdraw_order'),
withdraw_order: t('admin.adminWalletRecord.ref title withdraw_order'),
deposit_order: t('admin.adminWalletRecord.ref title deposit_order'),
bet_order: t('admin.adminWalletRecord.ref title bet_order'),
admin_user_wallet_adjust: t('admin.adminWalletRecord.ref title admin_user_wallet_adjust'),
}
const refTypeTagCustom = {
agent_commission_record: 'success',
admin_withdraw_order: 'warning',
withdraw_order: 'danger',
deposit_order: 'primary',
bet_order: 'info',
admin_user_wallet_adjust: 'warning',
}
const baTable = new baTableClass(
new baTableApi('/admin/admin.AdminWalletRecord/'),
{
@@ -45,8 +63,17 @@ const baTable = new baTableClass(
{ 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.ref_title'),
prop: 'ref_type',
align: 'center',
minWidth: 150,
operator: 'eq',
render: 'tag',
replaceValue: refTypeReplace,
custom: refTypeTagCustom,
},
{ label: t('admin.adminWalletRecord.ref_id'), prop: 'ref_id', align: 'center', minWidth: 100, operator: 'RANGE', show: false },
{ 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 },

View File

@@ -27,6 +27,18 @@
@change="onRuntimeSwitch"
/>
<span v-if="snapshot.maintenance_ui" class="live-top-toolbar__hint">{{ t('game.live.runtime_off_tip') }}</span>
<div class="live-top-toolbar__actions">
<el-button
class="live-top-toolbar__btn-void"
type="danger"
plain
:disabled="asideOperationLocked || !canVoidPeriod || voidSubmitting || runtimeSwitchLoading"
@click="openVoidDialog"
>
{{ t('game.live.void_btn') }}
</el-button>
<el-button :loading="loading" :disabled="asideOperationLocked" @click="loadSnapshot">{{ t('Refresh') }}</el-button>
</div>
</div>
</div>
@@ -78,75 +90,76 @@
</span>
</div>
</div>
<aside class="live-control-aside" :class="{ 'is-locked': asideOperationLocked }">
<div class="aside-title">{{ t('game.live.action_panel') }}</div>
<el-button
class="aside-void-btn"
type="danger"
plain
:disabled="asideOperationLocked || !canVoidPeriod || voidSubmitting || runtimeSwitchLoading"
@click="openVoidDialog"
>
{{ t('game.live.void_btn') }}
</el-button>
<div class="aside-field">
<span class="aside-field__label">{{ t('game.live.manual_draw_number') }}</span>
<el-input-number
v-model="manualNumber"
class="aside-field__input"
:min="1"
:max="snapshot.draw_number_max ?? 36"
:step="1"
:disabled="asideOperationLocked"
controls-position="right"
/>
</div>
<div class="aside-btns">
<el-button
:loading="calcLoading"
:disabled="asideOperationLocked || !snapshot.can_calculate"
@click="onCalculate"
>
{{ t('game.live.btn_calc') }}
</el-button>
<el-button
type="primary"
:loading="drawLoading"
:disabled="asideOperationLocked || !snapshot.can_schedule_draw"
@click="onDraw"
>
{{ t('game.live.btn_draw') }}
</el-button>
<el-button :loading="loading" :disabled="asideOperationLocked" @click="loadSnapshot">{{ t('Refresh') }}</el-button>
</div>
</aside>
</div>
</el-card>
<el-row :gutter="12">
<el-col :span="12">
<el-row :gutter="12" class="live-tables-row">
<el-col :xs="24" :sm="12">
<el-card shadow="never">
<template #header>{{ t('game.live.candidate_title') }}</template>
<el-table :data="snapshot.candidate_numbers" height="420">
<el-table-column prop="number" :label="t('game.live.number')" width="100" />
<el-table-column prop="estimated_loss" :label="t('game.live.estimated_loss')" />
<el-table
:data="candidateNumbersSorted"
:height="tableHeight"
:row-class-name="candidateRowClassName"
class="candidate-table"
:default-sort="{ prop: 'estimated_loss', order: 'ascending' }"
@sort-change="onCandidateSortChange"
>
<el-table-column prop="number" :label="t('game.live.number')" width="76" align="center" header-align="center" sortable="custom">
<template #default="scope">
<el-tag size="small" effect="plain" class="number-tag">
{{ scope.row.number ?? '-' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="estimated_loss"
:label="t('game.live.estimated_loss')"
width="110"
align="center"
header-align="center"
sortable="custom"
/>
<el-table-column :label="t('game.live.btn_draw')" width="96" align="center" header-align="center">
<template #default="scope">
<el-switch
:model-value="isScheduledNumber(scope.row.number)"
:loading="drawLoading && pendingSwitchNumber === scope.row.number"
:disabled="asideOperationLocked || !snapshot.can_schedule_draw || drawLoading"
inline-prompt
@change="(v:boolean) => onPickSwitchChange(v, scope.row.number)"
/>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="12">
<el-col :xs="24" :sm="12">
<el-card shadow="never">
<template #header>{{ t('game.live.bet_stream_title') }}</template>
<el-table :data="snapshot.bets" height="420">
<el-table-column prop="id" :label="t('game.live.bet_id')" width="90" />
<el-table-column prop="user_id" :label="t('game.live.user_id')" width="90" />
<el-table-column prop="pick_numbers" :label="t('game.live.pick_numbers')">
<el-table :data="snapshot.bets" :height="tableHeight" class="bet-stream-table">
<el-table-column prop="username" :label="t('game.live.username')" width="120" align="center" header-align="center">
<template #default="scope">
{{ formatPicks(scope.row.pick_numbers) }}
<span class="bet-user">{{ String(scope.row.username || '-') }}</span>
</template>
</el-table-column>
<el-table-column prop="total_amount" :label="t('game.live.total_amount')" width="120" />
<el-table-column prop="streak_at_bet" :label="t('game.live.streak_at_bet')" width="90" />
<el-table-column prop="pick_numbers" :label="t('game.live.pick_numbers')" min-width="150" align="center" header-align="center">
<template #default="scope">
<div class="pick-tags">
<el-tag
v-for="num in parsePickNumbers(scope.row.pick_numbers)"
:key="`pick-${scope.row.id}-${String(num)}`"
size="small"
effect="plain"
class="pick-tags__item"
>
{{ num }}
</el-tag>
<span v-if="parsePickNumbers(scope.row.pick_numbers).length === 0">-</span>
</div>
</template>
</el-table-column>
<el-table-column prop="total_amount" :label="t('game.live.total_amount')" width="92" align="center" header-align="center" />
</el-table>
</el-card>
</el-col>
@@ -241,11 +254,11 @@ const snapshot = reactive<Snapshot>({
})
const calcLoading = ref(false)
const drawLoading = ref(false)
const pendingSwitchNumber = ref<number | null>(null)
const runtimeSwitchLoading = ref(false)
const voidDialogVisible = ref(false)
const voidReason = ref('')
const voidSubmitting = ref(false)
const manualNumber = ref<number | null>(1)
const calcResultNumber = ref<number | null>(null)
const calcEstimatedLoss = ref<string>('0.00')
@@ -261,6 +274,14 @@ const wsConnected = ref(false)
const wsUrl = ref('')
const wsTopics = ref<string[]>([])
const wsClient = ref<WebSocket | null>(null)
const isMobile = ref(false)
const candidateSort = ref<{ prop: string; order: 'ascending' | 'descending' | null }>({ prop: 'estimated_loss', order: 'ascending' })
function updateIsMobile(): void {
isMobile.value = window.matchMedia('(max-width: 768px)').matches
}
const tableHeight = computed(() => (isMobile.value ? 320 : 420))
async function reloadWsConfig(): Promise<void> {
wsLoading.value = true
@@ -365,6 +386,142 @@ function formatPicks(v: unknown): string {
return '-'
}
function parsePickNumbers(v: unknown): Array<number | string> {
if (Array.isArray(v)) {
return v
.map((item) => {
if (typeof item === 'number' || typeof item === 'string') {
return item
}
return null
})
.filter((item): item is number | string => item !== null)
}
if (typeof v === 'string') {
const s = v.trim()
if (s === '') {
return []
}
try {
const parsed = JSON.parse(s)
if (Array.isArray(parsed)) {
return parsed
.map((item) => {
if (typeof item === 'number' || typeof item === 'string') {
return item
}
return null
})
.filter((item): item is number | string => item !== null)
}
} catch {
return [s]
}
return [s]
}
return []
}
function numberValue(v: unknown): number | null {
if (typeof v === 'number' && Number.isFinite(v)) {
return v
}
if (typeof v === 'string' && v.trim() !== '') {
const n = Number(v)
if (!Number.isNaN(n) && Number.isFinite(n)) {
return n
}
}
return null
}
function estimatedLossSortValue(v: unknown): number {
if (typeof v === 'number' && Number.isFinite(v)) {
return v
}
if (typeof v === 'string' && v.trim() !== '') {
const n = Number(v)
if (!Number.isNaN(n) && Number.isFinite(n)) {
return n
}
}
return Number.MAX_SAFE_INTEGER
}
const candidateNumbersSorted = computed(() => {
const list = Array.isArray(snapshot.candidate_numbers) ? [...snapshot.candidate_numbers] : []
list.sort((a, b) => {
const sp = candidateSort.value.prop
const so = candidateSort.value.order
const dir = so === 'descending' ? -1 : 1
if (sp === 'number') {
const na = numberValue(a?.number)
const nb = numberValue(b?.number)
if (na !== null && nb !== null && na !== nb) {
return (na - nb) * dir
}
} else {
const ea = estimatedLossSortValue(a?.estimated_loss)
const eb = estimatedLossSortValue(b?.estimated_loss)
if (ea !== eb) {
return (ea - eb) * dir
}
}
const ea2 = estimatedLossSortValue(a?.estimated_loss)
const eb2 = estimatedLossSortValue(b?.estimated_loss)
if (ea2 !== eb2) {
return ea2 - eb2
}
const na2 = numberValue(a?.number)
const nb2 = numberValue(b?.number)
if (na2 !== null && nb2 !== null && na2 !== nb2) {
return na2 - nb2
}
return String(a?.number ?? '').localeCompare(String(b?.number ?? ''))
})
return list
})
function onCandidateSortChange(arg: { prop: string; order: 'ascending' | 'descending' | null }): void {
const prop = typeof arg?.prop === 'string' && arg.prop !== '' ? arg.prop : 'estimated_loss'
const order = arg?.order === 'descending' || arg?.order === 'ascending' ? arg.order : 'ascending'
candidateSort.value = { prop, order }
}
function isScheduledNumber(v: unknown): boolean {
const n = numberValue(v)
if (n === null) {
return false
}
return snapshot.pending_draw_number === n
}
function candidateRowClassName(arg: { row: anyObj }): string {
return isScheduledNumber(arg.row?.number) ? 'is-scheduled-row' : ''
}
async function onPickSwitchChange(val: boolean, rowNumber: unknown): Promise<void> {
const target = numberValue(rowNumber)
if (target === null) {
return
}
if (!val) {
return
}
if (snapshot.pending_draw_number === target) {
return
}
pendingSwitchNumber.value = target
try {
await onDraw(target)
} finally {
pendingSwitchNumber.value = null
}
}
const canVoidPeriod = computed(() => {
const r = snapshot.record
if (!r) {
@@ -451,8 +608,6 @@ async function loadSnapshot() {
const res = await createAxios({ url: '/admin/game.Live/snapshot', method: 'get', showCodeMessage: false })
if (res.code === 1 && res.data) {
mergeLiveSnapshot(res.data as anyObj)
const dmax = res.data.draw_number_max ?? 36
if (manualNumber.value === null || manualNumber.value < 1 || manualNumber.value > dmax) manualNumber.value = 1
}
} finally {
loading.value = false
@@ -528,7 +683,7 @@ async function onCalculate() {
method: 'post',
data: {
record_id: snapshot.record.id,
manual_number: manualNumber.value,
manual_number: numberValue(snapshot.pending_draw_number) ?? numberValue(candidateNumbersSorted.value[0]?.number) ?? 1,
},
showSuccessMessage: true,
})
@@ -543,7 +698,7 @@ async function onCalculate() {
}
}
async function onDraw() {
async function onDrawWithNumber(targetNumber: number) {
if (!snapshot.record) return
drawLoading.value = true
try {
@@ -552,7 +707,7 @@ async function onDraw() {
method: 'post',
data: {
record_id: snapshot.record.id,
manual_number: manualNumber.value,
manual_number: targetNumber,
},
showSuccessMessage: true,
})
@@ -562,6 +717,19 @@ async function onDraw() {
}
}
async function onDraw(targetNumber?: number) {
if (targetNumber !== undefined) {
return onDrawWithNumber(targetNumber)
}
const pending = numberValue(snapshot.pending_draw_number)
if (pending !== null) {
return onDrawWithNumber(pending)
}
const first = candidateNumbersSorted.value[0]
const fallback = numberValue(first?.number) ?? 1
return onDrawWithNumber(fallback)
}
const countdownParts = computed(() => {
const bet = snapshot.bet_remaining_seconds ?? 0
const draw = snapshot.remaining_seconds ?? 0
@@ -573,6 +741,8 @@ const countdownParts = computed(() => {
})
onMounted(async () => {
updateIsMobile()
window.addEventListener('resize', updateIsMobile)
clockTimer = window.setInterval(() => {
clockTick.value++
}, 1000)
@@ -582,6 +752,7 @@ onMounted(async () => {
})
onUnmounted(() => {
window.removeEventListener('resize', updateIsMobile)
disconnectWs()
if (clockTimer !== null) {
window.clearInterval(clockTimer)
@@ -624,6 +795,17 @@ onUnmounted(() => {
line-height: 1.45;
}
.live-top-toolbar__actions {
margin-left: auto;
display: inline-flex;
flex-wrap: wrap;
gap: 8px;
}
.live-top-toolbar__btn-void {
border-color: var(--el-color-danger-light-7);
}
.live-control-card {
:deep(.el-card__body) {
padding-top: 8px;
@@ -631,14 +813,10 @@ onUnmounted(() => {
}
.live-control-layout {
display: flex;
flex-wrap: wrap;
gap: 20px 24px;
align-items: flex-start;
display: block;
}
.live-control-main {
flex: 1 1 320px;
min-width: 0;
}
@@ -786,76 +964,43 @@ onUnmounted(() => {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.live-control-aside {
flex: 0 0 240px;
padding-left: 20px;
border-left: 1px solid var(--el-border-color-lighter);
.number-tag {
min-width: 44px;
justify-content: center;
font-variant-numeric: tabular-nums;
}
.pick-tags {
display: flex;
flex-direction: column;
gap: 12px;
&.is-locked {
opacity: 0.9;
filter: grayscale(0.08);
}
}
@media (max-width: 992px) {
.live-control-aside {
flex: 1 1 100%;
padding-left: 0;
border-left: none;
padding-top: 16px;
border-top: 1px solid var(--el-border-color-lighter);
}
}
.aside-title {
font-size: 14px;
font-weight: 600;
color: var(--el-text-color-regular);
}
.aside-void-btn {
width: 100%;
margin-bottom: 12px;
}
.aside-field {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
gap: 6px;
}
.aside-field__label {
font-size: 12px;
color: var(--el-text-color-secondary);
.pick-tags__item {
font-variant-numeric: tabular-nums;
}
.aside-field__input {
width: 100%;
.bet-user {
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.aside-btns {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
gap: 8px;
align-items: stretch;
.candidate-table :deep(.is-scheduled-row td) {
background: var(--el-color-primary-light-9);
}
.aside-btns .el-button {
flex: 1;
min-width: 0;
margin-left: 0;
padding-left: 8px;
padding-right: 8px;
}
@media (max-width: 768px) {
.live-tables-row .el-col {
margin-bottom: 12px;
}
.aside-btns .el-button :deep(span) {
white-space: normal;
line-height: 1.25;
text-align: center;
.pick-tags {
gap: 4px;
}
}
</style>

View File

@@ -5,10 +5,12 @@
<TableHeader
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.record.quick Search Fields') })"
></TableHeader>
<div class="record-top-actions">
<el-button type="warning" @click="openAbnormalDialog">{{ t('game.record.view_abnormal_rounds') }}</el-button>
</div>
>
<el-button v-blur class="table-header-operate btns-ml-12" type="warning" @click="openAbnormalDialog">
<Icon name="fa fa-exclamation-triangle" />
<span class="table-header-operate-text">{{ t('game.record.view_abnormal_rounds') }}</span>
</el-button>
</TableHeader>
<Table ref="tableRef"></Table>
@@ -162,7 +164,7 @@ const openAbnormalDialog = async () => {
showSuccessMessage: false,
}
)
const data = response?.data?.data ?? {}
const data = response?.data ?? {}
abnormalDialog.list = Array.isArray(data.list) ? data.list : []
} catch (error: any) {
const message = typeof error?.message === 'string' && error.message !== '' ? error.message : t('game.record.load_abnormal_failed')