false, 'data' => $data, 'errorcode' => $errorcode ]; } else { $sendMessage = [ 'state' => true, 'data' => $data, 'errorcode' => $errorcode ]; } return json_encode($sendMessage, JSON_UNESCAPED_UNICODE); } // 暂存一下每个webstock链接保存的位置 public function webstockConnectInfo($fromId, $redisKey) { // webstock连接和存储关系 $writeCache = Factory::cache('default')->hset(self::$webstockAndKey, $fromId, $redisKey); } // 销毁连接 public function closeWebstock($fromId) { $data = Factory::cache('default')->hget(self::$webstockAndKey, $fromId); if(empty($data)){ return false; } $data = explode('|', $data); $result = Factory::cache('default')->hdel($data[0], $data[1]); $result = Factory::cache('default')->hdel(self::$webstockAndKey, $fromId); return $result; } }