handleService = container()->get(SubscribeHandleService::class); redis()->subscribe($this->chans, [$this, 'subscribe']); } /** * 订阅处理逻辑 * * @param $redis * @param string $chan * @param string $message */ public function subscribe($redis, string $chan, string $message) { //echo PHP_EOL . "chan : $chan , msg : $message"; $data = json_decode($message, true); if (!isset(SubscribeHandleService::EVENTS[$data['event']])) return; $this->handleService->{SubscribeHandleService::EVENTS[$data['event']]}($data); } public function isEnable($server): bool { return true; } }