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
458d8305
Commit
458d8305
authored
Feb 20, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix online bugs
parent
6c56e7c3
Pipeline
#19449
passed with stage
in 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
online.js
app/service/course/v4/online.js
+11
-8
No files found.
app/service/course/v4/online.js
View file @
458d8305
...
...
@@ -11,13 +11,14 @@ class OnlineService extends Service {
async
getOption
()
{
const
{
ctx
}
=
this
;
// 分类
const
cats
=
await
ctx
.
classModel
.
V4
.
CourseOnlineCat
.
findAll
({
where
:
{
status
:
'online'
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
]
});
const
cats
=
await
ctx
.
classModel
.
V4
.
CourseOnlineCat
.
findAll
({
where
:
{
status
:
'online'
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
],
raw
:
true
});
cats
.
push
({
id
:
0
,
name
:
'全部'
});
// 年龄段
const
ages
=
[
'学龄前'
,
'幼儿园'
,
'小学'
,
'初中'
,
'高中'
];
const
ages
=
[
'
全部'
,
'
学龄前'
,
'幼儿园'
,
'小学'
,
'初中'
,
'高中'
];
// 课程状态
const
mode
=
[{
id
:
0
,
name
:
'全部'
},
{
id
:
1
,
name
:
'直播'
},
{
id
:
2
,
name
:
'录播'
}];
// 课程班型
const
type
=
[
'1对1'
,
'1对多'
,
'讲座'
];
const
type
=
[
'
全部'
,
'
1对1'
,
'1对多'
,
'讲座'
];
const
options
=
{
cats
,
...
...
@@ -38,10 +39,11 @@ class OnlineService extends Service {
}
// 缩略图
const
imageInfo
=
await
ctx
.
classModel
.
V4
.
CourseImages
.
findOne
({
where
:
{
type
:
5
,
type_id
:
id
,
status
:
'online'
,
is_deleted
:
0
}
});
let
image
=
{};
if
(
!
ctx
.
isEmpty
(
imageInfo
))
{
image
=
imageInfo
.
is_video
>
0
?
{
url
:
imageInfo
.
video_url
,
type
:
1
}
:
{
url
:
imageInfo
.
image_url
,
type
:
0
};
const
imageInfo
=
await
ctx
.
classModel
.
V4
.
CourseImages
.
findAll
({
where
:
{
type
:
5
,
type_id
:
id
,
status
:
'online'
,
is_deleted
:
0
}
});
const
images
=
[];
for
(
const
v
of
imageInfo
)
{
const
image
=
v
.
is_video
>
0
?
{
url
:
v
.
video_url
,
type
:
1
}
:
{
url
:
v
.
image_url
,
type
:
0
};
images
.
push
(
image
);
}
// 机构信息
...
...
@@ -61,10 +63,11 @@ class OnlineService extends Service {
const
ret
=
{
id
,
image
,
image
s
,
name
:
classInfo
.
name
,
institution_name
:
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
name
,
institution_id
:
classInfo
.
institution_id
,
institution_logo
:
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
logo
,
relation_institution_id
:
ctx
.
isEmpty
(
institution
)
?
0
:
institution
.
relation_id
,
address
:
ctx
.
isEmpty
(
area
)
?
''
:
area
.
address
,
phone
:
ctx
.
isEmpty
(
area
)
?
''
:
area
.
phone
,
...
...
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