Commit 79bfefd0 authored by 任国军's avatar 任国军

category add more params

parent 15643861
Pipeline #21794 passed with stage
in 14 seconds
......@@ -18,6 +18,8 @@ module.exports = app => {
selected_icon: STRING,
unselected_icon: STRING,
report_icon: STRING,
is_open: INTEGER,
url: STRING,
status: INTEGER,
is_deleted: INTEGER,
sort: INTEGER,
......
......@@ -133,6 +133,8 @@ class OptionService extends Service {
name: v.name,
selected_icon: v.selected_icon,
unselected_icon: v.unselected_icon,
is_open: v.is_open,
url: v.url,
sort: v.sort,
});
}
......
......@@ -154,21 +154,30 @@ class ReportService extends Service {
const { ctx } = this;
const userUuid = ctx.userUuid;
let userReportList = await ctx.classModel.V5.CourseUserReport.findAll({ where: { user_uuid: userUuid, status: 1, is_deleted: 0 } });
const userReportList = await ctx.classModel.V5.CourseUserReport.findAll({ where: { user_uuid: userUuid, status: 1, is_deleted: 0 } });
const categoryIds = _.uniq(R.pluck('cat_id', userReportList));
userReportList = _.groupBy(userReportList, 'cat_id');
let categoryList = await ctx.classModel.V5.CourseV5Category.findAll({ where: { id: { $in: categoryIds } } });
categoryList = _.groupBy(categoryList, 'id');
const results = [];
for (const i in userReportList) {
const checkIds = [];
for (const v of userReportList) {
if (!checkIds.includes(v.cat_id)) {
const category = ctx.isEmpty(categoryList[v.cat_id]) ? '' : categoryList[v.cat_id][0].name;
results.push({
id: v.id,
title: category + '选课报告',
icon: ctx.isEmpty(categoryList[v.cat_id]) ? '' : categoryList[v.cat_id][0].report_icon,
created_time: v.created_time,
});
checkIds.push(v.cat_id);
}
}
const ret = {
list: results,
total_count: 0,
total_count: results.length,
};
return ret;
......
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