干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2023-03-10 1fb197352b6a263646e4ccd3ed1c7854ede031dd
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
import { defHttp } from '/@/utils/http/axios';
import { cloneObject } from '/@/utils/index';
 
export const backEndUrl = {
  // 获取启用的第三方App
  getEnabledType: '/sys/thirdApp/getEnabledType',
  // 企业微信
  wechatEnterprise: {
    user: '/sys/thirdApp/sync/wechatEnterprise/user',
    depart: '/sys/thirdApp/sync/wechatEnterprise/depart',
  },
  // 钉钉
  dingtalk: {
    user: '/sys/thirdApp/sync/dingtalk/user',
    depart: '/sys/thirdApp/sync/dingtalk/depart',
  },
};
// 启用了哪些第三方App(在此缓存)
let enabledTypes = null;
 
// 获取启用的第三方App
export const getEnabledTypes = async () => {
  // 获取缓存
  if (enabledTypes != null) {
    return cloneObject(enabledTypes);
  } else {
    let { success, result } = await defHttp.get({ url: backEndUrl.getEnabledType }, { isTransformResponse: false });
    if (success) {
      // 在此缓存
      enabledTypes = cloneObject(result);
      return result;
    } else {
      console.warn('getEnabledType查询失败:');
    }
  }
  return {};
};