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
1fd82056
Commit
1fd82056
authored
Jul 21, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2222
parent
66894048
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
27 deletions
+31
-27
forumIdentifyUser.js
app/controllers/admin/forumIdentifyUser.js
+16
-12
forumLimitActionRef.js
app/controllers/admin/forumLimitActionRef.js
+15
-15
No files found.
app/controllers/admin/forumIdentifyUser.js
View file @
1fd82056
...
...
@@ -28,6 +28,7 @@ var checkLimitAction = function(req) {
res
.
json
(
'success'
);
}
else
{
// 获取到用户行为限制记录
if
(
forumLimitActionRef
){
var
limit_actions
=
forumLimitActionRef
.
limit_actions
;
for
(
var
i
=
0
;
i
<
limit_actions
.
length
;
i
+=
1
)
{
var
limit_action
=
limit_actions
[
i
];
...
...
@@ -40,6 +41,9 @@ var checkLimitAction = function(req) {
req
.
session
.
mobileForumUser
.
limit_actions
.
push
(
obj
);
res
.
json
(
'success'
);
}
}
else
{
res
.
json
(
'success'
);
}
}
});
}
else
{
...
...
app/controllers/admin/forumLimitActionRef.js
View file @
1fd82056
...
...
@@ -14,21 +14,21 @@ module.exports = function(app) {
};
//格式化日期 (格式:年-月-日)
function
date_format
(
date
)
{
return
moment
(
date
).
format
(
'YYYY/MM/
DD'
);
}
//
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
);
}
}
//
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
)
{
...
...
@@ -50,8 +50,8 @@ router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
for
(
var
i
in
selects
)
{
for
(
var
j
in
results
)
{
if
(
selects
[
i
]
===
results
[
j
].
_id
.
toString
())
{
var
begin_time
=
moment
().
format
(
'YYYY-MM-DD'
);
var
end_time
=
moment
().
add
(
results
[
j
].
limit_time
,
'days'
).
format
(
'YYYY-MM-DD'
);
var
begin_time
=
moment
(
new
Date
()
).
format
(
'YYYY-MM-DD'
);
var
end_time
=
moment
(
new
Date
()
).
add
(
results
[
j
].
limit_time
,
'days'
).
format
(
'YYYY-MM-DD'
);
var
obj
=
{
limit_action
:
selects
[
i
],
limit_action_type
:
results
[
j
].
limit_action_type
,
...
...
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