Commit 7f5f9e9f4fdf633d5723a9ff773c9349cf0f047d

Authored by 王明元
1 parent c1c8fc18

2023年11月9日12:19:00 修复无法登录

src/main/java/cn/fw/freya/controller/CrawlController.java
... ... @@ -35,7 +35,7 @@ public class CrawlController {
35 35 * @param type 账户类型(1:快手, 2:抖音, 3:懂车帝, 4:Bilibili)
36 36 * @return 登录二维码
37 37 */
38   - @GetMapping("/preLogin")
  38 + @GetMapping("/getLoginQRCode")
39 39 public ResponseMessage<String> getLoginQRCode(@NotBlank(message = "登陆账号不能为空") String accountNo,
40 40 @NotNull(message = "平台类型不能为空") Integer type) {
41 41 return success(crawlBizService.getLoginQRCode(accountNo, type));
... ...
src/main/java/cn/fw/freya/controller/LoginController.java 0 → 100644
  1 +package cn.fw.freya.controller;
  2 +
  3 +import cn.fw.freya.common.ResponseMessage;
  4 +import cn.fw.freya.service.CrawlBizService;
  5 +import lombok.RequiredArgsConstructor;
  6 +import org.springframework.validation.annotation.Validated;
  7 +import org.springframework.web.bind.annotation.*;
  8 +
  9 +import javax.validation.constraints.NotBlank;
  10 +import javax.validation.constraints.NotNull;
  11 +
  12 +/**
  13 + * @author kurisu
  14 + */
  15 +@RestController
  16 +@RequiredArgsConstructor
  17 +@Validated
  18 +@CrossOrigin
  19 +@RequestMapping("/account")
  20 +public class LoginController {
  21 +
  22 + private final CrawlBizService crawlBizService;
  23 +
  24 + /**
  25 + * 获取登录二维码
  26 + *
  27 + * @param account 账户号
  28 + * @param type 账户类型(1:快手, 2:抖音, 3:懂车帝, 4:Bilibili)
  29 + * @return 登录二维码
  30 + */
  31 + @GetMapping("/getCode")
  32 + public ResponseMessage<String> getCode(@NotBlank(message = "登陆账号不能为空") String account,
  33 + @NotNull(message = "平台类型不能为空") Integer type) {
  34 + return ResponseMessage.success(crawlBizService.getLoginQRCode(account, type));
  35 + }
  36 +
  37 + /**
  38 + * 登录, 保存用户cookies
  39 + *
  40 + * @param account 账户号
  41 + * @param type 账户类型(1:快手, 2:抖音, 3:懂车帝, 4:Bilibili)
  42 + * @return 是否成功
  43 + */
  44 + @PostMapping("/login")
  45 + public ResponseMessage<Boolean> login(@NotBlank(message = "登陆账号不能为空") String account,
  46 + @NotNull(message = "平台类型不能为空") Integer type) {
  47 + return ResponseMessage.success(crawlBizService.doLogin(account, type));
  48 + }
  49 +}
... ...