查看冷门资源
Change-Id: Idb875bd6ff4c6dba3cc40cf6ef298731b526c1a7
diff --git a/src/main/java/com/example/myproject/controller/PromotionController.java b/src/main/java/com/example/myproject/controller/PromotionController.java
index ab6efe7..ed90bf7 100644
--- a/src/main/java/com/example/myproject/controller/PromotionController.java
+++ b/src/main/java/com/example/myproject/controller/PromotionController.java
@@ -5,7 +5,9 @@
import com.example.myproject.common.base.Result;
import com.example.myproject.dto.PromotionCreateDTO;
import com.example.myproject.dto.TorrentUpdateDTO;
+import com.example.myproject.dto.vo.TorrentVO;
import com.example.myproject.entity.Promotion;
+import com.example.myproject.entity.TorrentEntity;
import com.example.myproject.service.PromotionService;
import com.example.myproject.service.TorrentService;
import com.example.myproject.service.UserService;
@@ -138,4 +140,17 @@
return Result.error("删除促销失败: " + e.getMessage());
}
}
+ @SaCheckLogin
+ @Operation(summary = "查看冷门资源")
+ @GetMapping("/cold")
+ public Result getColdResources() {
+ try {
+ List<TorrentEntity> coldList = torrentService.getColdTorrents(10); // 例如 views < 10
+ return Result.ok(coldList);
+ } catch (Exception e) {
+ return Result.error("获取冷门资源失败: " + e.getMessage());
+ }
+ }
+
+
}