This commit is contained in:
yulixing 2019-11-27 17:02:44 +08:00
parent 05de2d09e2
commit e15eaea771
2 changed files with 2 additions and 2 deletions

View File

@ -185,7 +185,7 @@ router.post('/view', async (req, res, next) => {
const body = req.body const body = req.body
const _id = body._id const _id = body._id
const search = await Maker.findOne({ _id }) const search = await Maker.findOne({ _id })
const view = search.view || 0 const view = parseInt(search.view) || 0
const result = await Maker.updateOne({ _id }, { const result = await Maker.updateOne({ _id }, {
view: view + 1 view: view + 1
}) })

View File

@ -10,7 +10,7 @@ const Maker = new mongoose.Schema({
template: { type: String, default: '' }, template: { type: String, default: '' },
list: { type: Object, default: {} }, list: { type: Object, default: {} },
tags: { type: String, default: '' }, tags: { type: String, default: '' },
view: { type: String, default: 0 }, view: { type: Number, default: 0 },
isRecommand: { type: Boolean, default: false } isRecommand: { type: Boolean, default: false }
}, { }, {
collection: 'maker', collection: 'maker',