去除cors()
This commit is contained in:
parent
449fb6493a
commit
cb3a740330
@ -10,7 +10,7 @@ const router = new Router()
|
||||
const redisDao = new RedisDao()
|
||||
|
||||
// 获取广告区域列表
|
||||
router.get('/', cors(), async (req, res, next) => {
|
||||
router.get('/', async (req, res, next) => {
|
||||
try {
|
||||
const query = req.query
|
||||
const game_id = query.gameid
|
||||
|
@ -21,7 +21,7 @@ const corsOptions = {
|
||||
}
|
||||
|
||||
// 获取广告区域列表
|
||||
router.get('/list', cors(), async (req, res, next) => {
|
||||
router.get('/list', async (req, res, next) => {
|
||||
try {
|
||||
const games = await GameInfo.find({deleted: false})
|
||||
const result = []
|
||||
|
@ -6,19 +6,10 @@ import GameJump from '../../models/admin/GameJump'
|
||||
import cors from 'cors'
|
||||
const router = new Router()
|
||||
|
||||
const whitelist = ['https://promotion.kingsome.cn', 'https://promotion-test.kingsome.cn', 'http://promotion.kingsome.cn','http://promotion-test.kingsome.cn']
|
||||
const corsOptions = {
|
||||
origin: function(origin, callback) {
|
||||
if (whitelist.indexOf(origin) !== -1) {
|
||||
callback(null, true)
|
||||
} else {
|
||||
callback(new Error('Not allowed by CORS'))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
// 获取游戏跳转关联列表
|
||||
router.get('/', cors(corsOptions), async (req, res, next) => {
|
||||
router.get('/', async (req, res, next) => {
|
||||
try {
|
||||
const query = req.query
|
||||
const currentPage = parseInt(query.currentPage)
|
||||
@ -52,7 +43,7 @@ router.get('/', cors(corsOptions), async (req, res, next) => {
|
||||
})
|
||||
|
||||
// 添加关联游戏
|
||||
router.post('/', cors(corsOptions), async (req, res, next) => {
|
||||
router.post('/', async (req, res, next) => {
|
||||
try {
|
||||
const body = req.body
|
||||
const game_id = body.game_id
|
||||
@ -93,7 +84,7 @@ router.post('/', cors(corsOptions), async (req, res, next) => {
|
||||
}
|
||||
})
|
||||
// 修改关联游戏
|
||||
router.put('/', cors(corsOptions), async (req, res, next) => {
|
||||
router.put('/', async (req, res, next) => {
|
||||
try {
|
||||
const body = req.body
|
||||
const jump_id = body._id
|
||||
@ -126,7 +117,7 @@ router.put('/', cors(corsOptions), async (req, res, next) => {
|
||||
})
|
||||
|
||||
// 删除关联游戏
|
||||
router.delete('/', cors(corsOptions), async (req, res, next) => {
|
||||
router.delete('/', async (req, res, next) => {
|
||||
try {
|
||||
const body = req.body
|
||||
const jump_id = body.jump_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user