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); $this->handleService->handle($data); } }