environment.js 3.47 KB
import { env } from '~/config'
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
// console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion)

//手动控制体验版环境的请求 true就依据下面index false就默认为2
const manual = false
const release = false

let index = env

// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
// trial:体验版
// release:正式版
// console.log( systemInfo.platform);
// console.log(accountInfo.miniProgram.envVersion);
if (systemInfo.platform != 'devtools') {
  switch (accountInfo.miniProgram.envVersion) {
    case 'develop':
      break
    case 'trial':
      index = manual ? index : 2
      break
    case 'release':
      index = release ? index : 3
      break
    default:
      index = 3
      break
  }
}

// console.log(index);
const secretKey_items = {
  ip: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  dev: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  uat: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  prod: {
    appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
    secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
  },
  preRelease: {
    appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
    secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
  }
}
const scrmSecretKey_items = {
  ip: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  dev: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  uat: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  prod: {
    appKey: '48e5e13229b82c1b4e6e8c96151f0637',
    secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
  },
  preRelease: {
    appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
    secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
  }
}
const domain_items = {
  ip: {
    // dj: 'http://192.168.1.165:8292',
    dj: 'http://192.168.1.170:8292',
    scrm: 'http://192.168.1.165:8292'
  },
  dev: {
    dj: 'https://dj.dev.glsx.com.cn',
    scrm: 'https://scrm.dev.glsx.com.cn'
  },
  uat: {
    dj: 'https://dj.test.glsx.com.cn',
    scrm: 'https://scrm.test.glsx.com.cn'
  },
  prod: {
    dj: 'https://dj.glsx.com.cn',
    scrm: 'https://scrm.glsx.com.cn'
  },
  preRelease: {
    dj: 'https://dj.beta.glsx.com.cn',
    scrm: 'https://scrm.beta.glsx.com.cn'
  }
}
// const domain_items = {
//   // ip: 'http://192.168.2.59:8292',
//   // ip: 'http://192.168.1.129:8392',
//   // ip: 'http://192.168.1.129:8292',
//   ip: 'http://192.168.1.165:8292',
//   // ip: 'http://192.168.2.3:8292',
//   dev: 'https://dj.dev.glsx.com.cn',
//   uat: 'https://dj.test.glsx.com.cn',
//   // uat: 'https://dj.beta.glsx.com.cn',
//   prod: 'https://dj.glsx.com.cn',
//   preRelease: 'https://dj.beta.glsx.com.cn'
// }
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
// console.log(domain_items[target[index]]);
module.exports = {
  domain: domain_items[target[index]],
  secretKey: secretKey_items[target[index]],
  scrmSecretKey: scrmSecretKey_items[target[index]]
}