createApp(); $server = $app->getServer(); $message = $server->getRequestMessage(); if (empty($message)){ return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "回调数据为空"], JSON_UNESCAPED_UNICODE)))); } dump($message); return $server->serve(); }catch (\Exception $e) { throw new BusinessException($e->getMessage()); return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => $e->getMessage()], JSON_UNESCAPED_UNICODE)))); } } // 医生端微信支付回调 public function doctorWxPayCallBack(): ResponseInterface { $request_params = $this->request->all(); dump($request_params); try { // 处理支付结果事件 $WechatPay = new WechatPay(2); $app = $WechatPay->createApp(); $server = $app->getServer(); $message = $server->getDecryptedMessage()->toArray(); dump($message); return $server->serve(); }catch (\Exception $e) { throw new BusinessException($e->getMessage()); // return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => $e->getMessage()], JSON_UNESCAPED_UNICODE)))); } } // im回调 public function imCallBack(){ $request_params = $this->request->all(); Log::getInstance()->info(json_encode($request_params,JSON_UNESCAPED_UNICODE)); } }