Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6d47207d
authored
Mar 20, 2023
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
环境变量配置重构
1 parent
276bb2a7
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
130 additions
and
305 deletions
api/environment.js
app.js
config.js
packageEquity/pages/carQuotation/CarQuotationPay/CarQuotationPay.js
packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js
packageEquity/pages/carQuotation/schemeConfirmation/schemeConfirmation.js
tabIndex/pages/index/index.js
utils/cache/storage.js
utils/constantData.js
utils/request/environment.js
utils/request/request.js
utils/sentryConfig/sentryInit.js
api/environment.js
deleted
100644 → 0
View file @
276bb2a
/**
*
0本地
1开发
2测试
3生产环境
*/
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
systemInfo
=
wx
.
getSystemInfoSync
()
// console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion)
//手动控制体验版环境的请求 true就依据下面index false就默认为2
const
manual
=
false
const
release
=
false
let
index
=
1
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
// trial:体验版
// release:正式版
// console.log( systemInfo.platform);
// console.log(accountInfo.miniProgram.envVersion);
if
(
systemInfo
.
platform
!=
'devtools'
)
{
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
}
}
// console.log(index);
const
secretKey_items
=
{
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_items
=
{
// ip: 'http://192.168.2.59:8292',
// ip: 'http://192.168.1.129:8392',
// ip: 'http://192.168.1.129:8292',
ip
:
'http://192.168.1.165:8292'
,
// ip: 'http://192.168.2.3:8292',
dev
:
'https://dj.dev.glsx.com.cn'
,
uat
:
'https://dj.test.glsx.com.cn'
,
// uat: 'https://dj.beta.glsx.com.cn',
prod
:
'https://dj.glsx.com.cn'
,
preRelease
:
'https://dj.beta.glsx.com.cn'
}
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
// console.log(domain_items[target[index]]);
module
.
exports
=
{
domain
:
domain_items
[
target
[
index
]],
secretKey
:
secretKey_items
[
target
[
index
]]
}
app.js
View file @
6d47207
...
...
@@ -10,7 +10,7 @@ import util from './utils/util.js'
import
{
Storage
}
from
'~/utils/cache/storage'
const
$Storage
=
new
Storage
()
import
{
setSystem_info
}
from
'~/utils/cache/storageApi'
// const accountInfo = wx.getAccountInfoSync()
import
{
checkYqdSuper
,
setConfigInfo
,
checkScene
}
from
'~/store/index'
import
eventbus
from
'./utils/eventbus'
App
({
...
...
config.js
View file @
6d47207
...
...
@@ -10,7 +10,44 @@
* 2测试
* 3生产环境
*/
export
let
env
=
2
let
index
=
2
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
systemInfo
=
wx
.
getSystemInfoSync
()
const
envName
=
accountInfo
.
miniProgram
.
envVersion
//手动控制体验版环境的请求 true就依据下面index false就默认为2
const
manual
=
false
const
release
=
false
// 判断小程序环境
// develop:开发版 trial:体验版 release:正式版
if
(
systemInfo
.
platform
!=
'devtools'
)
{
switch
(
envName
)
{
case
'develop'
:
break
case
'trial'
:
index
=
manual
?
index
:
2
break
case
'release'
:
index
=
release
?
index
:
3
break
default
:
index
=
3
break
}
}
export
const
env
=
envName
export
const
envIndex
=
index
const
createQuotedUrl
=
{
develop
:
`http://192.168.1.178:9528/dj-scrm-wx-work-main-zhangls/#/equityPoster?id=`
,
trial
:
`http://frontend.test.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=`
,
release
:
`https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=`
}
const
target
=
[
'ip'
,
'develop'
,
'trial'
,
'release'
,
'preRelease'
]
// 报价单图片地址
export
const
quotedImgUrl
=
createQuotedUrl
[
target
[
envIndex
]]
// 配置预发布的小程序aapId
// export const preReleaseAppId = 'wx24ebae5768e74138'
...
...
packageEquity/pages/carQuotation/CarQuotationPay/CarQuotationPay.js
View file @
6d47207
...
...
@@ -13,7 +13,6 @@ Page({
},
// 生成小程序码
createWxQrcode
()
{
const
accountInfo
=
wx
.
getAccountInfoSync
()
let
_this
=
this
let
oParams
=
{}
oParams
.
appId
=
'wx06d1198e751435d1'
...
...
@@ -21,7 +20,6 @@ Page({
oParams
.
path
=
'packagesPayment/pages/payment/index'
oParams
.
scene
=
`orderCode=
${
_this
.
data
.
orderCode
}
&workWxSessionId=
${
wx
.
getStorageSync
(
'dj_boutique_sessionId'
)}
`
oParams
.
channelType
=
1
// oParams.env = accountInfo.miniProgram.envVersion
// B端小程序调用接口生成领券码时,传参userId用uuid,类型由int变string
createQrcodeImage
(
oParams
).
then
(
res
=>
{
console
.
log
(
res
.
data
)
...
...
packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js
View file @
6d47207
// packageEquity/pages/carEquity/serviceInfo/serviceInfo.js
import
{
getQuotationInfo
,
quotationAdd
,
updateQuotation
,
quotationGoods
,
getQuotationInfoById
,
quotationPicture
}
from
'../../../api'
import
{
quotedImgUrl
}
from
'~/config'
// console.log(quotedImgUrl, 'quotedImgUrl')
Page
({
/**
* 页面的初始数据
...
...
@@ -98,19 +100,11 @@ Page({
// quotationPicture
let
{
orderInfo
}
=
this
.
data
const
{
id
}
=
orderInfo
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
env
=
accountInfo
.
miniProgram
.
envVersion
console
.
log
(
env
)
wx
.
$util
.
showLoading
(
'加载中...'
)
const
createQuotedUrl
=
{
develop
:
`http://192.168.1.178:9528/dj-scrm-wx-work-main-zhangls/#/equityPoster?id=
${
id
}
`
,
trial
:
`http://frontend.test.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=
${
id
}
`
,
release
:
`https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=
${
id
}
`
}
const
quotedPriceUpdate
=
this
.
multipliedByHundred
(
orderInfo
?.
modifyEquityQuotation
?.
quotedPriceUpdate
)
quotationPicture
({
id
,
quotedPriceUpdate
,
createQuotedUrl
:
createQuotedUrl
[
env
]
})
quotationPicture
({
id
,
quotedPriceUpdate
,
createQuotedUrl
:
quotedImgUrl
+
id
})
.
then
(
result
=>
{
// debugger
wx
.
hideLoading
()
...
...
packageEquity/pages/carQuotation/schemeConfirmation/schemeConfirmation.js
View file @
6d47207
// packageEquity/pages/carQuotation/schemeConfirmation/schemeConfirmation.js
import
{
quotationPicture
,
updateOrderStatus
,
quotationGenerate
}
from
'../../../api'
import
{
quotedImgUrl
}
from
'~/config'
Page
({
/**
* 页面的初始数据
...
...
@@ -104,18 +105,7 @@ Page({
}
},
getQuotationPicture
(
id
)
{
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
env
=
accountInfo
.
miniProgram
.
envVersion
const
createQuotedUrl
=
{
// develop: `http://192.168.1.178:9528/dj-scrm-wx-work-main-zhangls/#/equityPoster?id=${id}`,
develop
:
`https://frontend.test.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=
${
id
}
`
,
trial
:
`https://frontend.test.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=
${
id
}
`
,
release
:
`https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=
${
id
}
`
}
console
.
log
(
env
)
// let createQuotedUrl =
console
.
log
(
createQuotedUrl
[
env
])
quotationPicture
({
id
,
createQuotedUrl
:
createQuotedUrl
[
env
]
})
quotationPicture
({
id
,
createQuotedUrl
:
quotedImgUrl
+
id
})
.
then
(
result
=>
{
console
.
log
(
'result'
,
result
)
// let {}
...
...
tabIndex/pages/index/index.js
View file @
6d47207
// tabIndex/pages/index/index.js
import
mixins
from
'./index_mixins'
import
api
from
'../../api.js'
import
{
getYQInfo
}
from
'~/store/index'
import
{
env
}
from
'~/config'
import
{
getYQInfo
}
from
'~/store/index'
const
app
=
getApp
()
let
time
=
null
Page
({
...
...
@@ -14,7 +13,8 @@ Page({
flag
:
true
,
...
mixins
.
data
,
navBarHeight
:
0
,
totalTableSum
:
[{
totalTableSum
:
[
{
name
:
'filmTimesTotalSum'
},
{
...
...
@@ -66,9 +66,7 @@ Page({
},
navigator
(
e
)
{
console
.
log
(
e
)
let
{
outTradeNo
}
=
e
.
detail
let
{
outTradeNo
}
=
e
.
detail
this
.
closeSwitchPopup
()
outTradeNo
&&
wx
.
$router
.
go
(
'tabWorkOrder.additionRecordOrder'
,
{
...
...
@@ -76,12 +74,8 @@ Page({
})
},
remarkConfirm
(
e
)
{
let
{
methodUpdateInfo
}
=
this
.
data
let
{
detail
:
filmTimes
}
=
e
let
{
methodUpdateInfo
}
=
this
.
data
let
{
detail
:
filmTimes
}
=
e
methodUpdateInfo
.
filmTimes
=
filmTimes
api
.
updateCouponDayReport
(
methodUpdateInfo
)
...
...
@@ -105,16 +99,8 @@ Page({
})
},
changeTableData
(
e
)
{
let
{
startDate
,
maxDate
,
isYqdSuper
}
=
this
.
data
let
{
merchantId
,
filmTimes
,
merchantName
}
=
e
.
currentTarget
.
dataset
.
item
let
{
startDate
,
maxDate
,
isYqdSuper
}
=
this
.
data
let
{
merchantId
,
filmTimes
,
merchantName
}
=
e
.
currentTarget
.
dataset
.
item
// 不是管理员不开启这个权限
if
(
!
isYqdSuper
)
return
if
(
startDate
!=
maxDate
)
{
...
...
@@ -154,12 +140,8 @@ Page({
})
},
changePicker
(
e
)
{
let
{
value
}
=
e
.
detail
let
{
merchantId
}
=
this
.
data
.
merchantRange
[
value
]
let
{
value
}
=
e
.
detail
let
{
merchantId
}
=
this
.
data
.
merchantRange
[
value
]
// 修改对应下标显示
app
.
globalData
.
yqdInfo
.
subIndex
=
value
let
obj
=
{}
...
...
@@ -167,11 +149,7 @@ Page({
wx
.
$util
.
showLoading
(
'加载中...'
)
api
.
swtichSubLoginInfo
(
obj
).
then
(
res
=>
{
console
.
log
(
res
)
let
{
code
,
data
,
message
}
=
res
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
wx
.
$util
.
setUserInfo
(
data
)
this
.
init
(
data
)
...
...
@@ -182,13 +160,8 @@ Page({
this
.
tapPicker
()
},
jump
(
e
)
{
let
{
item
,
type
}
=
e
.
currentTarget
.
dataset
let
{
userInfo
}
=
this
.
data
let
{
item
,
type
}
=
e
.
currentTarget
.
dataset
let
{
userInfo
}
=
this
.
data
// 判断是不是门店员工
if
(
userInfo
.
merchantType
&&
!
userInfo
.
isSuper
&&
type
==
2
)
{
wx
.
$router
.
go
(
item
.
url
)
...
...
@@ -206,9 +179,7 @@ Page({
let
today
=
new
Date
()
let
startDate
=
today
.
format
(
'yyyy-MM-dd'
)
let
endDate
=
today
.
format
(
'yyyy-MM-dd'
)
let
{
tableBtn
}
=
this
.
data
let
{
tableBtn
}
=
this
.
data
this
.
setData
({
startDate
,
endDate
...
...
@@ -218,14 +189,9 @@ Page({
},
rangeSelect
(
e
)
{
// console.log(e)
let
{
tableBtn
}
=
this
.
data
let
{
tableBtn
}
=
this
.
data
let
{
date
:
{
start
,
end
}
date
:
{
start
,
end
}
}
=
e
.
detail
this
.
setData
({
startDate
:
start
,
...
...
@@ -246,14 +212,9 @@ Page({
})
},
changeTableSort
(
e
)
{
let
{
index
}
=
e
.
currentTarget
.
dataset
let
{
index
}
=
e
.
currentTarget
.
dataset
console
.
log
(
index
)
let
{
tableSort
,
tableObj
}
=
this
.
data
let
{
tableSort
,
tableObj
}
=
this
.
data
if
(
tableSort
==
index
)
{
tableObj
[
index
].
sort
=
!
tableObj
[
index
].
sort
}
else
{
...
...
@@ -266,14 +227,8 @@ Page({
this
.
sortTable
(
tableObj
)
},
sortTable
(
tableObj
)
{
let
{
tableSort
,
table
}
=
this
.
data
let
{
key
,
sort
}
=
tableObj
[
tableSort
]
let
{
tableSort
,
table
}
=
this
.
data
let
{
key
,
sort
}
=
tableObj
[
tableSort
]
const
objectArraySort
=
keyName
=>
{
return
(
objectN
,
objectM
)
=>
{
const
valueN
=
objectN
[
keyName
]
...
...
@@ -299,41 +254,32 @@ Page({
},
// 10s轮询一次待补录
getWaitOrder
()
{
let
{
isStaff
}
=
this
.
data
let
{
isStaff
}
=
this
.
data
// console.log('isStaff', isStaff)
let
thisPage
=
wx
.
$router
.
getPageInstance
()
console
.
log
(
thisPage
.
route
,
' thisPage.route'
)
thisPage
.
route
==
'tabIndex/pages/index/index'
&&
isStaff
&&
api
.
waitinputorder
()
.
then
(
result
=>
{
// console.log(result)
let
{
code
,
data
}
=
result
this
.
setTime
()
if
(
code
==
0
)
{
this
.
setData
({
waitInputCount
:
data
.
waitInputCount
})
}
})
.
catch
(
err
=>
{})
.
waitinputorder
()
.
then
(
result
=>
{
// console.log(result)
let
{
code
,
data
}
=
result
this
.
setTime
()
if
(
code
==
0
)
{
this
.
setData
({
waitInputCount
:
data
.
waitInputCount
})
}
})
.
catch
(
err
=>
{})
},
getPageData
()
{
api
.
getHomeReport
().
then
(
res
=>
{
wx
.
$util
.
hideLoading
()
console
.
log
(
res
)
let
{
code
,
data
,
message
}
=
res
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
this
.
setData
({
report
:
data
...
...
@@ -348,15 +294,7 @@ Page({
this
.
getMerchantCouponList
()
},
getMerchantCouponList
()
{
let
{
orderByTypeEnum
,
tableSort
,
tableObj
,
startDate
,
endDate
,
totalTableSum
,
tableWidth
}
=
this
.
data
let
{
orderByTypeEnum
,
tableSort
,
tableObj
,
startDate
,
endDate
,
totalTableSum
,
tableWidth
}
=
this
.
data
let
target
=
tableObj
[
tableSort
].
sort
let
orderByType
=
orderByTypeEnum
[
target
][
tableSort
]
api
...
...
@@ -367,11 +305,7 @@ Page({
})
.
then
(
res
=>
{
console
.
log
(
res
)
let
{
code
,
message
,
data
}
=
res
let
{
code
,
message
,
data
}
=
res
let
table
=
[]
if
(
code
==
0
)
{
table
=
data
?
data
.
page
?.
list
:
[]
...
...
@@ -415,16 +349,14 @@ Page({
}
},
init
(
userInfo
)
{
getYQInfo
(
userInfo
)
.
then
(
result
=>
{
console
.
log
(
result
)
// console.log(app.globalData.isYqdSuper)
this
.
getPageData
()
this
.
setData
({
...
result
})
getYQInfo
(
userInfo
).
then
(
result
=>
{
console
.
log
(
result
)
// console.log(app.globalData.isYqdSuper)
this
.
getPageData
()
this
.
setData
({
...
result
})
})
},
checkShowOrderPop
(
options
)
{
let
userInfo
=
wx
.
$util
.
getStorageSync
(
'dj_boutique_user_info'
)
...
...
@@ -467,9 +399,9 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady
:
function
()
{
const
accountInfo
=
wx
.
getAccountInfoSync
()
//
const accountInfo = wx.getAccountInfoSync()
let
checklist
=
[]
switch
(
accountInfo
.
miniProgram
.
envVersion
)
{
switch
(
env
)
{
case
'develop'
:
checklist
=
[]
break
...
...
@@ -485,10 +417,7 @@ Page({
break
}
// 判断是不是特殊账号
let
{
menu
,
userInfo
}
=
this
.
data
let
{
menu
,
userInfo
}
=
this
.
data
if
(
checklist
.
includes
(
userInfo
?.
accountName
))
{
menu
=
menu
.
filter
(
e
=>
e
.
name
!=
'预约管理'
)
this
.
setData
({
...
...
@@ -507,9 +436,7 @@ Page({
// 如果是员工 开启订单补录轮询
this
.
getWaitOrder
()
if
(
userInfo
)
{
let
{
userInfo
:
newUserInfo
}
=
this
.
data
let
{
userInfo
:
newUserInfo
}
=
this
.
data
// console.log(newUserInfo)
if
(
newUserInfo
)
{
let
isChangeLogin
=
newUserInfo
.
subLoginUser
.
merchantId
!=
userInfo
.
subLoginUser
.
merchantId
...
...
@@ -551,4 +478,4 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage
:
function
()
{}
})
\ No newline at end of file
})
utils/cache/storage.js
View file @
6d47207
...
...
@@ -3,23 +3,23 @@
*/
import
{
DEFAULT_GET_STORAGEKEY
,
STORAGE_OBJECTkEY
}
from
'~/utils/constantData'
import
{
env
}
from
'~/config'
class
Storage
{
types
=
{
1
:
'get'
,
// get
2
:
'set'
,
// set
3
:
'rm'
// rm
}
envVersion
=
{
develop
:
'开发版'
,
trial
:
'体验版'
,
release
:
'正式版'
}
//
envVersion = {
//
develop: '开发版',
//
trial: '体验版',
//
release: '正式版'
//
}
// defaultGetStorageKey = DEFAULT_GET_STORAGEKEY
/** 构造函数 */
constructor
()
{
/** 获取当前小程序环境变量 */
const
accountInfo
=
wx
.
getAccountInfoSync
()
this
.
environment
=
accountInfo
?.
miniProgram
.
envVersion
||
'release'
this
.
environment
=
env
||
'release'
}
/**
...
...
utils/constantData.js
View file @
6d47207
...
...
@@ -17,10 +17,10 @@ export const STORAGE_OBJECTkEY = {
authphone
:
'authphone'
,
disLikeRecordFlag
:
'disLikeRecordFlag'
,
fileList
:
'fileList'
,
posterId
:
'posterId'
,
posterId
:
'posterId'
}
export
const
IMG_VERSION
=
()
=>
{
const
accountInfo
=
wx
.
getAccountInfoSync
()
return
accountInfo
.
miniProgram
.
version
||
'1.0.0'
}
//
export const IMG_VERSION = () => {
//
const accountInfo = wx.getAccountInfoSync()
//
return accountInfo.miniProgram.version || '1.0.0'
//
}
utils/request/environment.js
View file @
6d47207
import
{
env
}
from
'~/config'
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
systemInfo
=
wx
.
getSystemInfoSync
()
// console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion)
import
{
envIndex
}
from
'~/config'
//手动控制体验版环境的请求 true就依据下面index false就默认为2
const
manual
=
false
const
release
=
false
// console.log(envIndex, 'envIndex')
let
index
=
env
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
// trial:体验版
// release:正式版
// console.log( systemInfo.platform);
// console.log(accountInfo.miniProgram.envVersion);
if
(
systemInfo
.
platform
!=
'devtools'
)
{
switch
(
accountInfo
.
miniProgram
.
envVersion
)
{
case
'develop'
:
break
case
'trial'
:
index
=
manual
?
index
:
2
break
case
'release'
:
index
=
release
?
index
:
3
break
default
:
index
=
3
break
}
}
// console.log(index);
const
secretKey_items
=
{
ip
:
{
appKey
:
'48e5e13229b82c1b4e6e8c96151f0637'
,
...
...
@@ -100,22 +69,13 @@ const domain_items = {
scrm
:
'https://scrm.beta.glsx.com.cn'
}
}
// const domain_items = {
// // ip: 'http://192.168.2.59:8292',
// // ip: 'http://192.168.1.129:8392',
// // ip: 'http://192.168.1.129:8292',
// ip: 'http://192.168.1.165:8292',
// // ip: 'http://192.168.2.3:8292',
// dev: 'https://dj.dev.glsx.com.cn',
// uat: 'https://dj.test.glsx.com.cn',
// // uat: 'https://dj.beta.glsx.com.cn',
// prod: 'https://dj.glsx.com.cn',
// preRelease: 'https://dj.beta.glsx.com.cn'
// }
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
// console.log(domain_items[target[index]]);
module
.
exports
=
{
domain
:
domain_items
[
target
[
index
]],
secretKey
:
secretKey_items
[
target
[
index
]],
scrmSecretKey
:
scrmSecretKey_items
[
target
[
index
]]
domain
:
domain_items
[
target
[
envIndex
]],
secretKey
:
{
dj
:
secretKey_items
[
target
[
envIndex
]],
scrm
:
scrmSecretKey_items
[
target
[
envIndex
]]
}
}
utils/request/request.js
View file @
6d47207
import
{
secretKey
,
domain
,
path
,
sign
,
scrmSecretKey
}
from
'./http.js'
import
{
secretKey
,
domain
,
path
,
sign
,
scrmSecretKey
}
from
'./http.js'
import
util
from
'~/utils/util.js'
/**接口 */
class
Request
{
...
...
@@ -94,22 +94,24 @@ class Request {
getData
(
data
,
method
,
noSignAttr
)
{
let
sessionId
=
util
.
getSessionId
()
if
(
sessionId
)
data
[
'sessionId'
]
=
sessionId
console
.
log
(
data
,
'request'
);
//
console.log(data,'request');
data
[
'v'
]
=
'1.0.0'
data
[
'method'
]
=
method
data
[
'format'
]
=
'json'
data
[
'locale'
]
=
'zh_CN'
data
[
'source'
]
=
'dj-wechat'
// 兼容线上appkey和secret不一样的情况
let
djapi
=
data
.
method
.
includes
(
'dj.api'
)
let
scmrapi
=
data
.
method
.
includes
(
'scrm.api'
)
console
.
log
(
scmrapi
,
'scmrapi'
);
const
appKey
=
scmrapi
?
scrmSecretKey
.
appKey
:
djapi
?
secretKey
.
appKey
:
''
const
secret
=
scmrapi
?
scrmSecretKey
.
secret
:
djapi
?
secretKey
.
secret
:
''
// 兼容线上
dj和scrm
appkey和secret不一样的情况
const
apiName
=
data
.
method
.
split
(
'.api'
)[
0
]
// 为空报错
if
(
!
apiName
)
{
throw
new
Error
(
'apiName is null'
)
}
data
[
'appKey'
]
=
appKey
const
appKey
=
secretKey
[
apiName
].
appKey
const
secret
=
secretKey
[
apiName
].
secret
data
[
'appKey'
]
=
appKey
let
obj
=
sign
(
data
,
secret
,
noSignAttr
)
//data['sign'] = obj.sign;
...
...
utils/sentryConfig/sentryInit.js
View file @
6d47207
import
{
dsnUrl
}
from
'~/config'
import
*
as
Sentry
from
'~/utils/lib/sentry-miniapp'
import
{
env
}
from
'~/config'
// console.log(env, 'env')
export
default
function
sentryInit
()
{
// accountInfo.miniProgram.envVersion == 'release' &&
const
accountInfo
=
wx
.
getAccountInfoSync
()
//测试和生产才开发sentry
const
env
=
[
'trial'
,
'release'
]
env
.
includes
(
accountInfo
.
miniProgram
.
envVersion
)
&&
//测试和生产才开启sentry
const
envNameList
=
[
'trial'
,
'release'
]
envNameList
.
includes
(
env
)
&&
Sentry
.
init
({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn
:
dsnUrl
})
}
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