diff --git a/src/controllers/games/ad.js b/src/controllers/games/ad.js index b239dec..a82afbc 100644 --- a/src/controllers/games/ad.js +++ b/src/controllers/games/ad.js @@ -484,6 +484,19 @@ router.get('/uid-ratio', async (req, res, next) => { // 修改Uid显示比例 router.post('/uid-ratio', async (req, res, next) => { + logger.db(req, '游戏管理', '广告Uid', '修改Uid显示比例') + // 权限判断 + const hasPerm = + req.user.permissions.includes(`${req.body.uid}-edit`) || + req.user.permissions.includes(`${req.body.uid}-publish`) || + req.user.permissions.includes(`games-writeable`) + if (!hasPerm) { + res.status(403).send({ + errcode: 1, + errmsg: '用户无游戏编辑权限!', + }) + return + } try { const body = req.body const game_id = body.game_id @@ -500,7 +513,6 @@ router.post('/uid-ratio', async (req, res, next) => { }) } - for (const key in cfg) { if (cfg.hasOwnProperty(key)) { const val = cfg[key] diff --git a/src/controllers/games/gift.js b/src/controllers/games/gift.js index ca14fe0..7cb304f 100644 --- a/src/controllers/games/gift.js +++ b/src/controllers/games/gift.js @@ -151,6 +151,7 @@ router.post('/list', async (req, res, next) => { time: body.time, cfg: cfg, extraData: body.extraData, + status: body.status }) const result = await list.save() res.send({ @@ -190,6 +191,7 @@ router.put('/list', async (req, res, next) => { time: body.time, cfg: cfg, extraData: body.extraData, + status: body.status } ) res.send({ diff --git a/src/models/admin/GameGift.js b/src/models/admin/GameGift.js index 1484748..4da9d27 100644 --- a/src/models/admin/GameGift.js +++ b/src/models/admin/GameGift.js @@ -40,7 +40,8 @@ const GiftListSchema = new mongoose.Schema( time: {type: String}, // 填写的发放配置 cfg: {type: Array, default: []}, // 生成的配置 deleted: {type: Boolean, default: false}, - extraData: {type: String, default: ''} //用于扩展 + extraData: {type: String, default: ''}, //用于扩展 + status: {type: Number, default: 0}, // 开启状态 }, { collection: 'gift_list',