Advertisement
XiaYuanOwO

Untitled

Dec 24th, 2024
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public function handle(ServerRequestInterface $request): ResponseInterface
  2. {
  3. $actor = RequestUtil::getActor($request); // 当前登录用户
  4. if ($actor->isGuest()) {
  5. return new JsonResponse(['code' => 1, 'msg' => '请先登录']);
  6. }
  7. $uid = $actor->id;
  8. if (!$uid) {
  9. return new JsonResponse(['code' => 1, 'msg' => '用户id不能为空']);
  10. }
  11.  
  12. $data_log = $this->find_uid($uid);
  13. if (!$data_log) {
  14. return new JsonResponse(['code' => 0, 'msg' => '用户未激活', 'status' => 0]);
  15. }
  16. $post_url = 'http://downloadserver.ovonya.fun/cgi-bin/download';
  17. $post_data = [
  18. 'uid' => $uid,
  19. ];
  20. $result = Comm::getJsonUrl($post_url, $post_data);
  21. $body = json_decode($result, true);
  22.  
  23. $status_code = $body['status'] ?? 0;
  24. if ($status_code != 1000) {
  25. $json_msg = sprintf('%s', $body['status']['msg']);
  26. return new JsonResponse(['code' => 1, 'msg' => $json_msg]);
  27. }
  28. return new RedirectResponse($body['data']);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement