better-staridc-MNBT
1import { apiGet, apiPost } from './http'
2
3/**
4 * official_site 插件 API(官网内容)
5 * 依赖插件启用:official_site
6 */
7
8/** 产品列表(可选 ?category= 筛选,返回 products + categories) */
9export function getSiteProducts(category = '') {
10 return apiGet('/site/api/products', category ? { category } : {})
11}
12
13/** 产品详情 */
14export function getSiteProduct(productId) {
15 return apiGet(`/site/api/products/${productId}`)
16}
17
18/** 新闻分页列表(page / per_page / category) */
19export function getSiteNews({ page = 1, perPage = 6, category = '' } = {}) {
20 return apiGet('/site/api/news', {
21 page,
22 per_page: perPage,
23 ...(category ? { category } : {}),
24 })
25}
26
27/** 热门新闻(按浏览量) */
28export function getSiteNewsPopular() {
29 return apiGet('/site/api/news/popular')
30}
31
32/** 新闻详情(累计浏览量) */
33export function getSiteNewsDetail(newsId) {
34 return apiGet(`/site/api/news/${newsId}`)
35}
36
37/** 提交联系留言 */
38export function submitSiteContact(form) {
39 return apiPost('/site/api/contact', form)
40}