/*
 * @Descripttion: HJ
 * @Company: 思宏科技
 * @version: v1.0
 * @Author: HJ
 * @Date: 2021-02-25 16:25:56
 * @LastEditors: WorkerChen z874512298@163.com
 * @LastEditTime: 2022-05-18 17:03:13
 */

/**
 * 使用注意事项，需要在app.js的最前面引用
 * 在任意js中使用 wx.$env 就可以拿到相应的环境变量
 * baseUrl {string} 请求的地址
 * mapKey {string} 地图的key
 * statisticsKey {string} 统计的key
 * notifyConfig {Object} 订阅消息的id
 */
const {
  miniProgram: { appId, envVersion }
} = wx.getAccountInfoSync()

const _DEV_APPID = 'wxbd88273b028bd83d'
const _PROD_APPID = 'wxbd88273b028bd83d'

const prodBaseURL = {
  trial: 'ybm-stress.thinkmacro.cn'
}

// 开发
const dev = {
  appId,
  env: 'dev',
  baseUrl: 'https://ybm-dev.thinkmacro.cn',
  commonUrl: 'https://common-dev.thinkmacro.cn',
  // baseUrl: "http://192.168.0.108:8089",
  mapKey: 'e70024fc157c30072966dd2d838bcb97',
  tentMapKey: 'E3UBZ-PFDWW-4BFRY-OP7CE-WLN56-SJFNM',
  anaOptions: {
    appID: '500727605',
    eventID: '500727609'
  },
  umengKey: '604358576ee47d382b74805f',
  notifyConfig: {
    ZITI: [
      'jq-Y7z4-uGJS5134FlLsEPCXsSj2mT4BmYf24vzoawE',
      'Tjt_nVrQtRFx2D9jbK63AvR4L0VDumbWy9I3h9R4Pn8'
    ],
    WAIMAI: [
      'jq-Y7z4-uGJS5134FlLsEPCXsSj2mT4BmYf24vzoawE',
      'avAdhxrVRIMd5mjr6ufXasYDbOZELN-mYpnTBfGvIN8'
    ],
    COUPON: ['V5V2JyWwXSs8cJn1lRHazGqwbgA2kCsjJQa6OXeSclg']
  }
}
// 生产
const prod = {
  appId,
  env: 'prod',
  // 暂时注释,膳食预订baseUrl出错,先用着dev环境
  // baseUrl: prodBaseURL[envVersion] || 'https://service.iyibianmin.com',
  // baseUrl: prodBaseURL[envVersion] || 'https://ybm-dev.thinkmacro.cn',
  baseUrl: 'https://service.iyibianmin.com',
  mapKey: 'e70024fc157c30072966dd2d838bcb97',
  tentMapKey: 'BMNBZ-WRBKU-5VPVM-2I4SW-CPWSE-U4FCT',
  anaOptions: {
    appID: '500727605',
    eventID: '500727609'
  },
  umengKey: '600e21b66a2a470e8f883483',
  notifyConfig: {
    ZITI: [
      '_BsBEKosdNPAKORvZtnMiLJJeUouwia9SQyQeX99phY',
      'Qg8bvs2IdKdsTFnTyTHOmfNc4YXvuLgdizeQ_TT8jUs'
    ],
    WAIMAI: [
      '_BsBEKosdNPAKORvZtnMiLJJeUouwia9SQyQeX99phY',
      'qUQXm3AqMec2ccB_fNf3laKdkjtCbzqeM0u3DYYvUPw'
    ],
    COUPON: ['Fr1uKbXDA-NJz26pAyKME2SD74Lq7hKEFuemL4NzSVI']
  }
}

// appId 环境变量map
const envConfig = new Map([
  [_DEV_APPID, dev],
  [_PROD_APPID, prod]
])
// 环境变量名称 map
const envNameConfig = new Map([
  ['dev', dev],
  ['prod', prod]
])

let config = __wxConfig.envVersion === 'release' ? prod : dev


console.log(config, 1323)

wx.$env = config

export default envNameConfig
