添加兑换物品 查重修改

This commit is contained in:
yulixing 2019-08-30 14:30:35 +08:00
parent be2bfa3b0e
commit c3065965ad

View File

@ -27,7 +27,8 @@ router.post('/', async (req, res, next) => {
const body = req.body
try {
const search = await GameGift.findOne({
$or: [{gift_name: body.gift_name}, {gift_id: body.gift_id}],
game_id: body.game_id,
gift_id: body.gift_id,
deleted: false,
})
if (search) {
@ -145,7 +146,7 @@ router.post('/list', async (req, res, next) => {
type: body.type,
time: body.time,
cfg: cfg,
extraData: body.extraData
extraData: body.extraData,
})
const result = await list.save()
res.send({
@ -184,7 +185,7 @@ router.put('/list', async (req, res, next) => {
type: body.type,
time: body.time,
cfg: cfg,
extraData: body.extraData
extraData: body.extraData,
}
)
res.send({
@ -264,7 +265,8 @@ function formatCfg(type, timeStr) {
startTime:
parseInt(startTimeArr[0]) * 60 * 60 * 1000 +
parseInt(startTimeArr[1]) * 60 * 1000,
endTime: parseInt(endTimeArr[0]) * 60 * 60 * 1000 +
endTime:
parseInt(endTimeArr[0]) * 60 * 60 * 1000 +
parseInt(endTimeArr[1]) * 60 * 1000,
limit: parseInt(cfg[1]),
})
@ -301,5 +303,4 @@ router.get('/record', async (req, res, next) => {
}
})
export default router