Commit 6d47207d by 张立顺

环境变量配置重构

1 parent 276bb2a7
/**
*
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]]
}
...@@ -10,7 +10,7 @@ import util from './utils/util.js' ...@@ -10,7 +10,7 @@ import util from './utils/util.js'
import { Storage } from '~/utils/cache/storage' import { Storage } from '~/utils/cache/storage'
const $Storage = new Storage() const $Storage = new Storage()
import { setSystem_info } from '~/utils/cache/storageApi' import { setSystem_info } from '~/utils/cache/storageApi'
// const accountInfo = wx.getAccountInfoSync()
import { checkYqdSuper, setConfigInfo, checkScene } from '~/store/index' import { checkYqdSuper, setConfigInfo, checkScene } from '~/store/index'
import eventbus from './utils/eventbus' import eventbus from './utils/eventbus'
App({ App({
......
...@@ -10,7 +10,44 @@ ...@@ -10,7 +10,44 @@
* 2测试 * 2测试
* 3生产环境 * 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 // 配置预发布的小程序aapId
// export const preReleaseAppId = 'wx24ebae5768e74138' // export const preReleaseAppId = 'wx24ebae5768e74138'
......
...@@ -13,7 +13,6 @@ Page({ ...@@ -13,7 +13,6 @@ Page({
}, },
// 生成小程序码 // 生成小程序码
createWxQrcode() { createWxQrcode() {
const accountInfo = wx.getAccountInfoSync()
let _this = this let _this = this
let oParams = {} let oParams = {}
oParams.appId = 'wx06d1198e751435d1' oParams.appId = 'wx06d1198e751435d1'
...@@ -21,7 +20,6 @@ Page({ ...@@ -21,7 +20,6 @@ Page({
oParams.path = 'packagesPayment/pages/payment/index' oParams.path = 'packagesPayment/pages/payment/index'
oParams.scene = `orderCode=${_this.data.orderCode}&workWxSessionId=${wx.getStorageSync('dj_boutique_sessionId')}` oParams.scene = `orderCode=${_this.data.orderCode}&workWxSessionId=${wx.getStorageSync('dj_boutique_sessionId')}`
oParams.channelType = 1 oParams.channelType = 1
// oParams.env = accountInfo.miniProgram.envVersion
// B端小程序调用接口生成领券码时,传参userId用uuid,类型由int变string // B端小程序调用接口生成领券码时,传参userId用uuid,类型由int变string
createQrcodeImage(oParams).then(res => { createQrcodeImage(oParams).then(res => {
console.log(res.data) console.log(res.data)
......
// packageEquity/pages/carEquity/serviceInfo/serviceInfo.js // packageEquity/pages/carEquity/serviceInfo/serviceInfo.js
import { getQuotationInfo, quotationAdd, updateQuotation, quotationGoods, getQuotationInfoById, quotationPicture } from '../../../api' import { getQuotationInfo, quotationAdd, updateQuotation, quotationGoods, getQuotationInfoById, quotationPicture } from '../../../api'
import { quotedImgUrl } from '~/config'
// console.log(quotedImgUrl, 'quotedImgUrl')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -98,19 +100,11 @@ Page({ ...@@ -98,19 +100,11 @@ Page({
// quotationPicture // quotationPicture
let { orderInfo } = this.data let { orderInfo } = this.data
const { id } = orderInfo const { id } = orderInfo
const accountInfo = wx.getAccountInfoSync()
const env = accountInfo.miniProgram.envVersion
console.log(env)
wx.$util.showLoading('加载中...') 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) const quotedPriceUpdate = this.multipliedByHundred(orderInfo?.modifyEquityQuotation?.quotedPriceUpdate)
quotationPicture({ id, quotedPriceUpdate, createQuotedUrl: createQuotedUrl[env] }) quotationPicture({ id, quotedPriceUpdate, createQuotedUrl: quotedImgUrl + id })
.then(result => { .then(result => {
// debugger // debugger
wx.hideLoading() wx.hideLoading()
......
// packageEquity/pages/carQuotation/schemeConfirmation/schemeConfirmation.js // packageEquity/pages/carQuotation/schemeConfirmation/schemeConfirmation.js
import { quotationPicture, updateOrderStatus, quotationGenerate } from '../../../api' import { quotationPicture, updateOrderStatus, quotationGenerate } from '../../../api'
import { quotedImgUrl } from '~/config'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -104,18 +105,7 @@ Page({ ...@@ -104,18 +105,7 @@ Page({
} }
}, },
getQuotationPicture(id) { getQuotationPicture(id) {
const accountInfo = wx.getAccountInfoSync() quotationPicture({ id, createQuotedUrl: quotedImgUrl + id })
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] })
.then(result => { .then(result => {
console.log('result', result) console.log('result', result)
// let {} // let {}
......
// tabIndex/pages/index/index.js // tabIndex/pages/index/index.js
import mixins from './index_mixins' import mixins from './index_mixins'
import api from '../../api.js' import api from '../../api.js'
import { import { env } from '~/config'
getYQInfo import { getYQInfo } from '~/store/index'
} from '~/store/index'
const app = getApp() const app = getApp()
let time = null let time = null
Page({ Page({
...@@ -14,7 +13,8 @@ Page({ ...@@ -14,7 +13,8 @@ Page({
flag: true, flag: true,
...mixins.data, ...mixins.data,
navBarHeight: 0, navBarHeight: 0,
totalTableSum: [{ totalTableSum: [
{
name: 'filmTimesTotalSum' name: 'filmTimesTotalSum'
}, },
{ {
...@@ -66,9 +66,7 @@ Page({ ...@@ -66,9 +66,7 @@ Page({
}, },
navigator(e) { navigator(e) {
console.log(e) console.log(e)
let { let { outTradeNo } = e.detail
outTradeNo
} = e.detail
this.closeSwitchPopup() this.closeSwitchPopup()
outTradeNo && outTradeNo &&
wx.$router.go('tabWorkOrder.additionRecordOrder', { wx.$router.go('tabWorkOrder.additionRecordOrder', {
...@@ -76,12 +74,8 @@ Page({ ...@@ -76,12 +74,8 @@ Page({
}) })
}, },
remarkConfirm(e) { remarkConfirm(e) {
let { let { methodUpdateInfo } = this.data
methodUpdateInfo let { detail: filmTimes } = e
} = this.data
let {
detail: filmTimes
} = e
methodUpdateInfo.filmTimes = filmTimes methodUpdateInfo.filmTimes = filmTimes
api api
.updateCouponDayReport(methodUpdateInfo) .updateCouponDayReport(methodUpdateInfo)
...@@ -105,16 +99,8 @@ Page({ ...@@ -105,16 +99,8 @@ Page({
}) })
}, },
changeTableData(e) { changeTableData(e) {
let { let { startDate, maxDate, isYqdSuper } = this.data
startDate, let { merchantId, filmTimes, merchantName } = e.currentTarget.dataset.item
maxDate,
isYqdSuper
} = this.data
let {
merchantId,
filmTimes,
merchantName
} = e.currentTarget.dataset.item
// 不是管理员不开启这个权限 // 不是管理员不开启这个权限
if (!isYqdSuper) return if (!isYqdSuper) return
if (startDate != maxDate) { if (startDate != maxDate) {
...@@ -154,12 +140,8 @@ Page({ ...@@ -154,12 +140,8 @@ Page({
}) })
}, },
changePicker(e) { changePicker(e) {
let { let { value } = e.detail
value let { merchantId } = this.data.merchantRange[value]
} = e.detail
let {
merchantId
} = this.data.merchantRange[value]
// 修改对应下标显示 // 修改对应下标显示
app.globalData.yqdInfo.subIndex = value app.globalData.yqdInfo.subIndex = value
let obj = {} let obj = {}
...@@ -167,11 +149,7 @@ Page({ ...@@ -167,11 +149,7 @@ Page({
wx.$util.showLoading('加载中...') wx.$util.showLoading('加载中...')
api.swtichSubLoginInfo(obj).then(res => { api.swtichSubLoginInfo(obj).then(res => {
console.log(res) console.log(res)
let { let { code, data, message } = res
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
wx.$util.setUserInfo(data) wx.$util.setUserInfo(data)
this.init(data) this.init(data)
...@@ -182,13 +160,8 @@ Page({ ...@@ -182,13 +160,8 @@ Page({
this.tapPicker() this.tapPicker()
}, },
jump(e) { jump(e) {
let { let { item, type } = e.currentTarget.dataset
item, let { userInfo } = this.data
type
} = e.currentTarget.dataset
let {
userInfo
} = this.data
// 判断是不是门店员工 // 判断是不是门店员工
if (userInfo.merchantType && !userInfo.isSuper && type == 2) { if (userInfo.merchantType && !userInfo.isSuper && type == 2) {
wx.$router.go(item.url) wx.$router.go(item.url)
...@@ -206,9 +179,7 @@ Page({ ...@@ -206,9 +179,7 @@ Page({
let today = new Date() let today = new Date()
let startDate = today.format('yyyy-MM-dd') let startDate = today.format('yyyy-MM-dd')
let endDate = today.format('yyyy-MM-dd') let endDate = today.format('yyyy-MM-dd')
let { let { tableBtn } = this.data
tableBtn
} = this.data
this.setData({ this.setData({
startDate, startDate,
endDate endDate
...@@ -218,14 +189,9 @@ Page({ ...@@ -218,14 +189,9 @@ Page({
}, },
rangeSelect(e) { rangeSelect(e) {
// console.log(e) // console.log(e)
let { tableBtn } = this.data
let { let {
tableBtn date: { start, end }
} = this.data
let {
date: {
start,
end
}
} = e.detail } = e.detail
this.setData({ this.setData({
startDate: start, startDate: start,
...@@ -246,14 +212,9 @@ Page({ ...@@ -246,14 +212,9 @@ Page({
}) })
}, },
changeTableSort(e) { changeTableSort(e) {
let { let { index } = e.currentTarget.dataset
index
} = e.currentTarget.dataset
console.log(index) console.log(index)
let { let { tableSort, tableObj } = this.data
tableSort,
tableObj
} = this.data
if (tableSort == index) { if (tableSort == index) {
tableObj[index].sort = !tableObj[index].sort tableObj[index].sort = !tableObj[index].sort
} else { } else {
...@@ -266,14 +227,8 @@ Page({ ...@@ -266,14 +227,8 @@ Page({
this.sortTable(tableObj) this.sortTable(tableObj)
}, },
sortTable(tableObj) { sortTable(tableObj) {
let { let { tableSort, table } = this.data
tableSort, let { key, sort } = tableObj[tableSort]
table
} = this.data
let {
key,
sort
} = tableObj[tableSort]
const objectArraySort = keyName => { const objectArraySort = keyName => {
return (objectN, objectM) => { return (objectN, objectM) => {
const valueN = objectN[keyName] const valueN = objectN[keyName]
...@@ -299,9 +254,7 @@ Page({ ...@@ -299,9 +254,7 @@ Page({
}, },
// 10s轮询一次待补录 // 10s轮询一次待补录
getWaitOrder() { getWaitOrder() {
let { let { isStaff } = this.data
isStaff
} = this.data
// console.log('isStaff', isStaff) // console.log('isStaff', isStaff)
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
console.log(thisPage.route, ' thisPage.route') console.log(thisPage.route, ' thisPage.route')
...@@ -311,10 +264,7 @@ Page({ ...@@ -311,10 +264,7 @@ Page({
.waitinputorder() .waitinputorder()
.then(result => { .then(result => {
// console.log(result) // console.log(result)
let { let { code, data } = result
code,
data
} = result
this.setTime() this.setTime()
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
...@@ -329,11 +279,7 @@ Page({ ...@@ -329,11 +279,7 @@ Page({
api.getHomeReport().then(res => { api.getHomeReport().then(res => {
wx.$util.hideLoading() wx.$util.hideLoading()
console.log(res) console.log(res)
let { let { code, data, message } = res
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
report: data report: data
...@@ -348,15 +294,7 @@ Page({ ...@@ -348,15 +294,7 @@ Page({
this.getMerchantCouponList() this.getMerchantCouponList()
}, },
getMerchantCouponList() { getMerchantCouponList() {
let { let { orderByTypeEnum, tableSort, tableObj, startDate, endDate, totalTableSum, tableWidth } = this.data
orderByTypeEnum,
tableSort,
tableObj,
startDate,
endDate,
totalTableSum,
tableWidth
} = this.data
let target = tableObj[tableSort].sort let target = tableObj[tableSort].sort
let orderByType = orderByTypeEnum[target][tableSort] let orderByType = orderByTypeEnum[target][tableSort]
api api
...@@ -367,11 +305,7 @@ Page({ ...@@ -367,11 +305,7 @@ Page({
}) })
.then(res => { .then(res => {
console.log(res) console.log(res)
let { let { code, message, data } = res
code,
message,
data
} = res
let table = [] let table = []
if (code == 0) { if (code == 0) {
table = data ? data.page?.list : [] table = data ? data.page?.list : []
...@@ -415,8 +349,7 @@ Page({ ...@@ -415,8 +349,7 @@ Page({
} }
}, },
init(userInfo) { init(userInfo) {
getYQInfo(userInfo) getYQInfo(userInfo).then(result => {
.then(result => {
console.log(result) console.log(result)
// console.log(app.globalData.isYqdSuper) // console.log(app.globalData.isYqdSuper)
this.getPageData() this.getPageData()
...@@ -424,7 +357,6 @@ Page({ ...@@ -424,7 +357,6 @@ Page({
...result ...result
}) })
}) })
}, },
checkShowOrderPop(options) { checkShowOrderPop(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info') let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
...@@ -467,9 +399,9 @@ Page({ ...@@ -467,9 +399,9 @@ Page({
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function () {
const accountInfo = wx.getAccountInfoSync() // const accountInfo = wx.getAccountInfoSync()
let checklist = [] let checklist = []
switch (accountInfo.miniProgram.envVersion) { switch (env) {
case 'develop': case 'develop':
checklist = [] checklist = []
break break
...@@ -485,10 +417,7 @@ Page({ ...@@ -485,10 +417,7 @@ Page({
break break
} }
// 判断是不是特殊账号 // 判断是不是特殊账号
let { let { menu, userInfo } = this.data
menu,
userInfo
} = this.data
if (checklist.includes(userInfo?.accountName)) { if (checklist.includes(userInfo?.accountName)) {
menu = menu.filter(e => e.name != '预约管理') menu = menu.filter(e => e.name != '预约管理')
this.setData({ this.setData({
...@@ -507,9 +436,7 @@ Page({ ...@@ -507,9 +436,7 @@ Page({
// 如果是员工 开启订单补录轮询 // 如果是员工 开启订单补录轮询
this.getWaitOrder() this.getWaitOrder()
if (userInfo) { if (userInfo) {
let { let { userInfo: newUserInfo } = this.data
userInfo: newUserInfo
} = this.data
// console.log(newUserInfo) // console.log(newUserInfo)
if (newUserInfo) { if (newUserInfo) {
let isChangeLogin = newUserInfo.subLoginUser.merchantId != userInfo.subLoginUser.merchantId let isChangeLogin = newUserInfo.subLoginUser.merchantId != userInfo.subLoginUser.merchantId
......
...@@ -3,23 +3,23 @@ ...@@ -3,23 +3,23 @@
*/ */
import { DEFAULT_GET_STORAGEKEY, STORAGE_OBJECTkEY } from '~/utils/constantData' import { DEFAULT_GET_STORAGEKEY, STORAGE_OBJECTkEY } from '~/utils/constantData'
import { env } from '~/config'
class Storage { class Storage {
types = { types = {
1: 'get', // get 1: 'get', // get
2: 'set', // set 2: 'set', // set
3: 'rm' // rm 3: 'rm' // rm
} }
envVersion = { // envVersion = {
develop: '开发版', // develop: '开发版',
trial: '体验版', // trial: '体验版',
release: '正式版' // release: '正式版'
} // }
// defaultGetStorageKey = DEFAULT_GET_STORAGEKEY // defaultGetStorageKey = DEFAULT_GET_STORAGEKEY
/** 构造函数 */ /** 构造函数 */
constructor() { constructor() {
/** 获取当前小程序环境变量 */ /** 获取当前小程序环境变量 */
const accountInfo = wx.getAccountInfoSync() this.environment = env || 'release'
this.environment = accountInfo?.miniProgram.envVersion || 'release'
} }
/** /**
......
...@@ -17,10 +17,10 @@ export const STORAGE_OBJECTkEY = { ...@@ -17,10 +17,10 @@ export const STORAGE_OBJECTkEY = {
authphone: 'authphone', authphone: 'authphone',
disLikeRecordFlag: 'disLikeRecordFlag', disLikeRecordFlag: 'disLikeRecordFlag',
fileList: 'fileList', fileList: 'fileList',
posterId: 'posterId', posterId: 'posterId'
} }
export const IMG_VERSION = () => { // export const IMG_VERSION = () => {
const accountInfo = wx.getAccountInfoSync() // const accountInfo = wx.getAccountInfoSync()
return accountInfo.miniProgram.version || '1.0.0' // return accountInfo.miniProgram.version || '1.0.0'
} // }
import { env } from '~/config' import { envIndex } from '~/config'
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
// console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion)
//手动控制体验版环境的请求 true就依据下面index false就默认为2 // console.log(envIndex, 'envIndex')
const manual = false
const release = false
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 = { const secretKey_items = {
ip: { ip: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637', appKey: '48e5e13229b82c1b4e6e8c96151f0637',
...@@ -100,22 +69,13 @@ const domain_items = { ...@@ -100,22 +69,13 @@ const domain_items = {
scrm: 'https://scrm.beta.glsx.com.cn' 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'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
// console.log(domain_items[target[index]]);
module.exports = { module.exports = {
domain: domain_items[target[index]], domain: domain_items[target[envIndex]],
secretKey: secretKey_items[target[index]], secretKey: {
scrmSecretKey: scrmSecretKey_items[target[index]] dj: secretKey_items[target[envIndex]],
scrm: scrmSecretKey_items[target[envIndex]]
}
} }
import { secretKey, domain, path, sign,scrmSecretKey } from './http.js' import { secretKey, domain, path, sign, scrmSecretKey } from './http.js'
import util from '~/utils/util.js' import util from '~/utils/util.js'
/**接口 */ /**接口 */
class Request { class Request {
...@@ -94,22 +94,24 @@ class Request { ...@@ -94,22 +94,24 @@ class Request {
getData(data, method, noSignAttr) { getData(data, method, noSignAttr) {
let sessionId = util.getSessionId() let sessionId = util.getSessionId()
if (sessionId) data['sessionId'] = sessionId if (sessionId) data['sessionId'] = sessionId
console.log(data,'request'); // console.log(data,'request');
data['v'] = '1.0.0' data['v'] = '1.0.0'
data['method'] = method data['method'] = method
data['format'] = 'json' data['format'] = 'json'
data['locale'] = 'zh_CN' data['locale'] = 'zh_CN'
data['source'] = 'dj-wechat' data['source'] = 'dj-wechat'
// 兼容线上appkey和secret不一样的情况 // 兼容线上dj和scrm appkey和secret不一样的情况
let djapi = data.method.includes('dj.api') const apiName = data.method.split('.api')[0]
let scmrapi = data.method.includes('scrm.api') // 为空报错
console.log(scmrapi,'scmrapi'); if (!apiName) {
const appKey = scmrapi?scrmSecretKey.appKey:djapi?secretKey.appKey:'' throw new Error('apiName is null')
const secret = scmrapi?scrmSecretKey.secret:djapi?secretKey.secret:'' }
data['appKey'] = appKey const appKey = secretKey[apiName].appKey
const secret = secretKey[apiName].secret
data['appKey'] = appKey
let obj = sign(data, secret, noSignAttr) let obj = sign(data, secret, noSignAttr)
//data['sign'] = obj.sign; //data['sign'] = obj.sign;
......
import { dsnUrl } from '~/config' import { dsnUrl } from '~/config'
import * as Sentry from '~/utils/lib/sentry-miniapp' import * as Sentry from '~/utils/lib/sentry-miniapp'
import { env } from '~/config'
// console.log(env, 'env')
export default function sentryInit() { export default function sentryInit() {
// accountInfo.miniProgram.envVersion == 'release' && //测试和生产才开启sentry
const accountInfo = wx.getAccountInfoSync() const envNameList = ['trial', 'release']
//测试和生产才开发sentry envNameList.includes(env) &&
const env = ['trial', 'release']
env.includes(accountInfo.miniProgram.envVersion) &&
Sentry.init({ Sentry.init({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn: dsnUrl dsn: dsnUrl
}) })
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!