助力记录增加按code查询
This commit is contained in:
parent
fbb9aba160
commit
dce75b563b
@ -66,12 +66,23 @@ class BoxController extends BaseController {
|
|||||||
@role(ROLE_ANON)
|
@role(ROLE_ANON)
|
||||||
@router('post /api/chest/enhance/list')
|
@router('post /api/chest/enhance/list')
|
||||||
async enhanceList(req) {
|
async enhanceList(req) {
|
||||||
let { chestId, chestid } = req.params
|
let { chestId, chestid, code } = req.params
|
||||||
chestid = chestId || chestid
|
chestid = chestId || chestid
|
||||||
if (!isObjectIdString(chestid)) {
|
if (code && !isValidShareCode(code)) {
|
||||||
throw new ZError(11, 'must provide valid chestid')
|
throw new ZError(11, 'invalid share code')
|
||||||
|
}
|
||||||
|
if (chestid && !isObjectIdString(chestid)) {
|
||||||
|
throw new ZError(11, 'invalid chest id')
|
||||||
|
}
|
||||||
|
if (!code && !chestId) {
|
||||||
|
throw new ZError(11, 'must provide share code or chest id')
|
||||||
|
}
|
||||||
|
let chest: any
|
||||||
|
if (chestId) {
|
||||||
|
chest = await ActivityChest.findById(chestId)
|
||||||
|
} else {
|
||||||
|
chest = await ActivityChest.findOne({ shareCode: code })
|
||||||
}
|
}
|
||||||
const chest = await ActivityChest.findById(chestid)
|
|
||||||
if (!chest) {
|
if (!chest) {
|
||||||
throw new ZError(12, 'chest not found')
|
throw new ZError(12, 'chest not found')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user