blob: 5d45174bdd1baedb86fe13f4794d1cd03bedd970 [file] [log] [blame]
DREW7c7c6a02025-06-05 19:58:55 +08001// src/api/recommend.js
2import { api } from './auth';
3
4export const getRecommendations = async (limit = 5) => {
5 try {
6 const response = await api.get('/recommend/for-user', {
7 params: { limit }
8 });
DREW5b1883e2025-06-07 10:41:32 +08009 console.log("recommendations response", response);
DREW7c7c6a02025-06-05 19:58:55 +080010 return response.data;
11 } catch (error) {
12 console.error('获取推荐失败:', error);
13 throw error;
14 }
15};
16
17export const markRecommendationShown = async (torrentId) => {
18 try {
19 await api.post(`/recommend/mark-shown/${torrentId}`);
20 } catch (error) {
21 console.error('标记推荐为已显示失败:', error);
22 }
23};
24
25export const markRecommendationClicked = async (torrentId) => {
26 try {
27 await api.post(`/recommend/mark-clicked/${torrentId}`);
28 } catch (error) {
29 console.error('标记推荐为已点击失败:', error);
30 }
31};