findByMd5($md5); if ($file) { $service = new StorageService(); $location = $service->getFileUrl($file->path); $this->response->redirect($location, true); } else { $this->response->setStatusCode(404); return $this->response; } } /** * @Get("/qrcode", name="home.qrcode") */ public function qrcodeAction() { $text = $this->request->getQuery('text', 'string'); $level = $this->request->getQuery('level', 'int', 0); $size = $this->request->getQuery('size', 'int', 5); $url = urldecode($text); QRcode::png($url, false, $level, $size); $this->response->send(); exit; } /** * @Post("/token/refresh", name="home.refresh_token") */ public function refreshTokenAction() { $this->checkCsrfToken(); $service = new CsrfTokenService(); $token = $service->getToken(); return $this->jsonSuccess(['token' => $token]); } /** * @Post("/alipay/notify", name="home.alipay_notify") */ public function alipayNotifyAction() { $service = new AlipayService(); $response = $service->notify(); if (!$response) exit; $response->send(); exit; } /** * @Post("/wxpay/notify", name="home.wxpay_notify") */ public function wxpayNotifyAction() { $service = new WxpayService(); $response = $service->notify(); if (!$response) exit; $response->send(); exit; } /** * @Post("/live/notify", name="home.live_notify") */ public function liveNotifyAction() { $service = new LiveNotifyService(); if ($service->handle()) { return $this->jsonSuccess(); } else { $this->response->setStatusCode(403); } } }