Commit 8af0ae18 authored by 任国军's avatar 任国军

category add is_have & report add id

parent 769f9563
Pipeline #22093 passed with stage
in 32 seconds
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
const Service = require('egg').Service; const Service = require('egg').Service;
const moment = require('moment'); const moment = require('moment');
const R = require('ramda');
const MODE = [ const MODE = [
{ {
...@@ -150,6 +151,12 @@ class OptionService extends Service { ...@@ -150,6 +151,12 @@ class OptionService extends Service {
} }
} }
} }
// 智能选课要判断是否有报告
let reportFilterIds = [];
if (type === 3) {
const userReportList = await ctx.classModel.V5.CourseUserReport.findAll({ where: { user_uuid: ctx.userUuid, status: 1, is_deleted: 0 }, attributes: [ 'cat_id' ] });
reportFilterIds = R.pluck('cat_id', userReportList);
}
const results = []; const results = [];
for (const v of categoryList) { for (const v of categoryList) {
...@@ -163,6 +170,7 @@ class OptionService extends Service { ...@@ -163,6 +170,7 @@ class OptionService extends Service {
is_open: v.is_open, is_open: v.is_open,
url: v.url, url: v.url,
is_valid: filterIds.includes(v.id) ? 0 : 1, is_valid: filterIds.includes(v.id) ? 0 : 1,
is_have: reportFilterIds.includes(v.id) ? 0 : 1,
sort: v.sort, sort: v.sort,
}); });
} }
......
...@@ -113,6 +113,7 @@ class ReportService extends Service { ...@@ -113,6 +113,7 @@ class ReportService extends Service {
const ret = { const ret = {
id: userReportInfo.id,
category: ctx.isEmpty(category) ? {} : category, category: ctx.isEmpty(category) ? {} : category,
tags, tags,
report, report,
......
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