Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6fc83e12
authored
Mar 31, 2023
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
接口封装
1 parent
d7ce05b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
11 deletions
utils/request/environment.js
utils/request/request.js
utils/request/environment.js
View file @
6fc83e1
...
@@ -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
}
}
utils/request/request.js
View file @
6fc83e1
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment