bug fix: enhance list param error

This commit is contained in:
CounterFire2023 2024-04-16 22:13:11 +08:00
parent dce75b563b
commit 156a4fc245

View File

@ -74,12 +74,12 @@ class BoxController extends BaseController {
if (chestid && !isObjectIdString(chestid)) { if (chestid && !isObjectIdString(chestid)) {
throw new ZError(11, 'invalid chest id') throw new ZError(11, 'invalid chest id')
} }
if (!code && !chestId) { if (!code && !chestid) {
throw new ZError(11, 'must provide share code or chest id') throw new ZError(11, 'must provide share code or chest id')
} }
let chest: any let chest: any
if (chestId) { if (chestid) {
chest = await ActivityChest.findById(chestId) chest = await ActivityChest.findById(chestid)
} else { } else {
chest = await ActivityChest.findOne({ shareCode: code }) chest = await ActivityChest.findOne({ shareCode: code })
} }