Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
67ccf128
Commit
67ccf128
authored
Jun 23, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加文章加精功能
parent
1f64524f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
5 deletions
+67
-5
forumThread.js
app/controllers/admin/forumThread.js
+37
-0
forumThread.js
app/models/forumThread.js
+8
-3
forumThreadService.js
app/service/forumThreadService.js
+20
-1
httpService.js
app/service/httpService.js
+2
-1
No files found.
app/controllers/admin/forumThread.js
View file @
67ccf128
...
...
@@ -211,7 +211,44 @@ router.post('/thread/:tid/:fid/unTop', function(req, res, next) {
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//文章推荐
router
.
post
(
'/thread/:tid/:fid/recommend'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
,
fid
=
req
.
params
.
fid
,
ent_code
=
req
.
session
.
user
.
ent_code
,
mid
=
req
.
params
.
mid
;
//板块ID
if
(
tid
&&
fid
)
{
forumThreadService
.
updateRecommendByThreadId
(
tid
,
function
(
err
,
thread
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
mid
){
httpService
.
sendRequest
(
ent_code
,
mid
,
'thread_recomment'
);
}
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//文章取消推荐
router
.
post
(
'/thread/:tid/:fid/unRecommend'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
;
//文章ID
var
fid
=
req
.
params
.
fid
;
//板块ID
if
(
tid
&&
fid
)
{
forumThreadService
.
updateUnRecommendByThreadId
(
tid
,
function
(
err
,
thread
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
/**
* [description]
* @param {[type]}
...
...
app/models/forumThread.js
View file @
67ccf128
...
...
@@ -60,8 +60,8 @@ var ForumThreadSchema = new Schema({
},
topTime
:{
//置顶时间
type
:
Date
}
,
tag_top
:
{
//标签话题是否置顶0否,1是
}
,
tag_top
:
{
//标签话题是否置顶0否,1是
type
:
Number
,
require
:
true
,
default
:
0
...
...
@@ -107,7 +107,12 @@ var ForumThreadSchema = new Schema({
type
:
Number
,
require
:
true
,
default
:
1
},
},
recommend
:{
//是否推荐 0否 1是
type
:
Number
,
require
:
true
,
default
:
0
},
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/service/forumThreadService.js
View file @
67ccf128
...
...
@@ -585,7 +585,26 @@ exports.updateUnTopByThreadId = function(infoId, threadId, callback) {
}
});
};
//根据文章ID更新文章为推荐
exports
.
updateRecommendByThreadId
=
function
(
threadId
,
callback
)
{
ForumThread
.
findOneAndUpdate
({
_id
:
threadId
},
{
recommend
:
1
},
function
(
err
,
doc
)
{
callback
(
err
,
null
);
});
};
//根据文章ID更新文章为不推荐
exports
.
updateUnRecommendByThreadId
=
function
(
threadId
,
callback
)
{
ForumThread
.
findOneAndUpdate
({
_id
:
threadId
},
{
recommend
:
0
},
function
(
err
,
doc
)
{
callback
(
err
,
null
);
});
};
//根据板块ID更新标签置顶(置顶)
exports
.
updateTagTop
=
function
(
tid
,
tag_top
,
callback
){
var
time
=
''
;
...
...
app/service/httpService.js
View file @
67ccf128
...
...
@@ -10,7 +10,8 @@ var ACTION_KEY = {
'thread_praise'
:
'FORUM_THREAD_PRAISE'
,
'comment_praise'
:
'FORUM_COMMENT_PRAISE'
,
'reply'
:
'FORUM_COMMENT_REPLY'
,
'user_from_share'
:
'FORUM_USER_FROM_SHARE'
'user_from_share'
:
'FORUM_USER_FROM_SHARE'
,
'thread_recomment'
:
'FORUM_THREAD_RECOMMENT'
};
var
mongoose
=
require
(
'mongoose'
),
moment
=
require
(
'moment'
),
...
...
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