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
bcc5732c
Commit
bcc5732c
authored
Dec 13, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add is_like
parent
dac77dcf
Pipeline
#18121
passed with stage
in 1 minute 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
institution.js
app/service/course/v3/institution.js
+8
-0
No files found.
app/service/course/v3/institution.js
View file @
bcc5732c
...
@@ -659,6 +659,9 @@ class InstitutionSubService extends Service {
...
@@ -659,6 +659,9 @@ class InstitutionSubService extends Service {
const
articles
=
await
ctx
.
classModel
.
V3
.
CourseArticle
.
findAndCountAll
(
filter
);
const
articles
=
await
ctx
.
classModel
.
V3
.
CourseArticle
.
findAndCountAll
(
filter
);
const
ret
=
[];
const
ret
=
[];
//用户点赞列表
const
userLikes
=
await
ctx
.
classModel
.
V3
.
CourseLike
.
findAll
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
type
:
1
,
is_deleted
:
0
}});
const
userLikeIds
=
R
.
pluck
(
'type_id'
,
userLikes
);
for
(
const
v
of
articles
.
rows
)
{
for
(
const
v
of
articles
.
rows
)
{
ret
.
push
({
ret
.
push
({
id
:
v
.
id
,
id
:
v
.
id
,
...
@@ -672,6 +675,7 @@ class InstitutionSubService extends Service {
...
@@ -672,6 +675,7 @@ class InstitutionSubService extends Service {
like_count
:
v
.
like_count
,
like_count
:
v
.
like_count
,
read_count
:
v
.
read_count
,
read_count
:
v
.
read_count
,
sort
:
v
.
sort
,
sort
:
v
.
sort
,
is_like
:
userLikeIds
.
includes
(
v
.
id
)
?
1
:
0
,
created_time
:
v
.
created_time
,
created_time
:
v
.
created_time
,
});
});
}
}
...
@@ -690,6 +694,9 @@ class InstitutionSubService extends Service {
...
@@ -690,6 +694,9 @@ class InstitutionSubService extends Service {
await
ctx
.
classModel
.
V3
.
CourseArticle
.
update
({
read_count
:
sequelize
.
literal
(
'`read_count` + 1'
)
},
{
where
:
{
id
}
});
await
ctx
.
classModel
.
V3
.
CourseArticle
.
update
({
read_count
:
sequelize
.
literal
(
'`read_count` + 1'
)
},
{
where
:
{
id
}
});
//用户是否点赞
const
userLike
=
await
ctx
.
classModel
.
V3
.
CourseLike
.
findOne
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
type
:
1
,
type_id
:
id
,
is_deleted
:
0
}});
const
ret
=
{
const
ret
=
{
id
:
article
.
id
,
id
:
article
.
id
,
type
:
article
.
type
,
type
:
article
.
type
,
...
@@ -702,6 +709,7 @@ class InstitutionSubService extends Service {
...
@@ -702,6 +709,7 @@ class InstitutionSubService extends Service {
like_count
:
article
.
like_count
,
like_count
:
article
.
like_count
,
read_count
:
article
.
read_count
,
read_count
:
article
.
read_count
,
sort
:
article
.
sort
,
sort
:
article
.
sort
,
is_like
:
ctx
.
isEmpty
(
userLike
)
?
0
:
1
,
created_time
:
article
.
created_time
,
created_time
:
article
.
created_time
,
};
};
...
...
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