Commit 7a55a9e0 authored by 任国军's avatar 任国军

add cat_title

parent 44e63ac9
Pipeline #19018 passed with stage
in 7 seconds
......@@ -690,6 +690,13 @@ class InstitutionSubService extends Service {
filter.where.cat_id = { $in: catIds };
}
// 获取分类
const cats = await ctx.classModel.V4.CourseCat.findAll({ where: { status: 'online', is_deleted: 0 } });
const catMap = new Map();
for (const v of cats) {
catMap.set(v.id, v);
}
const articles = await ctx.classModel.V4.CourseArticle.findAndCountAll(filter);
const ret = [];
......@@ -701,6 +708,7 @@ class InstitutionSubService extends Service {
id: v.id,
type: v.type,
cat_id: v.cat_id,
cat_title: catMap.has(v.cat_id) ? catMap.get(v.cat_id).name : '',
title: v.title,
description: v.description,
content: v.content,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment