index.js
4.56 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import {
preReleaseAppId
} from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 3
/**
*
0本地
1开发
2测试
3生产
4预发布
*/
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
// console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion)
//手动控制体验版环境的请求 true就依据下面index false就默认为2
const manual = true
const release = false
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
// trial:体验版
// release:正式版
// console.log( systemInfo.platform);
// console.log(accountInfo.miniProgram.envVersion);
// 对比一下appkey
// console.log();
if (systemInfo.platform != 'devtools') {
// 判断预发布的appid 是强制锁定为4(预发布的地址)
if (accountInfo.miniProgram.appId == preReleaseAppId) {
index = 4
} else {
switch (accountInfo.miniProgram.envVersion) {
case 'develop':
// this.globalData.url = 'http://192.168.0.252:3000/api'; //
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3
break
}
}
}
const secretKey = {
ip: {},
dev: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
uat: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
prod: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
preRelease: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
}
} [target[index]]
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: 'http://192.168.1.170:8315',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn',
uat: 'https://scrm.test.glsx.com.cn',
preRelease: 'https://scrm.beta.glsx.com.cn',
prod: 'https://scrm.glsx.com.cn'
} [target[index]]
const djDomain = {
ip: 'https://dj.dev.glsx.com.cn',
dev: 'https://dj.dev.glsx.com.cn',
preRelease: 'https://dj.beta.glsx.com.cn',
uat: 'https://dj.test.glsx.com.cn',
prod: 'https://dj.glsx.com.cn',
} [target[index]]
const djSecretKey = {
ip: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
dev: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
uat: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
preRelease: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
prod: {
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
},
pet: {
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
}
} [target[index]]
const gscDomain = {
ip: 'http://192.168.3.145:9898',
dev: 'https://gsc-agent.dev.glsx.com.cn',
uat: 'https://gsc-agent.test.glsx.com.cn',
preRelease: 'https://gsc-agent.beta.glsx.com.cn',
prod: 'https://gsc-agent.gldijia.com.cn'
} [target[index]]
const pathEnum = {
sso: '/rop-scrm-sso/',
shopmall: '/rop-scrm-shopmall/',
coupon: '/rop-scrm-coupon/',
carlife: '/rop-scrm-carlife/',
live: '/rop-scrm-live/',
equity: '/rop-scrm-equity/',
entmicro: '/rop-scrm-entmicro/',
wechat: '/rop-scrm-wechat/',
boutiquecoupon: '/rop-scrm-boutiquecoupon/',
material: '/rop-scrm-marketing/', //素材
sop: '/rop-scrm-sop/',
customercollect: '/rop-scrm-bigdatautil/',
drac: '/rop-scrm-entmicro/',
busassistant: '/rop-scrm-busassistant/',
pad: '/rop-dj-pad/',
}
const defaultMerchantId = {
ip: '44211227',
dev: '44211227',
uat: '44210895',
prod: '44208317',
preRelease: '44211283'
} [target[index]]
const CONFIG_ENV_MAP = {
'1': 'develope',
'2': 'test',
'3': 'production',
'4': 'beta'
}
module.exports = {
index,
domain,
pathEnum,
secretKey,
defaultMerchantId,
env: CONFIG_ENV_MAP[index],
gscDomain,
djSecretKey,
djDomain
}