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
4b7bc330
Commit
4b7bc330
authored
Feb 21, 2020
by
Aria
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
collectOnlineClass add image
parent
65d20757
Pipeline
#19535
failed with stage
in 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
online.js
app/service/course/v4/online.js
+13
-2
No files found.
app/service/course/v4/online.js
View file @
4b7bc330
...
@@ -305,15 +305,26 @@ class OnlineService extends Service {
...
@@ -305,15 +305,26 @@ class OnlineService extends Service {
classTypes
=
_
.
groupBy
(
classTypes
,
'class_id'
);
classTypes
=
_
.
groupBy
(
classTypes
,
'class_id'
);
// 机构
// 机构
const
institutionIds
=
R
.
pluck
(
'institution_id'
,
classes
.
rows
);
const
institutionIds
=
R
.
pluck
(
'institution_id'
,
classes
);
let
institutions
=
await
ctx
.
classModel
.
V4
.
CourseOnlineInstitution
.
findAll
({
where
:
{
id
:
{
$in
:
institutionIds
}
},
attributes
:
[
'id'
,
'name'
,
'logo'
]
});
let
institutions
=
await
ctx
.
classModel
.
V4
.
CourseOnlineInstitution
.
findAll
({
where
:
{
id
:
{
$in
:
institutionIds
}
},
attributes
:
[
'id'
,
'name'
,
'logo'
]
});
institutions
=
_
.
groupBy
(
institutions
,
'id'
);
institutions
=
_
.
groupBy
(
institutions
,
'id'
);
// 缩略图
const
imageInfo
=
await
ctx
.
classModel
.
V4
.
CourseImages
.
findAll
({
where
:
{
type
:
5
,
type_id
:
{
$in
:
classIds
},
status
:
'online'
,
is_deleted
:
0
}
});
let
images
=
[];
for
(
const
v
of
imageInfo
)
{
const
image
=
v
.
is_video
>
0
?
{
url
:
v
.
video_url
,
type
:
1
}
:
{
url
:
v
.
image_url
,
type
:
0
};
image
.
type_id
=
v
.
type_id
;
images
.
push
(
image
);
}
images
=
_
.
groupBy
(
images
,
'type_id'
);
const
result
=
[];
const
result
=
[];
for
(
const
v
of
classes
.
rows
)
{
for
(
const
v
of
classes
)
{
const
tmp
=
{
const
tmp
=
{
id
:
v
.
id
,
id
:
v
.
id
,
name
:
v
.
name
,
name
:
v
.
name
,
images
:
ctx
.
isEmpty
(
images
[
v
.
id
])
?
[]
:
images
[
v
.
id
],
institution_id
:
v
.
institution_id
,
institution_id
:
v
.
institution_id
,
institution_name
:
ctx
.
isEmpty
(
institutions
[
v
.
institution_id
])
?
''
:
institutions
[
v
.
institution_id
][
0
].
name
,
institution_name
:
ctx
.
isEmpty
(
institutions
[
v
.
institution_id
])
?
''
:
institutions
[
v
.
institution_id
][
0
].
name
,
logo
:
ctx
.
isEmpty
(
institutions
[
v
.
institution_id
])
?
''
:
institutions
[
v
.
institution_id
][
0
].
logo
,
logo
:
ctx
.
isEmpty
(
institutions
[
v
.
institution_id
])
?
''
:
institutions
[
v
.
institution_id
][
0
].
logo
,
...
...
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