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
50b9f172
Commit
50b9f172
authored
Nov 20, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在社区帖子中增加quality字段
parent
1bd68356
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
110 deletions
+183
-110
forumThread.js
app/controllers/admin/forumThread.js
+160
-105
forumThread.js
app/models/forumThread.js
+5
-0
forumThreadService.js
app/service/forumThreadService.js
+18
-5
No files found.
app/controllers/admin/forumThread.js
View file @
50b9f172
This diff is collapsed.
Click to expand it.
app/models/forumThread.js
View file @
50b9f172
...
...
@@ -113,6 +113,11 @@ var ForumThreadSchema = new Schema({
require
:
true
,
default
:
0
},
quality
:{
//质量 高:100,中:50,低:0
type
:
Number
,
require
:
true
,
default
:
50
},
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/service/forumThreadService.js
View file @
50b9f172
...
...
@@ -17,7 +17,7 @@ exports.findThreadByPage = function(pageNo, pageSize, q, callback) {
}).
then
(
function
(
cont
,
count
)
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
ForumThread
.
find
(
q
).
skip
(
skip
).
limit
(
limit
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
ForumThread
.
find
(
q
).
skip
(
skip
).
limit
(
limit
).
sort
(
'-
quality -
created'
).
exec
(
function
(
err
,
docs
)
{
cont
(
err
,
count
,
docs
);
});
...
...
@@ -607,7 +607,7 @@ function getSubThreads(doc, sort, callback) {
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
var
sortBy
=
'-top -created'
;
var
sortBy
=
'-top -
quality -
created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
...
...
@@ -638,7 +638,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
}
else
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
sortBy
=
'-topTime -tag_topTime -created'
;
var
sortBy
=
'-topTime -tag_topTime -
quality -
created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
...
...
@@ -706,7 +706,7 @@ function getAllThreadByFidHelpNoLimit(conditions, pageNo, pageSize, sort, callba
}
else
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
sortBy
=
'-topTime -tag_topTime -created'
;
var
sortBy
=
'-topTime -tag_topTime -
quality -
created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
...
...
@@ -1023,7 +1023,7 @@ function getAllThreadByFidAndUserHelp(user_ids, conditions, pageNo, pageSize, so
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
sortBy
=
'-topTime -tag_topTime -created'
;
var
sortBy
=
'-topTime -tag_topTime -
quality -
created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
...
...
@@ -1090,3 +1090,16 @@ exports.getAllThreadByFidAndMid = function(mid, conditions, pageNo, pageSize, so
});
}
//更新文章
exports
.
updateThread
=
function
(
condition
,
entity
,
callback
)
{
ForumThread
.
findOneAndUpdate
(
condition
,
entity
,
function
(
err
,
doc
){
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
doc
);
}
});
};
\ No newline at end of file
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