Commit 91189242 authored by 任国军's avatar 任国军

categoryList add parent_name

parent ae520181
Pipeline #22894 passed with stage
in 3 seconds
...@@ -134,6 +134,8 @@ class OptionService extends Service { ...@@ -134,6 +134,8 @@ class OptionService extends Service {
} }
const categoryList = await ctx.classModel.V5.CourseV5Category.findAll(filter); const categoryList = await ctx.classModel.V5.CourseV5Category.findAll(filter);
let categoryAll = await ctx.classModel.V5.CourseV5Category.findAll({ where: {}, attributes: [ 'id', 'name' ], raw: true });
categoryAll = _.groupBy(categoryAll, 'id');
const filterIds = []; const filterIds = [];
// 智能选课要判断年龄 // 智能选课要判断年龄
...@@ -167,6 +169,7 @@ class OptionService extends Service { ...@@ -167,6 +169,7 @@ class OptionService extends Service {
id: v.id, id: v.id,
type: v.type, type: v.type,
parent_id: v.parent_id, parent_id: v.parent_id,
parent_name: v.parent_id > 0 ? (ctx.isEmpty(categoryAll[v.parent_id]) ? '' : categoryAll[v.parent_id][0].name) : '',
name: v.name, name: v.name,
selected_icon: v.selected_icon, selected_icon: v.selected_icon,
unselected_icon: v.unselected_icon, unselected_icon: v.unselected_icon,
......
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