提交 e8172d03 authored 作者: 王鹏飞's avatar 王鹏飞

调整环境变量

上级 31ffc86b
......@@ -2,8 +2,12 @@ const state = process.env.NODE_ENV
let conf = {}
if (state === 'test') {
conf.agentApiUrl = 'https://api2.ezijing.com/'
conf.apiKey = 'TM4Nmspf52Nr3ZeSeAkyzbsHh7vIer8D'
conf.host = 'lms-api2.ezijing.com'
} else if (state === 'production') {
conf.agentApiUrl = 'https://zapi.ezijing.com/'
conf.apiKey = 'TM4Nmspf52Nr3ZeSeAkyzbsHh7vIer8D'
conf.host = 'lms-api.ezijing.com'
}
global.app = null
......
......@@ -38,15 +38,15 @@ const agentProcessor = () => {
maxBodyLength: Infinity
}
options.url = options.url.replace(/tenant\//gi, '')
headers['apikey'] = 'TM4Nmspf52Nr3ZeSeAkyzbsHh7vIer8D'
headers['apikey'] = conf.apiKey
if (/user_center/gi.test(options.url)) {
headers['Host'] = 'sso.ezijing.com'
headers['host'] = 'sso.ezijing.com'
} else {
// headers['Host'] = 'lms-api.ezijing.com'
// headers['host'] = 'lms-api.ezijing.com'
headers['Host'] = 'lms-worklobby-api.ezijing.com'
headers['host'] = 'lms-worklobby-api.ezijing.com'
headers['Host'] = conf.host
headers['host'] = conf.host
}
/* 测试 */
// if (/\/essay/gi.test(options.url) && /post/gi.test(req.method)) {
......@@ -120,14 +120,12 @@ const agentProcessor = () => {
'base64'
)
} catch (e) {
res
.status(500)
.json({
message:
'文档上传出错,错误原因:请不要直接修改后缀“.doc”为“.docx”或者正文内容必须大于400字',
errMsg: 'err',
code: 500
})
res.status(500).json({
message:
'文档上传出错,错误原因:请不要直接修改后缀“.doc”为“.docx”或者正文内容必须大于400字',
errMsg: 'err',
code: 500
})
return
}
}
......@@ -137,8 +135,8 @@ const agentProcessor = () => {
/* check-access接口 */
// headers['Host'] = 'lms-api.ezijing.com'
// headers['host'] = 'lms-api.ezijing.com'
headers['Host'] = 'lms-worklobby-api.ezijing.com'
headers['host'] = 'lms-worklobby-api.ezijing.com'
headers['Host'] = conf.host
headers['host'] = conf.host
axios.defaults.headers = headers
axios({
timeout: 30 * 1000,
......@@ -217,13 +215,11 @@ const agentProcessor = () => {
JSON.stringify(e.response.data)
)
} else {
res
.status(500)
.json({
message: '系统错误,请稍后重试或联系管理员',
errMsg: 'Error Proxy Request or BackData Excute Error',
code: 500
})
res.status(500).json({
message: '系统错误,请稍后重试或联系管理员',
errMsg: 'Error Proxy Request or BackData Excute Error',
code: 500
})
console.error(_logJson._uuid, e)
}
})
......@@ -241,13 +237,11 @@ const agentProcessor = () => {
})
})
} catch (e) {
res
.status(500)
.json({
message: '系统错误,请稍后重试或联系管理员',
errMsg: 'Network Server Excute Error',
code: 500
})
res.status(500).json({
message: '系统错误,请稍后重试或联系管理员',
errMsg: 'Network Server Excute Error',
code: 500
})
console.error(_logJson._uuid, e)
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论