|
|
@@ -2,6 +2,7 @@ package com.cyksj.server.recharge.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
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.JSONObject;
|
|
|
@@ -170,8 +171,9 @@ public class GptProxyRechargeServiceImpl implements GptProxyRechargeService {
|
|
|
);
|
|
|
log.info("任务查询结果: {}", result);
|
|
|
String status = result.getStatus();
|
|
|
+ String resultResult = result.getResult();
|
|
|
//更新代充状态
|
|
|
- resetGroupsRelationRechargeStatus(taskId, status);
|
|
|
+ resetGroupsRelationRechargeStatus(taskId, status, resultResult);
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取任务结果失败: {}", e.getMessage(), e);
|
|
|
@@ -296,7 +298,7 @@ public class GptProxyRechargeServiceImpl implements GptProxyRechargeService {
|
|
|
/**
|
|
|
* 更新代充状态
|
|
|
*/
|
|
|
- private void resetGroupsRelationRechargeStatus(String taskId, String status) {
|
|
|
+ private void resetGroupsRelationRechargeStatus(String taskId, String status, String result) {
|
|
|
if ("completed".equals(status) || "failed".equals(status)) {
|
|
|
GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
.eq(GroupsRelation::getGptTaskId, taskId)
|
|
|
@@ -337,11 +339,16 @@ public class GptProxyRechargeServiceImpl implements GptProxyRechargeService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ String rechargeErrorInfo = null;
|
|
|
+ if (rechargeStatus == GroupsRelation.RechargeStatus.recharge_error) {
|
|
|
+ rechargeErrorInfo = result;
|
|
|
+ }
|
|
|
relationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
.set(rechargeStatus == GroupsRelation.RechargeStatus.recharge_error, GroupsRelation::getRechargeRemainNum, rechargeRemainNum + 1)
|
|
|
.set(GroupsRelation::getRechargeStatus, rechargeStatus)
|
|
|
.set(expiryTime != null, GroupsRelation::getStartTime, startTime)
|
|
|
.set(expiryTime != null, GroupsRelation::getExpiryTime, expiryTime)
|
|
|
+ .set(StrUtil.isNotEmpty(rechargeErrorInfo), GroupsRelation::getRechargeErrorInfo, rechargeErrorInfo)
|
|
|
.eq(GroupsRelation::getId, relation.getId())
|
|
|
.le(GroupsRelation::getRechargeRemainNum, relation.getRechargeNum())
|
|
|
.eq(GroupsRelation::getRechargeStatus, GroupsRelation.RechargeStatus.recharging));
|