feat:mock 的对接了首页、分类、商家列表和详情的接口
This commit is contained in:
1 parent
87cf7dfbaa
commit
d723eb1232
20 files changed
+3948
-333
No files matched your search
+24
-17
@@ -1,24 +1,31 @@
|
||||
/**
|
||||
* 内容接口(/v1/*)—— 商家权益平台
|
||||
* ---------------------------------------------------------------------------
|
||||
* 与旧网关(biz.nianxx.cn)是两套后端,差异:
|
||||
* - 无 clientId 头;鉴权只靠 Authorization: Bearer <token>
|
||||
* - 成功响应即业务对象本身,没有 { code, data, message } 包装
|
||||
* - 失败返回 { error: { code, message } },401 表示登录失效
|
||||
* - 分页只有 limit / offset(limit 1–100,默认 20),未声明的 query 会 400
|
||||
* - 时间为 RFC3339 UTC,展示前需转北京时间
|
||||
*/
|
||||
import { BASE_URL_V1 } from "@/config/env";
|
||||
import request from "../base/request";
|
||||
|
||||
/**
|
||||
* 内容(板块 / 目录 / 条目 / 素材)接口
|
||||
* 字段口径见 需求说明 §2 / §5 / §6
|
||||
*/
|
||||
const V1 = `${BASE_URL_V1}/v1`;
|
||||
|
||||
/** 获取全部板块(4 个:票根经济 / 旅居服务 / 全域美食 / 龙里特产) */
|
||||
export const fetchSections = () => request.get("/longli/content/sections");
|
||||
/** /v1 通道:不带 clientId */
|
||||
const V1_CONFIG = { noClientId: true };
|
||||
|
||||
/** 获取板块详情(含分组与条目,已过滤 enabled=false 与空分组) */
|
||||
export const fetchSection = (sectionKey) => request.get("/longli/content/section", { key: sectionKey });
|
||||
/** 首页聚合(品牌 / hero / 板块卡 / 精选推荐 / 导览 / 页脚) */
|
||||
export const fetchHomepage = () => request.get(`${V1}/homepage`, {}, V1_CONFIG);
|
||||
|
||||
/** 获取条目详情 */
|
||||
export const fetchItem = (collection, id) => request.get("/longli/content/item", { collection, id });
|
||||
/** 板块分类导航(section_key = scenic / stay / food / specialty) */
|
||||
export const fetchCategories = (sectionKey) =>
|
||||
request.get(`${V1}/categories`, { section_key: sectionKey }, V1_CONFIG);
|
||||
|
||||
/** 获取同类型推荐(排除自身) */
|
||||
export const fetchRelatedItems = (params) => request.get("/longli/content/related", params);
|
||||
/** 商家列表:传 section_key 一次取全(前端按 category_id 归组),或传 category_id 取单分类 */
|
||||
export const fetchMerchants = (params = {}) =>
|
||||
request.get(`${V1}/merchants`, { limit: 100, ...params }, V1_CONFIG);
|
||||
|
||||
/** 首页精选推荐(一期为运营固定位,二期由后端下发) */
|
||||
export const fetchFeaturedItems = () => request.get("/longli/content/featured");
|
||||
|
||||
/** 素材(导览图等) */
|
||||
export const fetchAssets = (params = {}) => request.get("/longli/content/assets", params);
|
||||
/** 商家详情:一次返回商家 + 权益 + 同类推荐 */
|
||||
export const fetchMerchantDetail = (id) => request.get(`${V1}/merchants/${id}/detail`, {}, V1_CONFIG);
|
||||
Reference in new issue
Block a user