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
f23fa5ca
Commit
f23fa5ca
authored
Apr 26, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format price_type & mode
parent
2f522f2e
Pipeline
#22272
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
institution.js
app/service/course/v5/institution.js
+25
-0
No files found.
app/service/course/v5/institution.js
View file @
f23fa5ca
...
@@ -76,6 +76,8 @@ class InstitutionSubService extends Service {
...
@@ -76,6 +76,8 @@ class InstitutionSubService extends Service {
}
}
}
}
}
}
classList
.
rows
[
i
].
price_type
=
await
this
.
getClassPriceType
(
classList
.
rows
[
i
].
price_type
);
classList
.
rows
[
i
].
mode
=
await
this
.
getClassMode
(
classList
.
rows
[
i
].
mode
);
classList
.
rows
[
i
].
category
=
classCategoryList
;
classList
.
rows
[
i
].
category
=
classCategoryList
;
classList
.
rows
[
i
].
institution_name
=
ctx
.
isEmpty
(
institutionList
[
classList
.
rows
[
i
].
institution_id
])
?
''
:
institutionList
[
classList
.
rows
[
i
].
institution_id
][
0
].
name
;
classList
.
rows
[
i
].
institution_name
=
ctx
.
isEmpty
(
institutionList
[
classList
.
rows
[
i
].
institution_id
])
?
''
:
institutionList
[
classList
.
rows
[
i
].
institution_id
][
0
].
name
;
classList
.
rows
[
i
].
institution_logo
=
ctx
.
isEmpty
(
institutionList
[
classList
.
rows
[
i
].
institution_id
])
?
''
:
institutionList
[
classList
.
rows
[
i
].
institution_id
][
0
].
logo
;
classList
.
rows
[
i
].
institution_logo
=
ctx
.
isEmpty
(
institutionList
[
classList
.
rows
[
i
].
institution_id
])
?
''
:
institutionList
[
classList
.
rows
[
i
].
institution_id
][
0
].
logo
;
...
@@ -150,6 +152,8 @@ class InstitutionSubService extends Service {
...
@@ -150,6 +152,8 @@ class InstitutionSubService extends Service {
}
}
classInfo
.
columns
=
columns
;
classInfo
.
columns
=
columns
;
classInfo
.
price_type
=
await
this
.
getClassPriceType
(
classInfo
.
price_type
);
classInfo
.
mode
=
await
this
.
getClassMode
(
classInfo
.
mode
);
classInfo
.
student_works
=
studentWorks
;
classInfo
.
student_works
=
studentWorks
;
classInfo
.
images
=
images
;
classInfo
.
images
=
images
;
classInfo
.
category
=
category
;
classInfo
.
category
=
category
;
...
@@ -173,6 +177,10 @@ class InstitutionSubService extends Service {
...
@@ -173,6 +177,10 @@ class InstitutionSubService extends Service {
const
collectedIds
=
R
.
pluck
(
'type_id'
,
userCollection
.
rows
);
const
collectedIds
=
R
.
pluck
(
'type_id'
,
userCollection
.
rows
);
const
filter
=
{
where
:
{
id
:
{
$in
:
collectedIds
},
status
:
1
,
is_deleted
:
0
},
page_size
,
offset
,
attributes
,
raw
:
true
};
const
filter
=
{
where
:
{
id
:
{
$in
:
collectedIds
},
status
:
1
,
is_deleted
:
0
},
page_size
,
offset
,
attributes
,
raw
:
true
};
const
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
(
filter
);
const
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
(
filter
);
for
(
const
i
in
classList
)
{
classList
[
i
].
price_type
=
await
this
.
getClassPriceType
(
classList
[
i
].
price_type
);
classList
[
i
].
mode
=
await
this
.
getClassMode
(
classList
[
i
].
mode
);
}
const
ret
=
{
const
ret
=
{
list
:
classList
,
list
:
classList
,
...
@@ -247,6 +255,23 @@ class InstitutionSubService extends Service {
...
@@ -247,6 +255,23 @@ class InstitutionSubService extends Service {
return
ret
;
return
ret
;
}
}
// 课程类型映射
async
getClassPriceType
(
key
)
{
const
list
=
[
'免费公益课'
,
'低价体验课'
,
'正价课'
];
const
ret
=
(
key
>
0
&&
key
<=
list
.
length
)
?
list
[
key
-
1
]
:
''
;
return
ret
;
}
// 课程状态映射
async
getClassMode
(
key
)
{
const
list
=
[
'直播'
,
'录播(动画)'
,
'录播(真人)'
,
'APP'
,
'小程序'
];
const
ret
=
(
key
>
0
&&
key
<=
list
.
length
)
?
list
[
key
-
1
]
:
''
;
return
ret
;
}
}
}
module
.
exports
=
InstitutionSubService
;
module
.
exports
=
InstitutionSubService
;
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