decode($body); self::log($data, 'BoxSyncServer', self::$LOG_MAJOR); return $this->response(); } protected function response() { $time = time(); $hex_time = dechex($time); $body = [ $hex_time ]; $body = str_split(implode('', $body), 2); return $body; } /** * 解析装载的数据 * @param $body * @return array * User: Mead */ private function decode($body) { $i = 0; $box_no = self::stitching($body, $i, 5); $i += 5; // 设备时间 $time = self::stitching($body, $i, 4); // 处理值 $box_no = $this->decodeBoxNo($box_no); $time = $this->decodeTime($time); return [ 'box_no' => $box_no, 'time' => $time, ]; } }