Commit 806e8f2f authored by 任国军's avatar 任国军

add reportList

parent bbb60d12
Pipeline #21786 passed with stage
in 3 seconds
...@@ -41,6 +41,14 @@ class ReportController extends Controller { ...@@ -41,6 +41,14 @@ class ReportController extends Controller {
const ret = await service.course.v5.report.getReportById(params.report_id); const ret = await service.course.v5.report.getReportById(params.report_id);
ctx.success(ret); ctx.success(ret);
} }
// 获取报告列表
async getReportList() {
const { ctx, service } = this;
const ret = await service.course.v5.report.getReportList();
ctx.success(ret);
}
} }
module.exports = ReportController; module.exports = ReportController;
...@@ -17,6 +17,7 @@ module.exports = app => { ...@@ -17,6 +17,7 @@ module.exports = app => {
name: STRING, name: STRING,
selected_icon: STRING, selected_icon: STRING,
unselected_icon: STRING, unselected_icon: STRING,
report_icon: STRING,
status: INTEGER, status: INTEGER,
is_deleted: INTEGER, is_deleted: INTEGER,
sort: INTEGER, sort: INTEGER,
......
...@@ -28,5 +28,7 @@ module.exports = app => { ...@@ -28,5 +28,7 @@ module.exports = app => {
router.get('third', '/question/all', 'course.v5.report.getQuestionList');// 获取问题列表 router.get('third', '/question/all', 'course.v5.report.getQuestionList');// 获取问题列表
router.post('third', '/report', auth, 'course.v5.report.generateReport');// 生成报告 router.post('third', '/report', auth, 'course.v5.report.generateReport');// 生成报告
router.get('third', '/report/all', auth, 'course.v5.report.getReportList');// 获取报告列表
router.get('third', '/report/:report_id', auth, 'course.v5.report.getReportById');// 获取报告详情 router.get('third', '/report/:report_id', auth, 'course.v5.report.getReportById');// 获取报告详情
}; };
...@@ -143,6 +143,31 @@ class ReportService extends Service { ...@@ -143,6 +143,31 @@ class ReportService extends Service {
return ret; return ret;
} }
// 获取报告列表
async getReportList() {
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 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 ret = {
list: results,
total_count: 0,
};
return ret;
}
// 获取标签 // 获取标签
async getReportTags(report) { async getReportTags(report) {
const { ctx } = this; const { ctx } = this;
......
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