xiangyixiangqin/miniapp/api/config.js
2026-01-07 17:52:35 +08:00

61 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 配置接口模块
* Requirements: 2.1, 2.2, 3.2
*/
import { get } from './request'
/**
* 获取首页配置Banner和金刚位
* WHEN a user visits the home page, THE XiangYi_MiniApp SHALL display Banner images
* WHEN a user visits the home page, THE XiangYi_MiniApp SHALL display KingKong navigation icons
* Requirements: 2.1, 2.2
*
* @returns {Promise<Object>} 首页配置包含banners和kingKongs
*/
export async function getHomeConfig() {
const response = await get('/config/home', {}, { needAuth: false })
return response
}
/**
* 获取弹窗配置
* WHEN a user opens the XiangYi_MiniApp for the first time each day,
* THE XiangYi_MiniApp SHALL display the daily popup
* Requirements: 3.2
*
* @param {number} popupType - 弹窗类型1每日首次 2服务号关注 3会员广告
* @returns {Promise<Object>} 弹窗配置
*/
export async function getPopupConfig(popupType = 1) {
const response = await get('/config/popup', { popupType })
return response
}
/**
* 获取所有弹窗配置
*
* @returns {Promise<Object>} 弹窗配置列表
*/
export async function getAllPopupConfigs() {
const response = await get('/config/popups')
return response
}
/**
* 获取默认头像配置
*
* @returns {Promise<Object>} 默认头像URL
*/
export async function getDefaultAvatarConfig() {
const response = await get('/config/defaultAvatar', {}, { needAuth: false })
return response
}
export default {
getHomeConfig,
getPopupConfig,
getAllPopupConfigs,
getDefaultAvatarConfig
}