fix:glados签到脚本

This commit is contained in:
Xiang
2026-01-23 09:58:46 +08:00
parent 12728d5c84
commit 217dc6879d
3 changed files with 24 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ public class URLConstants {
/**
* glados 主域名
*/
public static final String GLADOS_URL_PREFIX = "https://www.glados.cloud";
public static final String GLADOS_URL_PREFIX = "https://glados.cloud";
/**
* 签到

View File

@@ -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.basic.common.resp.Result;
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.RestController;
@@ -19,7 +19,7 @@ public class GLaDOSController {
private final GLaDOSService glaDOSService;
@PostMapping("/checkIn")
@GetMapping("/checkIn")
public Result<Void> checkIn() {
glaDOSService.checkInV2();
return Result.success();

View File

@@ -126,6 +126,27 @@ public class GLaDOSServiceImpl implements GLaDOSService{
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());
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(0).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();