get(); foreach ($GetLodeLog as $key => $value) { try { $res = SendCode::get_code($value->phone); // var_dump($res); if ($res['status'] == 1 && $res['scanCode'] != null) { $value->status = 1; $value->code = $res['scanCode']; $value->save(); } } catch (\Exception $e) { // 记录错误日志,避免任务中断 Log::error("Error processing phone {$value->phone}: " . $e->getMessage()); } } }); } }