This commit is contained in:
parent
868fa5df6d
commit
3aa936d7e3
@ -113,75 +113,80 @@ public class RyTask {
|
||||
throw new Exception("没有参与人员");
|
||||
}
|
||||
|
||||
Perform perform1 = new Perform();
|
||||
String eValue = null;
|
||||
if (perform.getNum() == null || perform.getNum().isEmpty()) {
|
||||
long time = System.currentTimeMillis();
|
||||
String data = "/notice/v1.0/notice-" + perform.getNotice() + "?fieldSet=noticeV1&appId=be4d79eb8fc7bd008ee82c8ec4ff6fd4&language=zh-cn&os=WEB&platform=WEB&wpf=pc";
|
||||
String base = "https://global.apis.naver.com/weverse/wevweb";
|
||||
|
||||
String wmd = getWMD(data + time);
|
||||
if (wmd == null || wmd.isEmpty()) {
|
||||
throw new Exception("wmd解析失败");
|
||||
}
|
||||
// 创建HttpClient实例
|
||||
HttpClient httpClient = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(10))
|
||||
.build();
|
||||
|
||||
// 创建HttpRequest
|
||||
String url = base + data + "&wmsgpad=" + time + "&wmd=" + wmd;
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(new URI(url))
|
||||
.GET()
|
||||
.header("Authorization", "Bearer " + applies.get(0).getToken())
|
||||
.header("Origin", "https://weverse.io")
|
||||
.header("Referer", "https://weverse.io/")
|
||||
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
||||
.build();
|
||||
|
||||
// 发送请求并获取响应
|
||||
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
// 检查响应状态码
|
||||
if (response.statusCode() == 200) {
|
||||
// 打印响应体
|
||||
String responseBody = response.body();
|
||||
WeverseData weverseData = JSONObject.parseObject(responseBody, WeverseData.class);
|
||||
if (weverseData == null ||
|
||||
weverseData.getButton() == null ||
|
||||
weverseData.getButton().getWebLink() == null ||
|
||||
weverseData.getButton().getWebLink().getUrl() == null ||
|
||||
weverseData.getButton().getWebLink().getUrl().isEmpty()) {
|
||||
throw new Exception("button获取失败");
|
||||
}
|
||||
URI uri = new URI(weverseData.getButton().getWebLink().getUrl());
|
||||
|
||||
String query = uri.getQuery();
|
||||
String[] params = query.split("&");
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
|
||||
for (String param : params) {
|
||||
String[] keyValue = param.split("=");
|
||||
String key = URLDecoder.decode(keyValue[0], "UTF-8");
|
||||
String value = URLDecoder.decode(keyValue[1], "UTF-8");
|
||||
paramMap.put(key, value);
|
||||
}
|
||||
|
||||
// 获取参数e的值
|
||||
eValue = paramMap.get("e");
|
||||
} else {
|
||||
throw new Exception("button请求失败");
|
||||
}
|
||||
|
||||
if (eValue == null || eValue.isEmpty()) {
|
||||
throw new Exception("button为空");
|
||||
}
|
||||
perform1.setNum(eValue);
|
||||
} else {
|
||||
eValue = perform.getNum();
|
||||
if (perform.getNum() == null || perform.getNum().isEmpty()){
|
||||
throw new Exception("Num为空");
|
||||
}
|
||||
|
||||
// String eValue = null;
|
||||
// if (perform.getNum() == null || perform.getNum().isEmpty()) {
|
||||
// long time = System.currentTimeMillis();
|
||||
// String data = "/notice/v1.0/notice-" + perform.getNotice() + "?fieldSet=noticeV1&appId=be4d79eb8fc7bd008ee82c8ec4ff6fd4&language=zh-cn&os=WEB&platform=WEB&wpf=pc";
|
||||
// String base = "https://global.apis.naver.com/weverse/wevweb";
|
||||
//
|
||||
// String wmd = getWMD(data + time);
|
||||
// if (wmd == null || wmd.isEmpty()) {
|
||||
// throw new Exception("wmd解析失败");
|
||||
// }
|
||||
// // 创建HttpClient实例
|
||||
// HttpClient httpClient = HttpClient.newBuilder()
|
||||
// .connectTimeout(Duration.ofSeconds(10))
|
||||
// .build();
|
||||
//
|
||||
// // 创建HttpRequest
|
||||
// String url = base + data + "&wmsgpad=" + time + "&wmd=" + wmd;
|
||||
// HttpRequest request = HttpRequest.newBuilder()
|
||||
// .uri(new URI(url))
|
||||
// .GET()
|
||||
// .header("Authorization", "Bearer " + applies.get(0).getToken())
|
||||
// .header("Origin", "https://weverse.io")
|
||||
// .header("Referer", "https://weverse.io/")
|
||||
// .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
||||
// .build();
|
||||
//
|
||||
// // 发送请求并获取响应
|
||||
// HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
//
|
||||
// // 检查响应状态码
|
||||
// if (response.statusCode() == 200) {
|
||||
// // 打印响应体
|
||||
// String responseBody = response.body();
|
||||
// WeverseData weverseData = JSONObject.parseObject(responseBody, WeverseData.class);
|
||||
// if (weverseData == null ||
|
||||
// weverseData.getButton() == null ||
|
||||
// weverseData.getButton().getWebLink() == null ||
|
||||
// weverseData.getButton().getWebLink().getUrl() == null ||
|
||||
// weverseData.getButton().getWebLink().getUrl().isEmpty()) {
|
||||
// throw new Exception("button获取失败");
|
||||
// }
|
||||
// URI uri = new URI(weverseData.getButton().getWebLink().getUrl());
|
||||
//
|
||||
// String query = uri.getQuery();
|
||||
// String[] params = query.split("&");
|
||||
// Map<String, String> paramMap = new HashMap<>();
|
||||
//
|
||||
// for (String param : params) {
|
||||
// String[] keyValue = param.split("=");
|
||||
// String key = URLDecoder.decode(keyValue[0], "UTF-8");
|
||||
// String value = URLDecoder.decode(keyValue[1], "UTF-8");
|
||||
// paramMap.put(key, value);
|
||||
// }
|
||||
//
|
||||
// // 获取参数e的值
|
||||
// eValue = paramMap.get("e");
|
||||
// } else {
|
||||
// throw new Exception("button请求失败");
|
||||
// }
|
||||
//
|
||||
// if (eValue == null || eValue.isEmpty()) {
|
||||
// throw new Exception("button为空");
|
||||
// }
|
||||
// perform1.setNum(eValue);
|
||||
// } else {
|
||||
// eValue = perform.getNum();
|
||||
// }
|
||||
|
||||
String eValue = perform.getNum();
|
||||
Perform perform1 = new Perform();
|
||||
// 创建HttpClient实例
|
||||
HttpClient httpClient = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(10))
|
||||
|
@ -217,12 +217,16 @@ public class PerformServiceImpl implements IPerformService {
|
||||
|
||||
@Override
|
||||
public boolean refresh(Long id) throws Exception {
|
||||
Perform perform = performMapper.selectPerformById(id);
|
||||
if(perform==null){
|
||||
throw new Exception("演出不存在");
|
||||
}
|
||||
//人员
|
||||
Apply apply = new Apply();
|
||||
apply.setPerformId(id);
|
||||
List<Apply> applies = applyMapper.selectApplyListRob(apply);
|
||||
if (applies.isEmpty()) {
|
||||
return false;
|
||||
throw new Exception("人员不存在");
|
||||
}
|
||||
for (Apply a : applies) {
|
||||
// 创建HttpClient实例
|
||||
@ -231,7 +235,7 @@ public class PerformServiceImpl implements IPerformService {
|
||||
.build();
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(new URI("https://faneventapi.weverse.io/api/v1/user/events/4632"))
|
||||
.uri(new URI("https://faneventapi.weverse.io/api/v1/user/events/"+perform.getNum()))
|
||||
.GET()
|
||||
.header("Authorization", "Bearer " + a.getToken())
|
||||
.header("Origin", "https://weverse.io")
|
||||
@ -252,6 +256,11 @@ public class PerformServiceImpl implements IPerformService {
|
||||
apply1.setId(a.getId());
|
||||
apply1.setStatus("4");
|
||||
applyMapper.updateApply(apply1);
|
||||
}else if ("testaaa".equals(weverseAgree.getUserStatus())){
|
||||
Apply apply1 = new Apply();
|
||||
apply1.setId(a.getId());
|
||||
apply1.setStatus("3");
|
||||
applyMapper.updateApply(apply1);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user