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
2a10da11
Commit
2a10da11
authored
Jul 23, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
e45b377b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
23 deletions
+54
-23
forumIdentifyUser.js
app/controllers/admin/forumIdentifyUser.js
+41
-5
forumLimitActionRef.js
app/controllers/admin/forumLimitActionRef.js
+0
-17
forumThread.js
app/controllers/admin/forumThread.js
+13
-1
No files found.
app/controllers/admin/forumIdentifyUser.js
View file @
2a10da11
...
...
@@ -5,6 +5,7 @@ var express = require('express'),
_
=
require
(
'lodash'
);
var
mongoose
=
require
(
'mongoose'
);
var
moment
=
require
(
'moment'
);
var
forumUserService
=
require
(
'../../service/forumUserService'
);
var
forumThreadService
=
require
(
'../../service/forumThreadService'
);
var
httpService
=
require
(
'../../service/httpService'
);
...
...
@@ -18,10 +19,27 @@ module.exports = function(app) {
app
.
use
(
'/admin/forum'
,
router
);
};
//格式化日期 (格式:年-月-日)
function
date_format
(
date
)
{
return
moment
(
date
).
format
(
'YYYY-MM-DD'
);
}
//判断时间是否在指定范围
function
compareTime
(
now
,
begin_time
,
end_time
)
{
now
=
date_format
(
now
);
begin_time
=
date_format
(
begin_time
);
end_time
=
date_format
(
end_time
);
if
(
moment
(
now
).
isSame
(
begin_time
)
||
moment
(
now
).
isSame
(
end_time
))
{
//如果等于开始时间或者结束时间
return
true
;
}
else
{
return
moment
(
now
).
isBetween
(
begin_time
,
end_time
);
}
}
var
checkLimitAction
=
function
(
req
,
res
)
{
var
mid
=
req
.
session
.
mobileForumUser
.
userId
;
if
(
mid
){
req
.
session
.
mobileForumUser
.
limit_action
=
[];
var
array
=
[];
forumLimitActionRefService
.
getLimitActionRefByMid
(
mid
,
function
(
err
,
forumLimitActionRef
){
if
(
err
)
{
console
.
error
(
err
);
...
...
@@ -38,9 +56,10 @@ var checkLimitAction = function(req, res) {
result
:
flag
,
code
:
limit_action
.
limit_action_type
}
req
.
session
.
mobileForumUser
.
limit_actions
.
push
(
obj
);
res
.
json
(
'success'
);
array
.
push
(
obj
);
}
req
.
session
.
mobileForumUser
.
limit_actions
=
array
;
res
.
json
(
'success'
);
}
else
{
req
.
session
.
mobileForumUser
.
limit_actions
=
null
;
res
.
json
(
'success'
);
...
...
@@ -92,9 +111,26 @@ router.post('/user/identifyUser',function(req,res,next){
});
//微信分享带来用户
router
.
get
(
'/user/from/share'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
query
.
mid
,
action
=
req
.
query
.
action
,
ent_code
=
req
.
query
.
ent_code
;
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
flag
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
}
}
});
// httpService.sendRequest(ent_code,mid,action);
// res.status(200).end();
});
\ No newline at end of file
app/controllers/admin/forumLimitActionRef.js
View file @
2a10da11
...
...
@@ -13,23 +13,6 @@ module.exports = function(app) {
app
.
use
(
'/admin/forum'
,
router
);
};
//格式化日期 (格式:年-月-日)
// function date_format(date) {
// return moment(date).format('YYYY-MM-DD');
// }
//判断时间是否在指定范围
// function compareTime(now, begin_time, end_time) {
// now = date_format(now);
// begin_time = date_format(begin_time);
// end_time = date_format(end_time);
// if (moment(now).isSame(begin_time) || moment(now).isSame(end_time)) { //如果等于开始时间或者结束时间
// return true;
// } else {
// return moment(now).isBetween(begin_time, end_time);
// }
// }
//新增或更新论坛行为限制
router
.
post
(
'/limitActionRef/createOrUpdate'
,
function
(
req
,
res
,
next
)
{
var
ent_code
=
req
.
session
.
user
.
ent_code
;
...
...
app/controllers/admin/forumThread.js
View file @
2a10da11
...
...
@@ -224,7 +224,19 @@ router.post('/thread/:tid/:fid/recommend', function(req, res, next) {
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
mid
){
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
isProhibition
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
httpService
.
sendRequest
(
ent_code
,
mid
,
'thread_recomment'
);
res
.
json
(
returnCode
.
SUCCESS
);
}
}
});
}
res
.
json
(
returnCode
.
SUCCESS
);
}
...
...
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