riku
2025-04-27 f46786f11c5c08ead7501a82e5a71430ad69b782
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * 动态配置相关数据接口
 */
 
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 };