diff --git a/doc/api.md b/doc/api.md index 8a8697b..79f8c3d 100644 --- a/doc/api.md +++ b/doc/api.md @@ -310,10 +310,11 @@ "name": "一品漫城", // 店铺名 "area": "上海市-上海市-闵行区", // 区域 "logo": "https://resource.kingsome.cn/game607fd53cb40504740fdccb13.png", // 店铺logo - "exam": { // 店铺测验信息 + "exams": [{ // 店铺测验信息 "id": "609e13eeccc78154ac683583", //id - "name": "第一期测试" // 测验 - }, + "name": "第一期测试", // 测验 + "desc": "简介" + }], "activity": { // 活动信息 "id": "608bdf61cecfcc2f45247663", // 活动id "name": "第一个活动", // 活动名 diff --git a/src/admin/controllers/shop_exam.controller.ts b/src/admin/controllers/shop_exam.controller.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/api/controllers/shop.controller.ts b/src/api/controllers/shop.controller.ts index 2a2cb35..44c9546 100644 --- a/src/api/controllers/shop.controller.ts +++ b/src/api/controllers/shop.controller.ts @@ -105,9 +105,13 @@ class ShopController extends BaseController { rspData.area = shop.areaStr rspData.logo = shop.logo const now = Date.now() - let exam = await ShopExam.findOne({shop: sid, beginTime: {$lte: now}, endTime: {$gte: now}, active: true, deleted: false}) - if (exam) { - rspData.exam = {id : exam.id, name: exam.name, desc: exam.desc} + let exams = await ShopExam.find({shop: sid, beginTime: {$lte: now}, endTime: {$gte: now}, active: true, deleted: false}) + if (exams && exams.length > 0) { + let datas: any = [] + for (let exam of exams) { + datas.push({ id: exam.id, name: exam.name, desc: exam.desc }) + } + rspData.exams = datas } let activity = await ShopActivity.getActivityOne(sid) rspData.activity = activity