|
@ -401,9 +401,9 @@ async function spotCheck (ctx) { |
|
|
let findUsers = [] |
|
|
let findUsers = [] |
|
|
findUsers = userRes.map(item => { |
|
|
findUsers = userRes.map(item => { |
|
|
return item.id |
|
|
return item.id |
|
|
}) |
|
|
}) |
|
|
let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) |
|
|
let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) |
|
|
|
|
|
|
|
|
const reportRes = findUsers.length && checkCount ? await models.Report.findAll({ |
|
|
const reportRes = findUsers.length && checkCount ? await models.Report.findAll({ |
|
|
where: { |
|
|
where: { |
|
|
reportType: 'conserve', |
|
|
reportType: 'conserve', |
|
@ -440,7 +440,7 @@ async function spotCheck (ctx) { |
|
|
ctx.body = reportRes |
|
|
ctx.body = reportRes |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
await transaction.rollback(); |
|
|
await transaction.rollback(); |
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
ctx.status = 400; |
|
|
ctx.status = 400; |
|
|
ctx.body = { |
|
|
ctx.body = { |
|
|
message: typeof error == 'string' ? error : undefined |
|
|
message: typeof error == 'string' ? error : undefined |
|
@ -469,7 +469,7 @@ async function spotCheckDetail (ctx) { |
|
|
ctx.body = res |
|
|
ctx.body = res |
|
|
ctx.status = 200 |
|
|
ctx.status = 200 |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`) |
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`) |
|
|
ctx.status = 400 |
|
|
ctx.status = 400 |
|
|
ctx.body = { |
|
|
ctx.body = { |
|
|
message: typeof error == 'string' ? error : undefined |
|
|
message: typeof error == 'string' ? error : undefined |
|
|