errno){ self::addLog($title, $content); }else{ self::addLog($title, $content, 0, $result->errmsg); } } catch(Exception $e){ Log::error('ServerChan消息推送异常:'.$e); } }else{ Log::error('消息推送失败:未启用或未正确配置ServerChan'); } } /** * 添加serverChan推送日志 * * @param string $title 标题 * @param string $content 内容 * @param int $status 投递状态 * @param string $error 投递失败时记录的异常信息 * * @return int */ private static function addLog($title, $content, $status = 1, $error = '') { $log = new EmailLog(); $log->type = 2; $log->address = 'admin'; $log->title = $title; $log->content = $content; $log->status = $status; $log->error = $error; return $log->save(); } }