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
1e8d3212
Commit
1e8d3212
authored
Dec 13, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix auth
parent
bcc5732c
Pipeline
#18125
passed with stage
in 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
user.js
app/controller/course/v3/user.js
+1
-1
institution.js
app/service/course/v3/institution.js
+6
-6
No files found.
app/controller/course/v3/user.js
View file @
1e8d3212
...
...
@@ -28,7 +28,7 @@ class UserController extends Controller {
console
.
info
(
user
);
// 存储缓存标识
const
user_uuid
=
user
.
uuid
;
const
key
=
'course_v
2
_user_session_'
+
user_uuid
;
const
key
=
'course_v
3
_user_session_'
+
user_uuid
;
await
app
.
memcache
.
set
(
key
,
{
user_uuid
,
openid
,
session_key
},
86400
*
7
);
const
auth_token
=
ctx
.
helper
.
md5
(
openid
+
user_uuid
+
'jbwl'
);
ctx
.
set
(
'uuid'
,
key
);
...
...
app/service/course/v3/institution.js
View file @
1e8d3212
...
...
@@ -659,8 +659,8 @@ class InstitutionSubService extends Service {
const
articles
=
await
ctx
.
classModel
.
V3
.
CourseArticle
.
findAndCountAll
(
filter
);
const
ret
=
[];
//用户点赞列表
const
userLikes
=
await
ctx
.
classModel
.
V3
.
CourseLike
.
findAll
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
type
:
1
,
is_deleted
:
0
}
});
//
用户点赞列表
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
)
{
ret
.
push
({
...
...
@@ -694,8 +694,8 @@ class InstitutionSubService extends Service {
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
userLike
=
await
ctx
.
classModel
.
V3
.
CourseLike
.
findOne
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
type
:
1
,
type_id
:
id
,
is_deleted
:
0
}
});
const
ret
=
{
id
:
article
.
id
,
...
...
@@ -752,7 +752,7 @@ class InstitutionSubService extends Service {
return
;
}
//取消点赞
//
取消点赞
async
unlike
(
input
)
{
const
{
ctx
}
=
this
;
const
type
=
Number
(
input
.
type
)
||
0
;
...
...
@@ -783,7 +783,7 @@ class InstitutionSubService extends Service {
break
;
}
await
ctx
.
classModel
.
V3
.
CourseLike
.
update
({
is_deleted
:
1
},
{
where
:{
id
:
userLike
.
id
}
});
await
ctx
.
classModel
.
V3
.
CourseLike
.
update
({
is_deleted
:
1
},
{
where
:
{
id
:
userLike
.
id
}
});
return
;
}
}
...
...
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