Commit e1848895da1e25cb3726d648cd4bb0dc44d18e38
1 parent
bdbe2633
【增加】系统账户余额不足提示
Showing
2 changed files
with
4 additions
and
0 deletions
yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ErrorCodeConstants.java
| ... | ... | @@ -45,5 +45,6 @@ public interface ErrorCodeConstants { |
| 45 | 45 | ErrorCode AI_IMAGE_NOT_EXISTS = new ErrorCode(1_022_005_000, "image 不存在!"); |
| 46 | 46 | ErrorCode AI_IMAGE_MIDJOURNEY_SUBMIT_FAIL = new ErrorCode(1_022_005_001, "Midjourney 提交失败! {}"); |
| 47 | 47 | ErrorCode AI_IMAGE_CUSTOM_ID_NOT_EXISTS = new ErrorCode(1_022_005_002, "Midjourney 按钮 customId 不存在! {}"); |
| 48 | + ErrorCode AI_IMAGE_SYSTEM_ACCOUNT_INSUFFICIENT_BALANCE = new ErrorCode(1_022_005_003, "Midjourney 系统账户余额不足!"); | |
| 48 | 49 | |
| 49 | 50 | } | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
| ... | ... | @@ -147,6 +147,9 @@ public class AiImageServiceImpl implements AiImageService { |
| 147 | 147 | |
| 148 | 148 | // 4、保存任务 id (状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误)) |
| 149 | 149 | if (!MidjourneyApi.SubmitCodeEnum.SUCCESS_CODES.contains(submitResponse.code())) { |
| 150 | + if (submitResponse.description().contains("quota_not_enough")) { | |
| 151 | + throw exception(AI_IMAGE_SYSTEM_ACCOUNT_INSUFFICIENT_BALANCE, submitResponse.description()); | |
| 152 | + } | |
| 150 | 153 | throw exception(AI_IMAGE_MIDJOURNEY_SUBMIT_FAIL, submitResponse.description()); |
| 151 | 154 | } |
| 152 | 155 | // 4.1、更新 taskId 和参数 | ... | ... |