get(self::CACHE_KEY . $box_no . ':' . $cmd); if ($data != null) { $result = self::getCache($data); $redis->del(self::CACHE_KEY . $box_no . ':' . $cmd); break; } //补发 if (in_array($i, [10, 20])) { Gateway::sendToUid($box_no, hex2bin($responseBody)); } } return $result; } /** * 获取设备状态 * @param $box_no * @return int * Author: Mead */ public static function getBoxStatus($box_no, $is_response = true) { $body = [ '5a' ]; return self::send(self::STATUS_CMD, $box_no, $body, $is_response); } /** * 获取定位 * @param $box_no * @return int * Author: Mead */ public static function getLocation($box_no, $is_response = true) { $body = [ 'a5' ]; return self::send(self::LOCATION_CMD, $box_no, $body, $is_response); } public static function getCache($val) { $array = explode('||', $val); if (count($array) !== 2) return false; list($type, $data) = $array; switch ($type) { case 'string': return $data; break; case 'array': return json_decode($data, true); } return false; } }