
3 changed files with 44 additions and 6 deletions
@ -0,0 +1,36 @@ |
|||||
|
package com.yxt.supervise.portal.robot; |
||||
|
|
||||
|
import cn.hutool.http.HttpRequest; |
||||
|
import cn.hutool.http.HttpResponse; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.IOException; |
||||
|
|
||||
|
@Controller("com.yxt.supervise.portal.robot.PadbotHomeController") |
||||
|
@RequestMapping("/robot/padbot") |
||||
|
public class PadbotHomeController { |
||||
|
|
||||
|
@RequestMapping("/homeindex") |
||||
|
public void homeIndex(HttpServletRequest request, HttpServletResponse response){ |
||||
|
// {"id":1234569,"data":{"phoneNumber":"13111515028","password":"eXh0MTIzNDU2","verificationCode":"","countryAreaCode":86},"extra":{"appKey":"c4ca4238a0b923820dcc509a6f75849b","appVersion":"1.0.0","device":"","lang":"zh-cn","system":"windows","systemVersion":"","time":1685324808000,"sign":"c196069a226e5f22ce5a586ecb2827e0"}}
|
||||
|
|
||||
|
|
||||
|
HttpResponse execute = HttpRequest.options("https://api.cloud.padbot.com/auth/login").execute(); |
||||
|
|
||||
|
String json = "{\"id\":1234569,\"data\":{\"phoneNumber\":\"13111515028\",\"password\":\"eXh0MTIzNDU2\",\"verificationCode\":\"\",\"countryAreaCode\":86},\"extra\":{\"appKey\":\"c4ca4238a0b923820dcc509a6f75849b\",\"appVersion\":\"1.0.0\",\"device\":\"\",\"lang\":\"zh-cn\",\"system\":\"windows\",\"systemVersion\":\"\",\"time\":1685324808000,\"sign\":\"c196069a226e5f22ce5a586ecb2827e0\"}}"; |
||||
|
HttpResponse resp = HttpRequest.post("https://api.cloud.padbot.com/auth/login") |
||||
|
.body(json) |
||||
|
.execute(); |
||||
|
// https://api.cloud.padbot.com/auth/login
|
||||
|
String body = resp.body(); |
||||
|
String cookieStr = resp.getCookieStr(); |
||||
|
try { |
||||
|
response.sendRedirect("https://cloud.padbot.com/login?redirect=/view-selection"); |
||||
|
} catch (IOException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue