set(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no, serialize($data)); //删除未骑行状态 if ($is_put_status) { self::$redis->zrem(self::REDIS_BIKE_LOCATION_TAG, $bike_no); } if ($role == self::ROLE_WORKER) { self::$redis->hset(self::REDIS_RIDE_BIKE_WORKER_ORDERS_TAG, $bike_no, Admin::user()->id); } } /** * 车辆处于等待骑行状态 * @param $bike_no * User: Mead */ public function toBikeWaitRideStatus($bike_no, $lng = 0, $lat = 0, $is_put_status = 1) { // self::$redis->hdel(self::REDIS_RIDE_BIKE_ORDERS_TAG, $bike_no); self::$redis->expire(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no, self::CLOSE_BIKE_TTL); if ($is_put_status) { self::$redis->geoadd(self::REDIS_BIKE_LOCATION_TAG, $lng, $lat, $bike_no); } // 不存在就忽略 self::$redis->hdel(self::REDIS_RIDE_BIKE_WORKER_ORDERS_TAG, $bike_no); } /** * 车辆上线 * @param $bike_no * @param int $lat * @param int $lng * User: Mead */ public function toBikeOnLineStatus($bike_no, $lng = 0, $lat = 0) { self::$redis->del([self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no]); self::$redis->geoadd(self::REDIS_BIKE_LOCATION_TAG, $lng, $lat, $bike_no); } /** * 车辆离线 * @param $bike_no * User: Mead */ public function toBikeOffLineStatus($bike_no) { //删除未骑行状态 self::$redis->zrem(self::REDIS_BIKE_LOCATION_TAG, $bike_no); } /** * 获取订单信息 * @param $bike_no * @return mixed * User: Mead */ public function getRideBikeOrderInfo($bike_no) { $order = self::$redis->get(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no); if (!$order) return false; return unserialize($order); } /** * 改变车为订单为开¬车(租车) * @param $bike_no * User: Mead */ public function toBikeRentRideStatus($bike_no) { $data = $this->getRideBikeOrderInfo($bike_no); $data['is_close_bike'] = 0; self::$redis->set(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no, serialize($data)); } /** * 改变车为订单为停车(租车) * @param $bike_no * User: Mead */ public function toBikeRentWaitRideStatus($bike_no) { $data = $this->getRideBikeOrderInfo($bike_no); $data['is_close_bike'] = 1; self::$redis->set(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no, serialize($data)); } /** * 对超出运营范围的车辆加电 * @param $bike_no * Author: Mead */ public function toBikeGetElectric($bike_no) { $data = $this->getRideBikeOrderInfo($bike_no); $data['is_out_area_lost_electric'] = 0; self::$redis->set(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no, serialize($data)); } /** * 对低电量车不限制电量 * @param $bike_no * Author: Mead */ public function toBikeNoElectric($bike_no) { $data = $this->getRideBikeOrderInfo($bike_no); $data['is_low_electric_close_bike'] = 0; self::$redis->set(self::REDIS_RIDE_BIKE_ORDERS_TAG . $bike_no, serialize($data)); } }