warn('开始计算集成模块收益。'); $this->warn('当前时间: ' . now()); Module::chunk(100, function ($modules) { foreach ($modules as $module) { $this->warn('模块: ' . $module->name); $years = $module->calculate(); foreach ($years as $year => $months) { // 排序 months 从小到大 ksort($months); $total = 0; $total_should = 0; foreach ($months as $month => $m) { $total += $m['balance']; $total_should += $m['should_balance']; $this->info("{$module->name} {$year}年 {$month}月 实收: {$total}元 应得: {$total_should} 元"); } } } }); $this->warn('计算模块收益完成。'); $this->warn('完成时间: ' . now()); return 1; } }