From 82867b21a9fc9b2753071f8b4eb2b3971211ee33 Mon Sep 17 00:00:00 2001 From: yulixing Date: Tue, 17 Sep 2019 15:17:35 +0800 Subject: [PATCH] =?UTF-8?q?gift=20=E7=B1=BB=E5=9E=8B=E3=80=81giftlist?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/games/ad.js | 14 +++++++++++++- src/controllers/games/gift.js | 2 ++ src/models/admin/GameGift.js | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) 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',