Commit 6fc83e12 by chenwq

接口封装

1 parent d7ce05b4
...@@ -81,16 +81,51 @@ const secretKey = { ...@@ -81,16 +81,51 @@ const secretKey = {
} }
}[target[index]] }[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 = { const domain = {
// ip: 'http://192.168.2.94:8558', ip: {
// ip: 'http://192.168.2.3:8315', // dj: 'http://192.168.1.165:8292',
ip: 'http://192.168.1.170:8315', dj: 'http://192.168.1.170:8292',
/**登录: 192.168.2.3:8315 scrm: 'http://192.168.1.165:8292'
商城: 192.168.2.3:8558 */ },
dev: 'https://scrm.dev.glsx.com.cn', dev: {
uat: 'https://scrm.test.glsx.com.cn', dj: 'https://dj.dev.glsx.com.cn',
preRelease: 'https://scrm.beta.glsx.com.cn', scrm: 'https://scrm.dev.glsx.com.cn'
prod: 'https://scrm.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]] }[target[index]]
const pathEnum = { const pathEnum = {
...@@ -129,6 +164,7 @@ module.exports = { ...@@ -129,6 +164,7 @@ module.exports = {
domain, domain,
pathEnum, pathEnum,
secretKey, secretKey,
djsecretKey,
defaultMerchantId, defaultMerchantId,
mockUrl mockUrl
} }
...@@ -23,7 +23,9 @@ class Request { ...@@ -23,7 +23,9 @@ class Request {
let projectName = params.apiProjectName || this.getRopProject(params.method) let projectName = params.apiProjectName || this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
let path = pathEnum[projectName] 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) params = this.getData(params, requestPath)
wx.request({ wx.request({
url: `${domain[requestPath]}${path}router?method=${params.method}`, url: `${domain[requestPath]}${path}router?method=${params.method}`,
...@@ -92,7 +94,7 @@ class Request { ...@@ -92,7 +94,7 @@ class Request {
appKey = secretKey[projectName].appKey appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret secret = secretKey[projectName].secret
} }
if(requestPath == 'dj') { if (requestPath == 'dj') {
appKey = djSecretKey.appKey appKey = djSecretKey.appKey
secret = djSecretKey.secret secret = djSecretKey.secret
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!