response->setStatusCode(404); return $this->response; } $storageService = new StorageService(); $location = $storageService->getCiImageUrl($image->path); $this->response->redirect($location); } /** * @Get("/qrcode/img", name="web.qrcode_img") */ public function qrcodeImageAction() { $text = $this->request->getQuery('text'); $level = $this->request->getQuery('level', 'int', 0); $size = $this->request->getQuery('size', 'int', 3); $url = urldecode($text); PHPQRcode::png($url, false, $level, $size); $this->response->send(); exit; } /** * @Post("/sms/code", name="web.sms_code") */ public function smsCodeAction() { $phone = $this->request->getPost('phone', 'trim'); $service = new VerifyService(); $success = $service->sendSmsCode($phone); if ($success) { return $this->jsonSuccess(); } else { return $this->jsonError([ 'code' => 'verify.send_sms_failed', ]); } } /** * @Post("/email/code", name="web.email_code") */ public function emailCodeAction() { $email = $this->request->getPost('email', 'trim'); $service = new VerifyService(); $success = $service->sendEmailCode($email); if ($success) { return $this->jsonSuccess(); } else { return $this->jsonError([ 'code' => 'verify.send_email_failed', ]); } } }