fix:glados签到脚本
This commit is contained in:
@@ -5,7 +5,7 @@ public class URLConstants {
|
|||||||
/**
|
/**
|
||||||
* glados 主域名
|
* glados 主域名
|
||||||
*/
|
*/
|
||||||
public static final String GLADOS_URL_PREFIX = "https://www.glados.cloud";
|
public static final String GLADOS_URL_PREFIX = "https://glados.cloud";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签到
|
* 签到
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.xiang.xservice.application.script.glados.controller;
|
|||||||
import com.xiang.xservice.application.script.glados.service.GLaDOSService;
|
import com.xiang.xservice.application.script.glados.service.GLaDOSService;
|
||||||
import com.xiang.xservice.basic.common.resp.Result;
|
import com.xiang.xservice.basic.common.resp.Result;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ public class GLaDOSController {
|
|||||||
|
|
||||||
private final GLaDOSService glaDOSService;
|
private final GLaDOSService glaDOSService;
|
||||||
|
|
||||||
@PostMapping("/checkIn")
|
@GetMapping("/checkIn")
|
||||||
public Result<Void> checkIn() {
|
public Result<Void> checkIn() {
|
||||||
glaDOSService.checkInV2();
|
glaDOSService.checkInV2();
|
||||||
return Result.success();
|
return Result.success();
|
||||||
|
|||||||
@@ -126,6 +126,27 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
|||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gLaDOSResponse.getMessage().contains("Repeats")) {
|
||||||
|
if (!CollectionUtils.isEmpty(gLaDOSResponse.getList())) {
|
||||||
|
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "当前已签到。结果:" + gLaDOSResponse.getList().get(0));
|
||||||
|
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
|
||||||
|
gladosMapper.insertScriptRunLog(build);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-2 == gLaDOSResponse.getCode()) {
|
||||||
|
log.warn("签到失败,用户:{}, cookie过期:{}", user.getEmail(), gLaDOSResponse.getMessage());
|
||||||
|
String message = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到消息: " + gLaDOSResponse.getMessage() + "手动请求:http://general.xiangtech.xyz:30026/system/glados/checkIn";
|
||||||
|
try {
|
||||||
|
dingTalkService.sendScriptMsg(message);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("发送钉钉消息失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 请求异常
|
// 请求异常
|
||||||
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "请求异常,响应结果:" + gLaDOSResponse.getMessage());
|
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "请求异常,响应结果:" + gLaDOSResponse.getMessage());
|
||||||
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(0).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
|
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(0).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
|
||||||
|
|||||||
Reference in New Issue
Block a user