diff --git a/web-api/ruoyi-admin/src/main/resources/i18n/messages.properties b/web-api/ruoyi-admin/src/main/resources/i18n/messages.properties index 93de005..9490f31 100644 --- a/web-api/ruoyi-admin/src/main/resources/i18n/messages.properties +++ b/web-api/ruoyi-admin/src/main/resources/i18n/messages.properties @@ -36,3 +36,8 @@ no.update.permission=您没有修改数据的权限,请联系管理员添加 no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] + +# video generation +order.number.generation.failed=订单号 {0} 生成失败,请稍后重试。 +order.number.generation.submit=订单号 {0} 生成任务已提交! +order.number.generation.successbackfill=订单号 {0} 生成成功!金额已回补! \ No newline at end of file diff --git a/web-api/ruoyi-admin/src/main/resources/i18n/messages_zh_HK.properties b/web-api/ruoyi-admin/src/main/resources/i18n/messages_zh_HK.properties index f44388a..7b2abfd 100644 --- a/web-api/ruoyi-admin/src/main/resources/i18n/messages_zh_HK.properties +++ b/web-api/ruoyi-admin/src/main/resources/i18n/messages_zh_HK.properties @@ -29,4 +29,7 @@ email.verification.code.error=驗證碼錯誤,請重新輸入。 user.not.found=用戶不存在。 user.password.incorrect=密碼錯誤,請重新輸入。 -order.number.generation.failed=訂單號 {0} 生成失敗,請稍後重試。 \ No newline at end of file +# video generation +order.number.generation.failed=訂單號 {0} 生成失敗,請稍後重試。 +order.number.generation.submit=訂單號 {0} 生成任務已提交! +order.number.generation.successbackfill=訂單號 {0} 生成成功!金額已回補! \ No newline at end of file diff --git a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java index c0ad6f6..ee572b1 100644 --- a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java +++ b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java @@ -56,6 +56,10 @@ public class AiOrder extends BaseEntity { @Excel(name = "金额") private BigDecimal amount; + /** 模型Tokens用量 */ + @Excel(name = "模型Tokens用量") + private BigDecimal totalUsage; + @Excel(name = "是否回补处理过: 0-否 1-是") private Integer isBackfilled; diff --git a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/AiOrderServiceImpl.java b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/AiOrderServiceImpl.java index 6ae72c7..95bc513 100644 --- a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/AiOrderServiceImpl.java +++ b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/AiOrderServiceImpl.java @@ -197,8 +197,9 @@ public class AiOrderServiceImpl implements IAiOrderService { aiOrderMapper.insert(aiOrder); // 执行余额变更 if (isReduceBalance) { + String remark = MessageUtils.message(TASK_SUBMIT_REMARK, aiOrder.getOrderNum()); aiUserService.addUserBalance(orderno, SecurityUtils.getAiUserId() - , NumberUtil.mul(-1, aiManager.getPrice()), getChangerType(aiType), TASK_SUBMIT_REMARK); + , NumberUtil.mul(-1, aiManager.getPrice()), getChangerType(aiType), remark); } return aiOrder; } @@ -312,6 +313,8 @@ public class AiOrderServiceImpl implements IAiOrderService { } // 设置用量 order.setAmount(realAmount); + // tokens用量 + order.setTotalUsage(realAmount); // 订单状态 order.setStatus(AiOrderStatusType.FINISH.ordinal()); // 已回补 @@ -325,8 +328,9 @@ public class AiOrderServiceImpl implements IAiOrderService { BigDecimal addAmount = order.getPreDeductAmount().subtract(realAmount); if (addAmount.compareTo(new BigDecimal(0)) != 0) { // 回补 + String remark = MessageUtils.message(TASK_SUCCESS_BACK_FILL_REMARK, order.getOrderNum()); aiUserService.addUserBalance(order.getOrderNum(), order.getUserId(), addAmount, - BalanceChangerConstants.REFUND, TASK_SUCCESS_BACK_FILL_REMARK); + BalanceChangerConstants.REFUND, remark); } } diff --git a/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml b/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml index 293cf2e..5f98aed 100644 --- a/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml +++ b/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml @@ -12,10 +12,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -29,10 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - 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 + select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, 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, ao.is_backfilled, ao.video_gen_request_id from ai_order ao left join ai_user au on au.id = ao.user_id