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
15643861
Commit
15643861
authored
Apr 17, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix reportInfo
parent
abcccd83
Pipeline
#21791
passed with stage
in 15 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
courseV5ReportColumnDetail.js
app/model/class/v5/courseV5ReportColumnDetail.js
+3
-0
report.js
app/service/course/v5/report.js
+17
-2
No files found.
app/model/class/v5/courseV5ReportColumnDetail.js
View file @
15643861
...
...
@@ -13,7 +13,10 @@ module.exports = app => {
autoIncrement
:
true
,
},
report_column_id
:
INTEGER
,
sub_title
:
STRING
,
level
:
INTEGER
,
content
:
STRING
,
advice
:
STRING
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
number
:
INTEGER
,
...
...
app/service/course/v5/report.js
View file @
15643861
...
...
@@ -85,7 +85,7 @@ class ReportService extends Service {
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
});
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'
,
'
sub_title'
,
'level'
,
'content'
,
'advice
'
],
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'
);
...
...
@@ -94,7 +94,10 @@ class ReportService extends Service {
report
.
push
({
id
:
v
.
id
,
title
:
v
.
title
,
sub_title
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
sub_title
,
level
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
level
,
content
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
content
,
advice
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
advice
,
});
}
...
...
@@ -118,7 +121,7 @@ class ReportService extends Service {
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
});
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'
,
'
sub_title'
,
'level'
,
'content'
,
'advice
'
],
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'
);
...
...
@@ -127,7 +130,10 @@ class ReportService extends Service {
report
.
push
({
id
:
v
.
id
,
title
:
v
.
title
,
sub_title
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
sub_title
,
level
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
level
,
content
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
content
,
advice
:
ctx
.
isEmpty
(
reportColumnDetailList
[
v
.
id
])
?
''
:
reportColumnDetailList
[
v
.
id
][
0
].
advice
,
});
}
...
...
@@ -236,6 +242,10 @@ class ReportService extends Service {
classList
=
_
.
orderBy
(
classList
,
[
'score'
,
'filter_price'
],
[
'desc'
,
'asc'
]);
classList
=
classList
.
slice
(
0
,
3
);
for
(
let
i
=
0
;
i
<
classList
.
length
;
i
++
)
{
classList
[
i
].
match
=
99
-
i
*
3
-
Math
.
floor
(
Math
.
random
()
*
3
);
}
return
classList
;
}
...
...
@@ -368,6 +378,10 @@ class ReportService extends Service {
classToColumn
=
_
.
groupBy
(
classToColumn
,
'class_id'
);
columnList
=
_
.
groupBy
(
columnList
,
'id'
);
// 获取所有机构
let
institutionList
=
await
ctx
.
classModel
.
V5
.
CourseV5Institution
.
findAll
({
where
:
{
id
:
{
$in
:
R
.
pluck
(
'institution_id'
,
classList
)
}
}
});
institutionList
=
_
.
groupBy
(
institutionList
,
'id'
);
const
ret
=
[];
for
(
const
v
of
classList
)
{
const
classAgeList
=
[];
...
...
@@ -421,6 +435,7 @@ class ReportService extends Service {
}
const
tmpClass
=
v
;
tmpClass
.
institution_name
=
ctx
.
isEmpty
(
institutionList
[
v
.
institution_id
])
?
''
:
institutionList
[
v
.
institution_id
][
0
].
name
;
tmpClass
.
age_list
=
classAgeList
;
tmpClass
.
type_list
=
classTypeList
;
tmpClass
.
frequency_list
=
classFrequencyList
;
...
...
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