| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace App\Module\Mex\Commands;
- use App\Module\Mex\Tests\MultiCurrencyTest;
- use Illuminate\Console\Command;
- /**
- * 测试Mex模块多币种适配功能
- */
- class TestMultiCurrencyCommand extends Command
- {
- /**
- * 命令签名
- *
- * @var string
- */
- protected $signature = 'mex:test-multi-currency';
- /**
- * 命令描述
- *
- * @var string
- */
- protected $description = '测试Mex模块多币种适配功能';
- /**
- * 执行命令
- *
- * @return int
- */
- public function handle(): int
- {
- $this->info('开始测试Mex模块多币种适配功能...');
- $this->newLine();
- try {
- // 运行所有测试
- $results = MultiCurrencyTest::runAllTests();
- // 显示FundLogic映射测试结果
- $this->info('=== FundLogic币种映射测试 ===');
- $fundLogicResults = $results['fund_logic_mapping'];
- $this->line("默认币种: {$fundLogicResults['default_currency']} ({$fundLogicResults['default_currency_name']})");
- $this->line("钻石币种映射 - 可用账户: {$fundLogicResults['diamond_mapping']['available']}, 冻结账户: {$fundLogicResults['diamond_mapping']['frozen']}");
- $this->line("金币币种映射 - 可用账户: {$fundLogicResults['gold_mapping']['available']}, 冻结账户: {$fundLogicResults['gold_mapping']['frozen']}");
- $this->line("支持的币种: " . implode(', ', $fundLogicResults['supported_currencies']));
- $this->line("币种支持检查 - 钻石: " . ($fundLogicResults['currency_support']['diamond'] ? '是' : '否') . ", 金币: " . ($fundLogicResults['currency_support']['gold'] ? '是' : '否'));
- $this->newLine();
- // 显示订单创建测试结果
- $this->info('=== 订单创建币种支持测试 ===');
- $orderResults = $results['order_creation'];
-
- $this->line("钻石币种卖出订单:");
- $this->line(" 成功: " . ($orderResults['diamond_sell_order']['success'] ? '是' : '否'));
- $this->line(" 消息: {$orderResults['diamond_sell_order']['message']}");
- if ($orderResults['diamond_sell_order']['order_id']) {
- $this->line(" 订单ID: {$orderResults['diamond_sell_order']['order_id']}");
- }
-
- $this->line("金币币种买入订单:");
- $this->line(" 成功: " . ($orderResults['gold_buy_order']['success'] ? '是' : '否'));
- $this->line(" 消息: {$orderResults['gold_buy_order']['message']}");
- if ($orderResults['gold_buy_order']['order_id']) {
- $this->line(" 订单ID: {$orderResults['gold_buy_order']['order_id']}");
- }
-
- $this->line("默认币种订单:");
- $this->line(" 成功: " . ($orderResults['default_currency_order']['success'] ? '是' : '否'));
- $this->line(" 消息: {$orderResults['default_currency_order']['message']}");
- if ($orderResults['default_currency_order']['order_id']) {
- $this->line(" 订单ID: {$orderResults['default_currency_order']['order_id']}");
- }
- $this->newLine();
- // 显示账户余额测试结果
- $this->info('=== 账户余额币种支持测试 ===');
- $balanceResults = $results['account_balance'];
- $this->line("钻石币种仓库余额: {$balanceResults['diamond_warehouse_balance']}");
- $this->line("金币币种仓库余额: {$balanceResults['gold_warehouse_balance']}");
- $this->line("默认币种仓库余额: {$balanceResults['default_warehouse_balance']}");
- $this->newLine();
- $this->info("测试完成时间: {$results['test_time']}");
- $this->info('✅ Mex模块多币种适配功能测试完成');
- return Command::SUCCESS;
- } catch (\Exception $e) {
- $this->error('❌ 测试执行失败: ' . $e->getMessage());
- $this->error('错误堆栈: ' . $e->getTraceAsString());
-
- return Command::FAILURE;
- }
- }
- }
|