Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
bbb60d12
Commit
bbb60d12
authored
Apr 17, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add reportInfo
parent
0d753082
Pipeline
#21783
passed with stage
in 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
report.js
app/controller/course/v5/report.js
+12
-0
course_v5.js
app/router/course_v5.js
+1
-0
report.js
app/service/course/v5/report.js
+33
-0
No files found.
app/controller/course/v5/report.js
View file @
bbb60d12
...
@@ -29,6 +29,18 @@ class ReportController extends Controller {
...
@@ -29,6 +29,18 @@ class ReportController extends Controller {
const
ret
=
await
service
.
course
.
v5
.
report
.
generateReport
(
queryParams
);
const
ret
=
await
service
.
course
.
v5
.
report
.
generateReport
(
queryParams
);
ctx
.
success
(
ret
);
ctx
.
success
(
ret
);
}
}
// 获取报告详情
async
getReportById
()
{
const
{
ctx
,
service
}
=
this
;
const
params
=
ctx
.
params
;
if
(
ctx
.
isEmpty
(
params
)
||
ctx
.
isEmpty
(
params
.
report_id
))
{
ctx
.
failed
(
'report_id is empty'
);
}
const
ret
=
await
service
.
course
.
v5
.
report
.
getReportById
(
params
.
report_id
);
ctx
.
success
(
ret
);
}
}
}
module
.
exports
=
ReportController
;
module
.
exports
=
ReportController
;
app/router/course_v5.js
View file @
bbb60d12
...
@@ -28,4 +28,5 @@ module.exports = app => {
...
@@ -28,4 +28,5 @@ 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/:report_id'
,
auth
,
'course.v5.report.getReportById'
);
// 获取报告详情
};
};
app/service/course/v5/report.js
View file @
bbb60d12
...
@@ -110,6 +110,39 @@ class ReportService extends Service {
...
@@ -110,6 +110,39 @@ class ReportService extends Service {
return
ret
;
return
ret
;
}
}
async
getReportById
(
reportId
)
{
const
{
ctx
}
=
this
;
const
userReportInfo
=
await
ctx
.
classModel
.
V5
.
CourseUserReport
.
findOne
({
user_uuid
:
ctx
.
userUuid
,
id
:
reportId
,
status
:
1
,
is_deleted
:
0
});
if
(
ctx
.
isEmpty
(
userReportInfo
))
{
ctx
.
failed
(
'尚未生成报告'
);
}
let
reportColumnDetailList
=
ctx
.
isEmpty
(
userReportInfo
.
report_column_detail_ids
)
?
[]
:
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumnDetail
.
findAll
({
where
:
{
id
:
{
$in
:
eval
(
userReportInfo
.
report_column_detail_ids
)
},
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'report_column_id'
,
'content'
],
raw
:
true
});
const
reportColumnList
=
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumn
.
findAll
({
where
:
{
id
:
{
$in
:
R
.
pluck
(
'report_column_id'
,
reportColumnDetailList
)
}
},
order
:
[[
'sort'
,
'asc'
]],
attributes
:
[
'id'
,
'title'
],
raw
:
true
});
reportColumnDetailList
=
_
.
groupBy
(
reportColumnDetailList
,
'report_column_id'
);
const
report
=
[];
for
(
const
v
of
reportColumnList
)
{
report
.
push
({
id
:
v
.
id
,
title
:
v
.
title
,
content
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
content
,
});
}
const
tags
=
await
this
.
getReportTags
(
userReportInfo
);
const
recommendClassList
=
await
this
.
getRecommendClassListByReport
(
userReportInfo
.
answer
);
const
ret
=
{
tags
,
report
,
recommend_class_list
:
recommendClassList
,
};
return
ret
;
}
// 获取标签
// 获取标签
async
getReportTags
(
report
)
{
async
getReportTags
(
report
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment