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
fcdc61b9
Commit
fcdc61b9
authored
Jul 11, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merged branch remould_0627_forum_management into master
parents
627a03c4
f28fcb7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
13 deletions
+66
-13
forumInfo.js
app/controllers/admin/forumInfo.js
+52
-13
forumThreadService.js
app/service/forumThreadService.js
+10
-0
returnCode.js
app/utils/returnCode.js
+4
-0
No files found.
app/controllers/admin/forumInfo.js
View file @
fcdc61b9
...
...
@@ -5,7 +5,8 @@ var express = require('express'),
_
=
require
(
'lodash'
),
moment
=
require
(
'moment'
),
nodeExcel
=
require
(
'excel-export'
),
then
=
require
(
'thenjs'
);
then
=
require
(
'thenjs'
),
async
=
require
(
'async'
);
var
mongoose
=
require
(
'mongoose'
);
var
ForumInfo
=
mongoose
.
model
(
'ForumInfo'
);
...
...
@@ -144,20 +145,58 @@ router.post('/info/:fid/update', function(req, res, next) {
}
});
//删除目标论坛板块
//删除目标论坛板块
router
.
post
(
'/info/:fid/delete'
,
function
(
req
,
res
,
next
)
{
var
fid
=
req
.
params
.
fid
;
if
(
fid
){
forumInfoService
.
deleteInfoById
(
fid
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
var
fid
=
req
.
params
.
fid
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
if
(
fid
){
async
.
waterfall
([
function
(
callback
)
{
var
today
=
new
Date
();
var
conditions
=
{
ent_code
:
ent_code
,
info
:
fid
,
level
:
1
,
status
:
1
,
$or
:
[{
isEvent
:
{
$ne
:
1
}
},
{
isEvent
:
1
,
'event.eventStartTime'
:
{
$lte
:
today
}
}]
};
//统计板块有效的文章
forumThreadService
.
countThread
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
callback
(
null
,
count
);
}
});
}
],
function
(
err
,
count
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
count
>
0
){
res
.
json
(
returnCode
.
CAN_NOT_DELETE_INFO
);
}
else
{
forumInfoService
.
deleteInfoById
(
fid
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
/**
...
...
app/service/forumThreadService.js
View file @
fcdc61b9
...
...
@@ -1681,3 +1681,13 @@ exports.getThreadWithNotPopulateComment = function(conditions, pageNo, pageSize,
};
exports
.
countThread
=
function
(
conditions
,
callback
)
{
ForumThread
.
count
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
count
);
}
});
}
\ No newline at end of file
app/utils/returnCode.js
View file @
fcdc61b9
...
...
@@ -46,6 +46,10 @@ module.exports = {
errorcode
:
10008
,
errormsg
:
'内容超出限制'
},
CAN_NOT_DELETE_INFO
:
{
errorcode
:
10009
,
errormsg
:
'不能删除,请先转移版块下的帖子'
},
UNCHECK_ERROR
:
function
(
msg
){
return
{
errorcode
:
9999
,
...
...
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