decode($body); self::log($data, 'RemoteCmdServer', self::$LOG_MAJOR); if ($data['result'] === '02') { // //运动中 self::log($data['msgId']['no'], 'REMOTECMD_LOSE', self::$LOG_COMMON); BikeControl::outAreaLoseElectric($data['msgId']['no']); sleep(1); switch ($data['msgId']['cmd']) { case BikeControl::CONTROL_REMOTE_CLOSE_LOCK: //关锁处理 BikeControl::closeLock($data['msgId']['no']); break; case BikeControl::CONTROL_REMOTE_TEMPORARY_CLOSE_LOCK: //临时锁车处理 BikeControl::temporaryCloseLock($data['msgId']['no']); break; } } return $this->response(self::RESULT_SUCCESS); } // 登录成功 const RESULT_SUCCESS = '01'; // 登录失败 const RESULT_FAIL = '00'; /** * 登录响应 * @param $login_type * @return array * User: Mead */ public function response($result_type = '01') { $body = [ $result_type, ]; return $body; } /** * 解析装载的登录数据 * @param $body * @return array * User: Mead */ private function decode($body) { $i = 0; $result = self::stitching($body, $i, 1); $i += 1; //标识符 $i += 2; $msgId = self::stitching($body, $i); $msgId = $this->decodeMsgId($msgId); return [ 'result' => $result, 'msgId' => $msgId ]; } }