decode($body); self::log($data, 'NewBikeReportingServer', self::$LOG_MAJOR); return $this->response(self::RESPONSE_SUCCESS, VideoMap::VIDEO_FIND_BIKE); } const RESPONSE_SUCCESS = '00'; const RESPONSE_FAI = '01'; /** * 响应 * @param string $response_status * @param bool $video_cmd * @return array * User: Mead */ protected function response($response_status = self::RESPONSE_SUCCESS, $video_cmd = false) { $body = [ $response_status, '00' . $video_cmd ]; $body = str_split(implode('', $body), 2); return $body; } /** * 解析装载的数据 * @param $body * @return array * User: Mead */ private function decode($body) { $i = 0; // 时间 $time = self::stitching($body, $i, 4); $i += 4; // 执行结果 $result = self::stitching($body, $i, 1); $i += 1; // 提示音指令 $voice_cmd = self::stitching($body, $i, 2); $i += 2; //MsgId $msg_id = self::stitching($body, $i); $time = $this->decodeTime($time); return [ 'time' => $time, 'result' => $result, 'voice_cmd' => $voice_cmd, 'msg_id' => $msg_id, ]; } }