/** * 动态配置相关数据接口 */ import { get, post } from '../baseRequset'; import { parseSceneTypes, SceneTypes } from '../../common/dataSceneTypes'; const app = getApp(); /** * 获取用户可选的场景类型范围 */ function fetchSceneTypes({ userId }) { return get({ url: `/config/scene/range`, params: { userId: userId, }, }).then(res => { if (res.data.success) { res.data.data = parseSceneTypes(res.data.data); } else { res.data.data = SceneTypes; } return res.data; }); } /** * 获取用户的区域配置信息 */ function fetchUserConfig({ userId }) { return get({ url: `/config/user/config`, params: { userId: userId, }, }).then(res => { if (res.data.success) { app.globalData.userConfig = res.data.data; } }); } export { fetchSceneTypes, fetchUserConfig };