decode($body); $this->cacheLog($data['msg_id'], $data['setting']); self::log($data, 'BoxSelectCmdServer', self::$LOG_MAJOR); return false; } /** * 解析装载的数据 * @param $body * @return array * User: Mead */ private function decode($body) { $arr = explode(BikeControl::SPLIT_TAG, implode('', $body)); $setting = $_msg = $msg = ''; if (count($arr) === 2) { list($setting, $_msg) = explode(BikeControl::SPLIT_TAG, implode('', $body)); } else { $setting = $arr[0]; } // $msg = $this->decodeMsgId($_msg); $setting = $this->decodeSetting($setting); foreach ($setting as $key => $item) { switch ($key) { case SettingCmdMap::SETTING_VIN: $setting[$key] = $this->byVoltageGetElectric($item / 1000); break; case SettingCmdMap::SETTING_ACCFILT: case SettingCmdMap::SETTING_FDZT: case SettingCmdMap::SETTING_OILSTATE: if ($item === 'FAIL') { $setting[$key] = "获取失败"; } else { $setting[$key] = $item ? "打开" : "关闭"; } break; } } return [ 'setting' => $setting, 'msg_id' => $_msg, ]; } }