Commit 0f0d3864 authored by 任国军's avatar 任国军

category add color

parent 91189242
Pipeline #22910 passed with stage
in 3 seconds
......@@ -20,6 +20,7 @@ module.exports = app => {
report_icon: STRING,
is_open: INTEGER,
url: STRING,
color: STRING,
status: INTEGER,
is_deleted: INTEGER,
sort: INTEGER,
......
......@@ -92,7 +92,7 @@ class ReportService extends Service {
ctx.failed('尚未生成报告');
}
const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url' ] });
const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url', 'color' ] });
const userBabyInfo = await ctx.classModel.V5.CourseV5UserBaby.findOne({ where: { user_uuid: userReportInfo.user_uuid, status: 1, is_deleted: 0 }, attributes: [ 'user_uuid', 'baby_sex', 'baby_name', 'baby_age' ] });
// 获取年龄对应的报告选项
const ageToReport = await ctx.classModel.V5.CourseV5AgeToReportColumnDetail.findAll({ where: { age_id: userBabyInfo.baby_age, cat_id: userReportInfo.cat_id, status: 1, is_deleted: 0 } });
......@@ -139,7 +139,7 @@ class ReportService extends Service {
ctx.failed('尚未生成报告');
}
const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url' ] });
const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url', 'color' ] });
const userBabyInfo = await ctx.classModel.V5.CourseV5UserBaby.findOne({ where: { user_uuid: userReportInfo.user_uuid, status: 1, is_deleted: 0 }, attributes: [ 'user_uuid', 'baby_sex', 'baby_name', 'baby_age' ] });
// 获取年龄对应的报告选项
const ageToReport = await ctx.classModel.V5.CourseV5AgeToReportColumnDetail.findAll({ where: { age_id: userBabyInfo.baby_age, cat_id: userReportInfo.cat_id, status: 1, is_deleted: 0 } });
......@@ -562,7 +562,7 @@ class ReportService extends Service {
const userReportList = await ctx.classModel.V5.CourseUserReport.findAll({ where: { user_uuid: ctx.userUuid, status: 1, is_deleted: 0 }, raw: true });
const categoryIds = _.uniq(R.pluck('cat_id', userReportList));
let categoryList = await ctx.classModel.V5.CourseV5Category.findAll({ where: { id: { $in: categoryIds } }, attributes: [ 'id', 'name', 'url' ] });
let categoryList = await ctx.classModel.V5.CourseV5Category.findAll({ where: { id: { $in: categoryIds } }, attributes: [ 'id', 'name', 'url', 'color' ] });
categoryList = _.groupBy(categoryList, 'id');
const results = [];
......
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