diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 0f52e751..dff093c8 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -375,8 +375,10 @@ async function spotCheck (ctx) { throw '参数错误' } - const prepareRes = await models.ReportSpotCheckPreview.find({ - id: previewId + const prepareRes = await models.ReportSpotCheckPreview.findOne({ + where: { + id: previewId + } }) const sqlStr = ` @@ -400,9 +402,7 @@ async function spotCheck (ctx) { findUsers = userRes.map(item => { return item.id }) - console.log('findUsers', findUsers) let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) - console.log('checkCount', checkCount) const reportRes = findUsers.length && checkCount ? await models.Report.findAll({ where: { reportType: 'conserve', @@ -419,7 +419,7 @@ async function spotCheck (ctx) { id: previewId } }) - console.log('reportRes', reportRes) + if (reportRes.length) { let spotDate = moment().format('YYYY-MM-DD') await models.ReportSpotCheck.bulkCreate(reportRes.map(r => {