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
866ba1df
Commit
866ba1df
authored
Mar 02, 2020
by
周楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: add price_type; wechat image
parent
f7831737
Pipeline
#19774
passed with stage
in 1 minute 5 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
courseOnlineClass.js
app/model/class/v4/courseOnlineClass.js
+1
-0
online.js
app/service/course/v4/online.js
+28
-3
wechat.js
app/service/course/v4/wechat.js
+0
-0
No files found.
app/model/class/v4/courseOnlineClass.js
View file @
866ba1df
...
@@ -14,6 +14,7 @@ module.exports = app => {
...
@@ -14,6 +14,7 @@ module.exports = app => {
institution_id
:
INTEGER
,
institution_id
:
INTEGER
,
name
:
STRING
,
name
:
STRING
,
price
:
STRING
,
price
:
STRING
,
price_type
:
INTEGER
,
mode
:
INTEGER
,
mode
:
INTEGER
,
time
:
STRING
,
time
:
STRING
,
channel
:
TEXT
,
channel
:
TEXT
,
...
...
app/service/course/v4/online.js
View file @
866ba1df
...
@@ -21,12 +21,15 @@ class OnlineService extends Service {
...
@@ -21,12 +21,15 @@ class OnlineService extends Service {
// 课程班型
// 课程班型
let
type
=
await
ctx
.
classModel
.
V4
.
CourseOnlineType
.
findAll
({
where
:
{
status
:
'online'
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
],
raw
:
true
});
let
type
=
await
ctx
.
classModel
.
V4
.
CourseOnlineType
.
findAll
({
where
:
{
status
:
'online'
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
],
raw
:
true
});
type
=
[{
id
:
0
,
name
:
'全部'
}].
concat
(
type
);
type
=
[{
id
:
0
,
name
:
'全部'
}].
concat
(
type
);
// 课程类型
const
price_type
=
[{
id
:
1
,
name
:
'低价体验课'
},
{
id
:
2
,
name
:
'公益免费课'
},
{
id
:
3
,
name
:
'正价课'
}];
const
options
=
{
const
options
=
{
cats
,
cats
,
ages
,
ages
,
mode
,
mode
,
type
,
// type,
price_type
,
};
};
return
options
;
return
options
;
}
}
...
@@ -105,7 +108,7 @@ class OnlineService extends Service {
...
@@ -105,7 +108,7 @@ class OnlineService extends Service {
const
page
=
Number
(
input
.
page
)
||
1
;
const
page
=
Number
(
input
.
page
)
||
1
;
const
limit
=
Number
(
input
.
limit
)
||
10
;
const
limit
=
Number
(
input
.
limit
)
||
10
;
const
offset
=
(
page
-
1
)
*
limit
;
const
offset
=
(
page
-
1
)
*
limit
;
const
{
type
,
mode
,
age
,
cat
}
=
input
;
const
{
type
,
mode
,
age
,
cat
,
price_type
}
=
input
;
const
filter
=
{
where
:
{
status
:
'online'
,
is_deleted
:
0
},
order
:
[[
'institution_id'
,
'desc'
]],
limit
,
offset
,
attributes
:
[
'id'
,
'institution_id'
,
'name'
,
'price'
,
'mode'
,
'time'
,
'created_time'
]
};
const
filter
=
{
where
:
{
status
:
'online'
,
is_deleted
:
0
},
order
:
[[
'institution_id'
,
'desc'
]],
limit
,
offset
,
attributes
:
[
'id'
,
'institution_id'
,
'name'
,
'price'
,
'mode'
,
'time'
,
'created_time'
]
};
// 年龄段筛选
// 年龄段筛选
let
ids
=
[];
let
ids
=
[];
...
@@ -133,6 +136,10 @@ class OnlineService extends Service {
...
@@ -133,6 +136,10 @@ class OnlineService extends Service {
if
(
!
ctx
.
isEmpty
(
mode
)
&&
Number
(
mode
)
>
0
)
{
if
(
!
ctx
.
isEmpty
(
mode
)
&&
Number
(
mode
)
>
0
)
{
filter
.
where
.
mode
=
mode
;
filter
.
where
.
mode
=
mode
;
}
}
// 课程类型筛选
if
(
!
ctx
.
isEmpty
(
price_type
)
&&
Number
(
price_type
)
>
0
)
{
filter
.
where
.
price_type
=
price_type
;
}
// 课程班型筛选
// 课程班型筛选
if
(
!
ctx
.
isEmpty
(
type
)
&&
Number
(
type
)
>
0
)
{
if
(
!
ctx
.
isEmpty
(
type
)
&&
Number
(
type
)
>
0
)
{
const
classes
=
await
ctx
.
classModel
.
V4
.
CourseOnlineClassToType
.
findAll
({
where
:
{
type_id
:
type
,
status
:
'online'
,
is_deleted
:
0
},
attributes
:
[
'class_id'
]
});
const
classes
=
await
ctx
.
classModel
.
V4
.
CourseOnlineClassToType
.
findAll
({
where
:
{
type_id
:
type
,
status
:
'online'
,
is_deleted
:
0
},
attributes
:
[
'class_id'
]
});
...
@@ -213,6 +220,7 @@ class OnlineService extends Service {
...
@@ -213,6 +220,7 @@ class OnlineService extends Service {
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
,
type
:
ctx
.
isEmpty
(
classTypes
[
v
.
id
])
?
[]
:
classTypes
[
v
.
id
],
type
:
ctx
.
isEmpty
(
classTypes
[
v
.
id
])
?
[]
:
classTypes
[
v
.
id
],
mode
:
await
this
.
getClassModelInfo
(
v
.
mode
),
mode
:
await
this
.
getClassModelInfo
(
v
.
mode
),
price_type
:
this
.
getClassModelInfo
(
v
.
price_type
),
price
:
v
.
price
,
price
:
v
.
price
,
time
:
v
.
time
,
time
:
v
.
time
,
created_time
:
v
.
created_time
,
created_time
:
v
.
created_time
,
...
@@ -246,10 +254,27 @@ class OnlineService extends Service {
...
@@ -246,10 +254,27 @@ class OnlineService extends Service {
default
:
default
:
break
;
break
;
}
}
return
ret
;
return
ret
;
}
}
// 判断课程类型
getClassModelPriceType
(
price_type
)
{
let
ret
=
''
;
switch
(
price_type
)
{
case
1
:
ret
=
'低价体验课'
;
break
;
case
2
:
ret
=
'公益免费课'
;
break
;
case
3
:
ret
=
'正价课'
;
break
;
default
:
break
;
}
return
ret
;
}
// 收藏在线课程
// 收藏在线课程
async
collectClass
(
id
)
{
async
collectClass
(
id
)
{
...
...
app/service/course/v4/wechat.js
View file @
866ba1df
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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