chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 推荐与搜索服务(API_INVENTORY 行 36-37, 41-43)
|
||||
*
|
||||
* 封装:今日推荐列表、推荐详情、Discover 搜索、用户公开主页。
|
||||
* Required 不可自动放宽(AGENTS 第 2 条)——本层不实现任何"放宽条件后再查"的逻辑,
|
||||
* 仅把请求透传给后端,由后端按 PartnerPreference 做硬约束过滤。
|
||||
*/
|
||||
const api = require('../utils/api');
|
||||
|
||||
/**
|
||||
* 获取今日推荐列表(API_INVENTORY 行 36)
|
||||
* @param {{ cursor?: string, pageSize?: number }} params
|
||||
* @returns {Promise<{ items: Array<import('../types').Recommendation>, nextCursor: string|null, dailyRemaining: number }>}
|
||||
*/
|
||||
function getRecommendations(params = {}) {
|
||||
return api.get('/recommendations', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推荐详情(API_INVENTORY 行 37)
|
||||
* @param {string} userId
|
||||
* @returns {Promise<import('../types').Recommendation>}
|
||||
*/
|
||||
function getRecommendationDetail(userId) {
|
||||
return api.get(`/recommendations/${encodeURIComponent(userId)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Discover 搜索(API_INVENTORY 行 42)
|
||||
* @param {{ keyword?: string, region?: string, ageMin?: number, ageMax?: number, cursor?: string, pageSize?: number }} params
|
||||
* @returns {Promise<{ items: Array<import('../types').User>, nextCursor: string|null }>}
|
||||
*/
|
||||
function discover(params = {}) {
|
||||
return api.get('/discover', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看用户公开主页(API_INVENTORY 行 43)
|
||||
* @param {string} userId
|
||||
* @returns {Promise<import('../types').User & { relationStatus: import('../types').RelationStatus }>}
|
||||
*/
|
||||
function getUserDetail(userId) {
|
||||
return api.get(`/users/${encodeURIComponent(userId)}`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getRecommendations,
|
||||
getRecommendationDetail,
|
||||
discover,
|
||||
getUserDetail,
|
||||
};
|
||||
Reference in New Issue
Block a user