|
@@ -15,9 +15,10 @@ class ThirdGameBalanceUsers extends Command
|
|
|
{--to= : 结束时间,例如 2026-07-14 23:59:59}
|
|
{--to= : 结束时间,例如 2026-07-14 23:59:59}
|
|
|
{--member_id=* : 只查询指定 member_id,可重复传入}
|
|
{--member_id=* : 只查询指定 member_id,可重复传入}
|
|
|
{--csv= : CSV 输出路径,默认保存到 storage/app}
|
|
{--csv= : CSV 输出路径,默认保存到 storage/app}
|
|
|
- {--show=100 : 控制台最多展示条数}';
|
|
|
|
|
|
|
+ {--show=100 : 控制台最多展示条数}
|
|
|
|
|
+ {--skip-provider : 仅导出本地流水,不请求三方当前余额}';
|
|
|
|
|
|
|
|
- protected $description = '导出有三方游戏转入、失败退回或转出流水的玩家(只读,不回收余额)';
|
|
|
|
|
|
|
+ protected $description = '导出有三方游戏流水的玩家,并查询三方当前余额(只读,不回收余额)';
|
|
|
|
|
|
|
|
public function handle(ThirdGameBalanceService $service): int
|
|
public function handle(ThirdGameBalanceService $service): int
|
|
|
{
|
|
{
|
|
@@ -80,6 +81,14 @@ class ThirdGameBalanceUsers extends Command
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$rows = $query->groupBy('member_id')->orderBy('member_id')->get();
|
|
$rows = $query->groupBy('member_id')->orderBy('member_id')->get();
|
|
|
|
|
+ $verifyProvider = !$this->option('skip-provider');
|
|
|
|
|
+ $progress = null;
|
|
|
|
|
+ if ($verifyProvider && $rows->isNotEmpty()) {
|
|
|
|
|
+ $this->info('正在逐个查询三方当前余额……');
|
|
|
|
|
+ $progress = $this->output->createProgressBar($rows->count());
|
|
|
|
|
+ $progress->start();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$report = [];
|
|
$report = [];
|
|
|
foreach ($rows as $row) {
|
|
foreach ($rows as $row) {
|
|
|
$transferInCount = (int) $row->transfer_in_count;
|
|
$transferInCount = (int) $row->transfer_in_count;
|
|
@@ -95,7 +104,7 @@ class ThirdGameBalanceUsers extends Command
|
|
|
if ($transferOutCount > 0) {
|
|
if ($transferOutCount > 0) {
|
|
|
$flowTypes[] = '转出';
|
|
$flowTypes[] = '转出';
|
|
|
}
|
|
}
|
|
|
- $report[] = [
|
|
|
|
|
|
|
+ $item = [
|
|
|
'member_id' => (string) $row->member_id,
|
|
'member_id' => (string) $row->member_id,
|
|
|
'player_id' => $service->playerId((string) $row->member_id),
|
|
'player_id' => $service->playerId((string) $row->member_id),
|
|
|
'flow_type' => implode('+', $flowTypes),
|
|
'flow_type' => implode('+', $flowTypes),
|
|
@@ -108,6 +117,30 @@ class ThirdGameBalanceUsers extends Command
|
|
|
'first_at' => (string) $row->first_at,
|
|
'first_at' => (string) $row->first_at,
|
|
|
'last_at' => (string) $row->last_at,
|
|
'last_at' => (string) $row->last_at,
|
|
|
];
|
|
];
|
|
|
|
|
+
|
|
|
|
|
+ if ($verifyProvider) {
|
|
|
|
|
+ $detail = $service->detail((string) $row->member_id, true);
|
|
|
|
|
+ $item['provider_status'] = ($detail['ok'] ?? false) ? '成功' : '失败';
|
|
|
|
|
+ $item['provider_total_balance'] = ($detail['ok'] ?? false)
|
|
|
|
|
+ ? $this->decimal($detail['total_game_balance'] ?? 0)
|
|
|
|
|
+ : '';
|
|
|
|
|
+ $item['provider_balances'] = ($detail['ok'] ?? false)
|
|
|
|
|
+ ? $this->providerBalances($detail['game_list'] ?? [])
|
|
|
|
|
+ : '';
|
|
|
|
|
+ $item['provider_message'] = ($detail['ok'] ?? false)
|
|
|
|
|
+ ? ''
|
|
|
|
|
+ : (string) ($detail['msg'] ?? '查询失败');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $report[] = $item;
|
|
|
|
|
+ if ($progress !== null) {
|
|
|
|
|
+ $progress->advance();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($progress !== null) {
|
|
|
|
|
+ $progress->finish();
|
|
|
|
|
+ $this->newLine(2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$csvPath = (string) $this->option('csv');
|
|
$csvPath = (string) $this->option('csv');
|
|
@@ -125,7 +158,9 @@ class ThirdGameBalanceUsers extends Command
|
|
|
|
|
|
|
|
$this->info('共找到 ' . count($report) . ' 个玩家');
|
|
$this->info('共找到 ' . count($report) . ' 个玩家');
|
|
|
$this->info('CSV:' . $csvPath);
|
|
$this->info('CSV:' . $csvPath);
|
|
|
- $this->comment('本命令只读:未请求三方接口,未修改钱包或流水。');
|
|
|
|
|
|
|
+ $this->comment($verifyProvider
|
|
|
|
|
+ ? '本命令只读:已请求三方当前余额,未回收余额,未修改钱包或流水。'
|
|
|
|
|
+ : '本命令只读:未请求三方接口,未修改钱包或流水。');
|
|
|
return self::SUCCESS;
|
|
return self::SUCCESS;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -161,7 +196,8 @@ class ThirdGameBalanceUsers extends Command
|
|
|
$headers = $rows !== [] ? array_keys($rows[0]) : [
|
|
$headers = $rows !== [] ? array_keys($rows[0]) : [
|
|
|
'member_id', 'player_id', 'flow_type', 'transfer_in_count', 'transfer_in_total',
|
|
'member_id', 'player_id', 'flow_type', 'transfer_in_count', 'transfer_in_total',
|
|
|
'refund_count', 'refund_total', 'transfer_out_count', 'transfer_out_total',
|
|
'refund_count', 'refund_total', 'transfer_out_count', 'transfer_out_total',
|
|
|
- 'first_at', 'last_at',
|
|
|
|
|
|
|
+ 'first_at', 'last_at', 'provider_status', 'provider_total_balance',
|
|
|
|
|
+ 'provider_balances', 'provider_message',
|
|
|
];
|
|
];
|
|
|
fputcsv($handle, $headers);
|
|
fputcsv($handle, $headers);
|
|
|
foreach ($rows as $row) {
|
|
foreach ($rows as $row) {
|
|
@@ -177,4 +213,17 @@ class ThirdGameBalanceUsers extends Command
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private function providerBalances(array $balances): string
|
|
|
|
|
+ {
|
|
|
|
|
+ $result = [];
|
|
|
|
|
+ foreach ($balances as $balance) {
|
|
|
|
|
+ if (!is_array($balance) || !isset($balance['platform']) || !is_numeric($balance['balance'] ?? null)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $result[(string) $balance['platform']] = $this->decimal($balance['balance']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (string) json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|