gift 类型、giftlist状态

This commit is contained in:
yulixing 2019-09-17 15:17:35 +08:00
parent 4c4f7890b4
commit 82867b21a9
3 changed files with 17 additions and 2 deletions

View File

@ -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]

View File

@ -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({

View File

@ -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',