Commit 1a3d4127 authored by 任国军's avatar 任国军

fix recommendClass

parent 42c487f7
Pipeline #22949 passed with stage
in 3 seconds
......@@ -182,7 +182,7 @@ class ReportService extends Service {
const { ctx } = this;
const userUuid = ctx.userUuid;
const 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 }, order: [[ 'id', 'desc' ]] });
const categoryIds = _.uniq(R.pluck('cat_id', userReportList));
let categoryList = await ctx.classModel.V5.CourseV5Category.findAll({ where: { id: { $in: categoryIds } } });
......@@ -346,6 +346,8 @@ class ReportService extends Service {
tmpClassList = await ctx.classModel.V5.CourseV5ClassToColumn.findAll(tmpFilter);
classIds = classFlag ? _.intersection(classIds, R.pluck('class_id', tmpClassList)) : R.pluck('class_id', tmpClassList);
classFlag = true;
console.log(v);
console.log(classIds);
}
}
}
......@@ -353,6 +355,7 @@ class ReportService extends Service {
let category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: catId } });
category = ctx.isEmpty(category) ? 0 : category.bind;
tmpClassList = await ctx.classModel.V5.CourseV5ClassToCat.findAll({ where: { cat_id: category, status: 1, is_deleted: 0 }, attributes: [ 'class_id' ] });
classIds = classFlag ? _.intersection(classIds, R.pluck('class_id', tmpClassList)) : R.pluck('class_id', tmpClassList);
// 年级筛选
tmpClassList = await ctx.classModel.V5.CourseV5ClassToAge.findAll({ where: { age_id: babyAge, status: 1, is_deleted: 0 }, attributes: [ 'class_id' ] });
......
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