add shop list api for weapp

This commit is contained in:
zhl 2021-05-14 11:26:45 +08:00
parent 84b7e7ee16
commit d3e76d8787

View File

@ -41,6 +41,34 @@ class ShopController extends BaseController {
return result
}
@role('anon')
@router('post /weapp/shopList')
async shopList(req, res) {
let { start, limit } = req.params
limit = +limit || 10
start = +start || 0
let { opt, sort } = Shop.parseQueryParam(req.params)
let articles = await Shop.find(opt)
.sort(sort)
.skip(start)
.limit(limit)
let count = await Shop.count(opt)
let records: any = []
for (let record of articles) {
records.push({
id: record.id,
showName: record.showName,
logo: record.logo,
areaStr: record.areaStr
})
}
return {
total: count,
start,
limit,
records
}
}
/**
* TODO::