|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
@@ -134,16 +135,29 @@ public class RedeemCloudRechargeServiceImpl implements RedeemCloudRechargeServic
|
|
|
return "卡密错误:" + cardKey;
|
|
|
}
|
|
|
|
|
|
- private String submitTask(String cardKey, String accessToken) {
|
|
|
+ private String submitTask(String cardKey, String rechargePayload) {
|
|
|
log.info("开始提交redeemcloud任务 - 卡密: {}", cardKey);
|
|
|
try {
|
|
|
String baseUrl = gptRechargeCardKeyChannelService.getCardKeyDomain(cardKey);
|
|
|
String url = baseUrl + "/sys-cdk/exchange?cdkCode=" + cardKey;
|
|
|
+ String requestBody = normalizeRechargePayload(rechargePayload);
|
|
|
|
|
|
HttpResponse response = HttpRequest.post(url)
|
|
|
.setConnectionTimeout(60000)
|
|
|
+ .header("accept", "*/*")
|
|
|
+ .header("accept-language", "zh-CN")
|
|
|
.header("content-type", "application/json")
|
|
|
- .body(accessToken)
|
|
|
+ .header("origin", "https://redeemcloud.com")
|
|
|
+ .header("referer", "https://redeemcloud.com/zh")
|
|
|
+ .header("sec-ch-ua", "\"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"150\", \"Microsoft Edge\";v=\"150\"")
|
|
|
+ .header("sec-ch-ua-mobile", "?0")
|
|
|
+ .header("sec-ch-ua-platform", "\"Windows\"")
|
|
|
+ .header("sec-fetch-dest", "empty")
|
|
|
+ .header("sec-fetch-mode", "cors")
|
|
|
+ .header("sec-fetch-site", "same-origin")
|
|
|
+ .header("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0")
|
|
|
+ .header("x-product-code", "GPT")
|
|
|
+ .body(requestBody)
|
|
|
.execute();
|
|
|
String body = response.body();
|
|
|
log.info("redeemcloud任务提交响应: {}", body);
|
|
|
@@ -160,6 +174,13 @@ public class RedeemCloudRechargeServiceImpl implements RedeemCloudRechargeServic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private String normalizeRechargePayload(String rechargePayload) {
|
|
|
+ if (StrUtil.isBlank(rechargePayload) || !StrUtil.startWith(rechargePayload.trim(), "{")) {
|
|
|
+ throw BusinessRuntimeException.getInstance("redeemcloud提交任务需要完整充值参数JSON");
|
|
|
+ }
|
|
|
+ return JSONUtil.parseObj(rechargePayload).toString();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public TaskResult getTaskResult(GroupsRelation relation) {
|
|
|
String cardKey = relation.getCardKey();
|