Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function handle(ServerRequestInterface $request): ResponseInterface
- {
- $actor = RequestUtil::getActor($request); // 当前登录用户
- if ($actor->isGuest()) {
- return new JsonResponse(['code' => 1, 'msg' => '请先登录']);
- }
- $uid = $actor->id;
- if (!$uid) {
- return new JsonResponse(['code' => 1, 'msg' => '用户id不能为空']);
- }
- $data_log = $this->find_uid($uid);
- if (!$data_log) {
- return new JsonResponse(['code' => 0, 'msg' => '用户未激活', 'status' => 0]);
- }
- $post_url = 'http://downloadserver.ovonya.fun/cgi-bin/download';
- $post_data = [
- 'uid' => $uid,
- ];
- $result = Comm::getJsonUrl($post_url, $post_data);
- $body = json_decode($result, true);
- $status_code = $body['status'] ?? 0;
- if ($status_code != 1000) {
- $json_msg = sprintf('%s', $body['status']['msg']);
- return new JsonResponse(['code' => 1, 'msg' => $json_msg]);
- }
- return new RedirectResponse($body['data']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement