mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
【增加】ai image 生成记录删除
This commit is contained in:
parent
e8cf40a82a
commit
b6096b76d2
@ -59,12 +59,14 @@ public class AiImageController {
|
||||
@Operation(summary = "取消 midjourney 绘画", description = "取消 midjourney 绘画")
|
||||
@PostMapping("/cancel-midjourney")
|
||||
public CommonResult<Void> cancelMidjourney(@RequestParam("id") Long id) {
|
||||
// @范 这里实现mj取消逻辑
|
||||
return success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除绘画记录", description = "")
|
||||
@DeleteMapping("/delete")
|
||||
public CommonResult<Void> delete(@RequestParam("id") Long id) {
|
||||
aiImageService.delete(id);
|
||||
return success(null);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class AiImageMidjourneyOperateReqVO {
|
||||
|
||||
@NotNull(message = "图片编号不能为空")
|
||||
@Schema(description = "编号")
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "消息编号不能为空")
|
||||
@Schema(description = "消息编号")
|
||||
|
@ -44,4 +44,11 @@ public interface AiImageService {
|
||||
*/
|
||||
void midjourneyOperate(AiImageMidjourneyOperateReqVO req);
|
||||
|
||||
/**
|
||||
* 删除 - image 记录
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void delete(Long id);
|
||||
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class AiImageServiceImpl implements AiImageService {
|
||||
@Override
|
||||
public void midjourneyOperate(AiImageMidjourneyOperateReqVO req) {
|
||||
// 校验是否存在
|
||||
AiImageDO aiImageDO = validateExists(req);
|
||||
AiImageDO aiImageDO = validateExists(req.getId());
|
||||
// 获取 midjourneyOperations
|
||||
List<AiImageMidjourneyOperationsVO> midjourneyOperations = getMidjourneyOperations(aiImageDO);
|
||||
// 校验 OperateId 是否存在
|
||||
@ -158,6 +158,14 @@ public class AiImageServiceImpl implements AiImageService {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
// 校验记录是否存在
|
||||
AiImageDO aiImageDO = validateExists(id);
|
||||
// 删除记录
|
||||
aiImageMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateMessageId(String mjMessageId, String messageId) {
|
||||
if (!mjMessageId.equals(messageId)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AI_MIDJOURNEY_MESSAGE_ID_INCORRECT);
|
||||
@ -181,8 +189,8 @@ public class AiImageServiceImpl implements AiImageService {
|
||||
return JsonUtils.parseArray(aiImageDO.getMjOperations(), AiImageMidjourneyOperationsVO.class);
|
||||
}
|
||||
|
||||
private AiImageDO validateExists(AiImageMidjourneyOperateReqVO req) {
|
||||
AiImageDO aiImageDO = aiImageMapper.selectById(req.getId());
|
||||
private AiImageDO validateExists(Long id) {
|
||||
AiImageDO aiImageDO = aiImageMapper.selectById(id);
|
||||
if (aiImageDO == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AI_MIDJOURNEY_IMAGINE_FAIL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user