king
2024-05-27 31aa3ba8a4b028d04c43b5960e23820abffd1ad1
src/index.js
@@ -75,6 +75,13 @@
      GLOB.externalDatabase = null
    }
    if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) {
      GLOB.probation = true
    }
    if (config.forcedUpdate && /^20\d{2}-\d{2}-\d{2}$/.test(config.forcedUpdate) && new Date(config.forcedUpdate).getTime() > new Date().getTime()) {
      GLOB.forcedUpdate = true
    }
    // 只有业务系统才可以设置为正式系统
    if (GLOB.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) {
      if (!config.mainSystemApi) {
@@ -89,12 +96,6 @@
      }
      GLOB.systemType = 'production'
      if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) {
        GLOB.probation = true
      }
      if (config.forcedUpdate && /^20\d{2}-\d{2}-\d{2}$/.test(config.forcedUpdate) && new Date(config.forcedUpdate).getTime() > new Date().getTime()) {
        GLOB.forcedUpdate = true
      }
    } else if (GLOB.sysType === 'local') {
      GLOB.probation = true
      GLOB.debugger = true
@@ -245,9 +246,39 @@
      sessionStorage.setItem('system_mark', _mark)
    }
    if (config.mainkey && GLOB.sysType !== 'cloud' && config.mainkey !== options.cakey) {
      GLOB.localkey = GLOB.appkey
      GLOB.appkey = config.mainkey
    }
    let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US')
    sessionStorage.setItem('lang', lang)
    if (localStorage.getItem(_href + 'files') === md5(_href + 'files')) {
      let d = localStorage.getItem(_href + 'filesDate')
      GLOB.storeFiles = true
      GLOB.storeDate = Math.ceil((new Date(d).getTime() - new Date().getTime()) / 86400000)
    } else if (GLOB.licenseKey && config.storeKey && config.storeKey.length === 16) {
      let trans = {A:0, B:1, C:2, D:3, E:4, F:5, G:6, H:7, I:8, J:9}
      let d = config.storeKey.slice(0, 8)
      d = d.split('').map(k => trans[k]).join('')
      let key = config.storeKey.slice(8)
      let _key = GLOB.appId + GLOB.appkey + 'e_files_key' + d
      _key = md5(_key.toLowerCase())
      _key = _key.toUpperCase()
      _key = _key.slice(-8)
      if (key === _key) {
        GLOB.storeFiles = true
        d = d.slice(0, 4) + '-' + d.slice(4, 6) + '-' + d.slice(6)
        GLOB.storeDate = Math.ceil((new Date(d).getTime() - new Date().getTime()) / 86400000)
      }
    }
    GLOB.mkActions = {}  // 按钮权限集
    Object.defineProperty(GLOB, 'appId', {