|
@@ -45,7 +45,11 @@ router.get('/:id', async (req, res) => {
|
|
where: { type: cdata.type, id: { [Op.not]: id }, status: COURSE_STATUS.已上线 },
|
|
where: { type: cdata.type, id: { [Op.not]: id }, status: COURSE_STATUS.已上线 },
|
|
attributes: ['id', 'detailimg', 'title', 'price'],
|
|
attributes: ['id', 'detailimg', 'title', 'price'],
|
|
});
|
|
});
|
|
- const tdata = await teacher.findOne({ where: { id: cdata.teacherId } });
|
|
|
|
|
|
+ const tdata = await Promise.all(
|
|
|
|
+ cdata.teacherId.map(item => {
|
|
|
|
+ return teacher.findOne({ where: { id: item } });
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
|
|
const option = {
|
|
const option = {
|
|
title: '课程详情页',
|
|
title: '课程详情页',
|
|
@@ -95,7 +99,11 @@ router.get('/:id/:chapterId', async (req, res) => {
|
|
where: { type: cdata.type, id: { [Op.not]: id }, status: COURSE_STATUS.已上线 },
|
|
where: { type: cdata.type, id: { [Op.not]: id }, status: COURSE_STATUS.已上线 },
|
|
attributes: ['id', 'detailimg', 'title', 'price'],
|
|
attributes: ['id', 'detailimg', 'title', 'price'],
|
|
});
|
|
});
|
|
- const tdata = await teacher.findOne({ where: { id: cdata.teacherId } });
|
|
|
|
|
|
+ const tdata = await Promise.all(
|
|
|
|
+ cdata.teacherId.map(item => {
|
|
|
|
+ return teacher.findOne({ where: { id: item } });
|
|
|
|
+ })
|
|
|
|
+ );
|
|
const chdata = await chapter.findAll({
|
|
const chdata = await chapter.findAll({
|
|
where: { cid: id, status: 1 },
|
|
where: { cid: id, status: 1 },
|
|
});
|
|
});
|