Commit 6fc83e12 by chenwq

接口封装

1 parent d7ce05b4
......@@ -81,16 +81,51 @@ const secretKey = {
}
}[target[index]]
const djsecretKey = {
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 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'
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'
}
}[target[index]]
const pathEnum = {
......@@ -129,6 +164,7 @@ module.exports = {
domain,
pathEnum,
secretKey,
djsecretKey,
defaultMerchantId,
mockUrl
}
......@@ -23,7 +23,9 @@ class Request {
let projectName = params.apiProjectName || this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method)
let path = pathEnum[projectName]
if (!path) path = requestPath == 'scrm' ? `/rop-scrm-${projectName}/` : `/rop-dj-${projectName}/`
if (!path) {
path = requestPath == 'dj' ? `/rop-dj-${projectName}/` : `/rop-scrm-${projectName}/`
}
params = this.getData(params, requestPath)
wx.request({
url: `${domain[requestPath]}${path}router?method=${params.method}`,
......@@ -92,7 +94,7 @@ class Request {
appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret
}
if(requestPath == 'dj') {
if (requestPath == 'dj') {
appKey = djSecretKey.appKey
secret = djSecretKey.secret
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!