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