- 实现了更可靠的自动保存功能,仅在用户停止输入后触发保存操作 - 修复了切换笔记时意外触发自动保存的问题 - 优化了重命名文件后的预览更新逻辑 - 调整了保存成功后的状态清理策略,提高了用户体验
34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
package com.test.bijihoudaun.controller;
|
|
|
|
import com.test.bijihoudaun.common.response.R;
|
|
import com.test.bijihoudaun.service.ImageCleanupService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* 图片清理控制器
|
|
* 提供手动触发清理冗余图片的API端点
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api/admin")
|
|
public class ImageCleanupController {
|
|
|
|
@Autowired
|
|
private ImageCleanupService imageCleanupService;
|
|
|
|
/**
|
|
* 手动触发清理冗余图片
|
|
* @return 清理结果
|
|
*/
|
|
@PostMapping("/cleanup-images")
|
|
@PreAuthorize("hasRole('ADMIN')")
|
|
public R<?> cleanupImages() {
|
|
int deletedCount = imageCleanupService.cleanupRedundantImages();
|
|
return R.success("成功清理 " + deletedCount + " 个冗余图片");
|
|
}
|
|
}
|