db->insert('warning_logs')->cols([ 'bike_no' => $bike_no, 'box_no' => $box_no, 'body' => serialize($body), 'source_body' => implode(' ', $source_body), 'type' => WarningLogMap::TYPE_BATTERY_LOW, 'error_grade' => WarningLogMap::ERROR_GRADE_MAJOR, 'source' => $source, 'created_at' => date('Y-m-d H:i:s') ])->query(); } /** * 车辆离线 * @param $bike_no * @param $box_no * @param $body * @param $source_body * @param $source * User: Mead */ public function warningLogBikeOffLine($bike_no, $box_no, $source) { $body = []; $source_body = []; $this->db->insert('warning_logs')->cols([ 'bike_no' => $bike_no, 'box_no' => $box_no, 'body' => serialize($body), 'source_body' => implode(' ', $source_body), 'type' => WarningLogMap::TYPE_BIKE_OFF_LINE, 'error_grade' => WarningLogMap::ERROR_GRADE_CRITICAL, 'source' => $source, 'created_at' => date('Y-m-d H:i:s') ])->query(); } public static function warningLogBikeOffLineStatic($bike_no, $box_no, $source) { $body = []; $source_body = []; self::$db->insert('warning_logs')->cols([ 'bike_no' => $bike_no, 'box_no' => $box_no, 'body' => serialize($body), 'source_body' => implode(' ', $source_body), 'type' => WarningLogMap::TYPE_BIKE_OFF_LINE, 'error_grade' => WarningLogMap::ERROR_GRADE_CRITICAL, 'source' => $source, 'created_at' => date('Y-m-d H:i:s') ])->query(); } /** * 警告数据包 * @param $bike_no * @param $box_no * @param $body * @param $source_body * @param $type * @param $error_grade * User: Mead */ public function warningLog($bike_no, $box_no, $body, $source_body, $type, $error_grade) { $this->db->insert('warning_logs')->cols([ 'bike_no' => $bike_no, 'box_no' => $box_no, 'body' => serialize($body), 'source_body' => implode(' ', $source_body), 'type' => $type, 'error_grade' => $error_grade, 'source' => 'warning', 'created_at' => date('Y-m-d H:i:s') ])->query(); } public function warningFF($bike_no, $box_no, $body, $source_body) { $this->db->insert('warning_logs')->cols([ 'bike_no' => $bike_no, 'box_no' => $box_no, 'body' => serialize($body), 'source_body' => implode(' ', $source_body), 'type' => WarningLogMap::TYPE_WARNING_BIKE_OPEN, 'error_grade' => WarningLogMap::ERROR_GRADE_MAJOR, 'source' => 'warning', 'created_at' => date('Y-m-d H:i:s') ])->query(); } }