feat: 添加生成视频任务的扩展状态,在不动现有逻辑的情况下能显示队列中、执行中。并解决刚生成就显示失败的情况
This commit is contained in:
parent
249565ef6d
commit
6037bae970
|
|
@ -599,14 +599,30 @@ export default {
|
|||
taskStatusText(row) {
|
||||
const st = row?.status
|
||||
if (st === 2 || st === '2') return '已失败/已取消'
|
||||
if (st === 0 || st === '0') return '执行中'
|
||||
if (st === 0 || st === '0') {
|
||||
const extStatus = row?.extStatus
|
||||
if (extStatus === 0) {
|
||||
return '队列中'
|
||||
}
|
||||
return '执行中'
|
||||
}
|
||||
if (st === 1 || st === '1') {
|
||||
const r = this.taskRowResultTrim(row)
|
||||
if (!r) return '失败'
|
||||
if (this.isHttpOrHttpsUrl(r)) return '已完成'
|
||||
if (this.isHttpOrHttpsUrl(r)) {
|
||||
return '已完成'
|
||||
}
|
||||
// 任务 id 格式由火山侧决定,不再假定 cgt 前缀;非 URL 的中间态均视为执行中
|
||||
const extStatus = row?.extStatus
|
||||
if (extStatus === 0) {
|
||||
return '队列中'
|
||||
}
|
||||
return '任务执行中'
|
||||
}
|
||||
const extStatus = row?.extStatus
|
||||
if (extStatus === 0) {
|
||||
return '队列中'
|
||||
}
|
||||
return '执行中'
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -343,9 +343,31 @@ public class ByteApiController extends BaseController {
|
|||
boolean codeError = code != null && code != 200;
|
||||
String st = byteBodyRes.getStatus();
|
||||
|
||||
if ("running".equals(st) && !codeError) {
|
||||
if (st != null && !st.isEmpty()) {
|
||||
// 执行中状态
|
||||
Integer extStatus = null;
|
||||
if ("queued".equals(st)) {
|
||||
extStatus = 0;
|
||||
} else if ("running".equals(st)) {
|
||||
extStatus = 1;
|
||||
}
|
||||
if (extStatus != null) {
|
||||
AiOrder order = findAiOrderByVolcTaskId(id);
|
||||
if (order == null) {
|
||||
logger.warn("volcCallback 修改执行中状态,未找到任务对应订单, id={}, {}", id, st);
|
||||
return AjaxResult.success("callback success");
|
||||
}
|
||||
// if (order.getStatus() != 0) {
|
||||
// logger.warn("订单状态不为0, 因此不修改ext_status, id = {}, status = {}, order status = {}", id, st, order.getStatus());
|
||||
// return AjaxResult.success("callback success");
|
||||
// }
|
||||
AiOrder upd = new AiOrder();
|
||||
upd.setId(order.getId());
|
||||
upd.setExtStatus(extStatus);
|
||||
aiOrderService.updateAiOrder(upd);
|
||||
return AjaxResult.success("callback success");
|
||||
}
|
||||
}
|
||||
|
||||
if (codeError) {
|
||||
markVolcCallbackOrderClearResultFailed(id, "code=" + code);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ public class AiOrder extends BaseEntity {
|
|||
@Excel(name = "状态:0-进行中 1-已完成 2-失败", readConverterExp = "余=额退回")
|
||||
private Integer status;
|
||||
|
||||
@Excel(name = "扩展状态:0-队列中 1-执行中")
|
||||
private Integer extStatus;
|
||||
|
||||
/** 是否置顶:N-否 Y-是 */
|
||||
@Excel(name = "是否置顶:N-否 Y-是")
|
||||
private String isTop;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAiOrderVo">
|
||||
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.user_id, ao.type, ao.amount, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid from ai_order ao
|
||||
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.user_id, ao.type, ao.amount, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status from ai_order ao
|
||||
left join ai_user au on au.id = ao.user_id
|
||||
</sql>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue