Compare commits
No commits in common. "4d428b9d94dcdf2c9a3d00d7648cbb59494de96d" and "bb5daf02be77811c946dcb502aa51b877105823d" have entirely different histories.
4d428b9d94
...
bb5daf02be
|
|
@ -181,7 +181,6 @@ export default {
|
||||||
})
|
})
|
||||||
this.username = ""
|
this.username = ""
|
||||||
this.password = ""
|
this.password = ""
|
||||||
this.$router.replace({ name: 'video-gen' })
|
|
||||||
this.$emit('cancel')
|
this.$emit('cancel')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export const constantRoutes = [{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: {
|
redirect: {
|
||||||
name: 'video-gen'
|
name: 'index'
|
||||||
},
|
},
|
||||||
children: [{
|
children: [{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
|
|
|
||||||
|
|
@ -1201,7 +1201,6 @@ export default {
|
||||||
this.$message.warning('任务已完成但未返回视频地址,请稍后重试或联系管理员')
|
this.$message.warning('任务已完成但未返回视频地址,请稍后重试或联系管理员')
|
||||||
}
|
}
|
||||||
this.destroyInterval()
|
this.destroyInterval()
|
||||||
this.$store.dispatch('user/getInfo').catch(() => {})
|
|
||||||
this.refreshChatFirstPage()
|
this.refreshChatFirstPage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.ruoyi.ai.domain.*;
|
||||||
import com.ruoyi.ai.service.*;
|
import com.ruoyi.ai.service.*;
|
||||||
import com.ruoyi.api.request.ByteApiRequest;
|
import com.ruoyi.api.request.ByteApiRequest;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.constant.BalanceChangerConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.request.video.dto.VideoTaskCallBackRequest;
|
import com.ruoyi.common.core.request.video.dto.VideoTaskCallBackRequest;
|
||||||
|
|
@ -11,6 +12,7 @@ import com.ruoyi.common.core.response.video.GetVideoGenerationTaskResponse;
|
||||||
import com.ruoyi.common.enums.AiOrderStatusType;
|
import com.ruoyi.common.enums.AiOrderStatusType;
|
||||||
import com.ruoyi.common.enums.VideoTaskStatusType;
|
import com.ruoyi.common.enums.VideoTaskStatusType;
|
||||||
import com.ruoyi.common.utils.RandomStringUtil;
|
import com.ruoyi.common.utils.RandomStringUtil;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.TencentCosUtil;
|
import com.ruoyi.common.utils.TencentCosUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -18,12 +20,12 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ public class PortalVideoController extends BaseController {
|
||||||
private AjaxResult submitOrderAndCreate(PortalVideoGenRequest req, String mode, ByteBodyReq byteBodyReq) {
|
private AjaxResult submitOrderAndCreate(PortalVideoGenRequest req, String mode, ByteBodyReq byteBodyReq) {
|
||||||
String functionType = resolveFunctionType(req);
|
String functionType = resolveFunctionType(req);
|
||||||
// 判断余额是否足够,aimanager里配置了最低限额。创建订单
|
// 判断余额是否足够,aimanager里配置了最低限额。创建订单
|
||||||
AiOrder aiOrder = aiOrderService.getAiOrder(functionType);
|
AiOrder aiOrder = aiOrderService.getAiOrder(functionType, false);
|
||||||
if (aiOrder == null) {
|
if (aiOrder == null) {
|
||||||
return AjaxResult.error(-1, "You have a low balance, please recharge");
|
return AjaxResult.error(-1, "You have a low balance, please recharge");
|
||||||
}
|
}
|
||||||
|
|
@ -285,33 +285,30 @@ public class PortalVideoController extends BaseController {
|
||||||
aiOrder.setVideoGenRequestId(byteBodyRes.getRequestId());
|
aiOrder.setVideoGenRequestId(byteBodyRes.getRequestId());
|
||||||
// aiOrderService.orderSuccess(aiOrder);
|
// aiOrderService.orderSuccess(aiOrder);
|
||||||
aiOrderService.updateAiOrder(aiOrder);
|
aiOrderService.updateAiOrder(aiOrder);
|
||||||
|
|
||||||
// !!!!! 逻辑暂时停用,先不预扣 start !!!!!
|
|
||||||
// 查询任务详情,按字节返回的预扣数量扣减
|
// 查询任务详情,按字节返回的预扣数量扣减
|
||||||
// GetVideoGenerationTaskResponse task = byteService.getVideoGenerationTasks(thirdPartyOrderNumId, key);
|
GetVideoGenerationTaskResponse task = byteService.getVideoGenerationTasks(thirdPartyOrderNumId, key);
|
||||||
// if (task == null || task.getUsage() == null || task.getUsage().getTotalTokens() == null) {
|
if (task == null || task.getUsage() == null || task.getUsage().getTotalTokens() == null) {
|
||||||
// return AjaxResult.error(-2, "generation failed, byte task's usage is null");
|
return AjaxResult.error(-2, "generation failed, byte task's usage is null");
|
||||||
// }
|
}
|
||||||
// if (task.getUsage().getTotalTokens() <= 0) {
|
if (task.getUsage().getTotalTokens() <= 0) {
|
||||||
// return AjaxResult.error(-2, "generation failed, byte task's totalTokens <= 0");
|
return AjaxResult.error(-2, "generation failed, byte task's totalTokens <= 0");
|
||||||
// }
|
}
|
||||||
// BigDecimal totalTokens = new BigDecimal(task.getUsage().getTotalTokens());
|
BigDecimal totalTokens = new BigDecimal(task.getUsage().getTotalTokens());
|
||||||
// // 同步设置aiOrder,以防在抛异常时数值没变
|
// 同步设置aiOrder,以防在抛异常时数值没变
|
||||||
// aiOrder.setPreDeductAmount(totalTokens);
|
aiOrder.setPreDeductAmount(totalTokens);
|
||||||
// aiOrder.setAmount(totalTokens);
|
aiOrder.setAmount(totalTokens);
|
||||||
|
|
||||||
// 设置订单信息
|
// 设置订单信息
|
||||||
// AiOrder updAiOrder = new AiOrder();
|
AiOrder updAiOrder = new AiOrder();
|
||||||
// updAiOrder.setId(aiOrder.getId());
|
updAiOrder.setId(aiOrder.getId());
|
||||||
// updAiOrder.setOrderNum(aiOrder.getOrderNum());
|
updAiOrder.setOrderNum(aiOrder.getOrderNum());
|
||||||
// updAiOrder.setPreDeductAmount(totalTokens);
|
updAiOrder.setPreDeductAmount(totalTokens);
|
||||||
// 先设置成预扣数量,等收到回调再改过来,这样后续报表会比较准确
|
// 先设置成预扣数量,等收到回调再改过来,这样后续报表会比较准确
|
||||||
// updAiOrder.setAmount(totalTokens);
|
updAiOrder.setAmount(totalTokens);
|
||||||
// aiOrderService.updateAiOrder(updAiOrder);
|
aiOrderService.updateAiOrder(updAiOrder);
|
||||||
// 扣减余额
|
// 扣减余额
|
||||||
// aiUserService.addUserBalance(aiOrder.getOrderNum(), SecurityUtils.getAiUserId()
|
aiUserService.addUserBalance(aiOrder.getOrderNum(), SecurityUtils.getAiUserId()
|
||||||
// , NumberUtil.mul(-1, totalTokens), aiOrderService.getChangerType(functionType));
|
, NumberUtil.mul(-1, totalTokens), aiOrderService.getChangerType(functionType));
|
||||||
// !!!!! 逻辑暂时停用,先不预扣 start !!!!!
|
|
||||||
return AjaxResult.success(byteBodyRes);
|
return AjaxResult.success(byteBodyRes);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
aiOrderService.orderFailure(aiOrder);
|
aiOrderService.orderFailure(aiOrder);
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,9 @@ volcengine:
|
||||||
ak: AKLTNmYyN2VhZTcyMDcxNDNlNzg3OGVlMDVmZjRhNWQwY2M
|
ak: AKLTNmYyN2VhZTcyMDcxNDNlNzg3OGVlMDVmZjRhNWQwY2M
|
||||||
sk: Tm1ZeU1UTmlORFk1WmpKa05HUmpaRGcxTWpjMFpqUmpOVE01TUdJME5URQ==
|
sk: Tm1ZeU1UTmlORFk1WmpKa05HUmpaRGcxTWpjMFpqUmpOVE01TUdJME5URQ==
|
||||||
projectAesKeyBase64: "gJajABVfQJ9xA94Q9IvQi68fqqhSIkfcKlG7pjGFt2U="
|
projectAesKeyBase64: "gJajABVfQJ9xA94Q9IvQi68fqqhSIkfcKlG7pjGFt2U="
|
||||||
|
url: https://ark.ap-southeast.bytepluses.com/api/v3
|
||||||
|
apiKey: 3e33e034-7e25-4228-8864-b51b2a7a8f97
|
||||||
|
callBackUrl: http://47.86.170.114:5173/
|
||||||
|
|
||||||
# 门户视频生成页:模型 / 比例 / 时长 / 分辨率均由此处维护,前后端不写死业务枚举
|
# 门户视频生成页:模型 / 比例 / 时长 / 分辨率均由此处维护,前后端不写死业务枚举
|
||||||
portal:
|
portal:
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import java.util.UUID;
|
||||||
/**
|
/**
|
||||||
* AWS S3 文件上传工具类
|
* AWS S3 文件上传工具类
|
||||||
*/
|
*/
|
||||||
//@Component
|
@Component
|
||||||
public class AwsS3Util {
|
public class AwsS3Util {
|
||||||
|
|
||||||
// -------------------------- 配置参数(需根据实际环境修改)--------------------------
|
// -------------------------- 配置参数(需根据实际环境修改)--------------------------
|
||||||
|
|
|
||||||
|
|
@ -219,10 +219,8 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
||||||
aiOrder.setRemark(remark);
|
aiOrder.setRemark(remark);
|
||||||
aiOrderMapper.updateById(aiOrder);
|
aiOrderMapper.updateById(aiOrder);
|
||||||
Long userId = aiOrder.getUserId() != null ? aiOrder.getUserId() : SecurityUtils.getAiUserId();
|
Long userId = aiOrder.getUserId() != null ? aiOrder.getUserId() : SecurityUtils.getAiUserId();
|
||||||
// 变更值为0则不改余额,没有流水
|
|
||||||
if (aiOrder.getAmount() != null && !aiOrder.getAmount().equals(new BigDecimal(0))) {
|
|
||||||
aiUserService.addUserBalance(aiOrder.getOrderNum(), userId, amount, BalanceChangerConstants.REFUND, remark);
|
aiUserService.addUserBalance(aiOrder.getOrderNum(), userId, amount, BalanceChangerConstants.REFUND, remark);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -310,7 +308,6 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
||||||
order.setAmount(realAmount);
|
order.setAmount(realAmount);
|
||||||
// 订单状态
|
// 订单状态
|
||||||
order.setStatus(AiOrderStatusType.FINISH.ordinal());
|
order.setStatus(AiOrderStatusType.FINISH.ordinal());
|
||||||
// 已回补
|
|
||||||
order.setIsBackfilled(1);
|
order.setIsBackfilled(1);
|
||||||
orderSuccess(order);
|
orderSuccess(order);
|
||||||
|
|
||||||
|
|
@ -325,11 +322,6 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
||||||
BalanceChangerConstants.REFUND, TASK_SUCCESS_BALANCE_REMARK);
|
BalanceChangerConstants.REFUND, TASK_SUCCESS_BALANCE_REMARK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按实际用量扣减
|
|
||||||
// BigDecimal reduceAmount = NumberUtil.mul(-1, realAmount);
|
|
||||||
// aiUserService.addUserBalance(order.getOrderNum(), order.getUserId(), reduceAmount,
|
|
||||||
// BalanceChangerConstants.QUICK_VIDEO_GENERATION, TASK_SUCCESS_BALANCE_REMARK);
|
|
||||||
return AjaxResult.success("callback success");
|
return AjaxResult.success("callback success");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue