提交 becd1d8c authored 作者: zyx's avatar zyx

update

上级 0cc55a81
...@@ -4,28 +4,11 @@ const com = require('@god/node-com') ...@@ -4,28 +4,11 @@ const com = require('@god/node-com')
const Proxy = com.Proxy const Proxy = com.Proxy
const get = (req, res) => { const use = (req, res) => {
Proxy.reqHttps({ Proxy.reqHttps({
hostname: 'zws-api2.ezijing.com', hostname: 'zws-api2.ezijing.com',
path: req.path, path: req.originalUrl,
data: {}, method: req.method,
query: {},
headers: {
'Host': 'zws-api2.ezijing.com',
'Cookie': req.headers.cookie || '',
'User-Agent': req.headers['user-agent'],
'Content-Type': 'application/x-www-form-urlencoded'
}
}, function (str, cookieStr) {
console.error('接口读取数据', req.headers.token, str)
res.status(200).json(JSON.parse(str))
})
}
const post = (req, res) => {
Proxy.reqHttps({
hostname: 'zws-api2.ezijing.com',
path: req.path,
methods: 'POST',
data: {}, data: {},
query: {}, query: {},
headers: { headers: {
...@@ -35,12 +18,12 @@ const post = (req, res) => { ...@@ -35,12 +18,12 @@ const post = (req, res) => {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}, function (str, cookieStr) { }, function (str, cookieStr) {
console.error('获取cookie - 123456789', req.headers.cookie)
console.error('接口读取数据', req.headers.token, str) console.error('接口读取数据', req.headers.token, str)
res.status(200).json(JSON.parse(str)) res.status(200).json(JSON.parse(str))
}) })
} }
module.exports = { module.exports = {
get: get, use: use
post: post
} }
...@@ -58,8 +58,7 @@ router.post('/set/cloud-class', _sccm.setTable) ...@@ -58,8 +58,7 @@ router.post('/set/cloud-class', _sccm.setTable)
// 学习系统获取 - 视频课程列表 - 接口转发 // 学习系统获取 - 视频课程列表 - 接口转发
router.get('/abc/test/cba/*', _nts.getData) router.get('/abc/test/cba/*', _nts.getData)
// 接口转发 - 解决跨域问题 // 接口转发 - 解决跨域问题
router.get('/v1/pay/wechat/*', _pr.get) router.use('/v1/pay/wechat/*', _pr.use)
router.post('/v1/pay/wechat/*', _pr.post)
router.use('/api/*', upload.any(), (req, res) => { res.send('暂无该接口') }) router.use('/api/*', upload.any(), (req, res) => { res.send('暂无该接口') })
router.use('*', upload.any(), (req, res) => { res.send('接口未定义') }) router.use('*', upload.any(), (req, res) => { res.send('接口未定义') })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论