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
877ca096
Commit
877ca096
authored
Jul 23, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
222
parent
6ee6cf1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
17 deletions
+33
-17
forumLimitActionRefService.js
app/service/forumLimitActionRefService.js
+33
-17
No files found.
app/service/forumLimitActionRefService.js
View file @
877ca096
...
...
@@ -36,8 +36,8 @@ function countAll(conditions,callback) {
}
//获取单个行为限制
function
getLimitActionRef
(
mi
d
,
callback
){
ForumLimitActionRef
.
findOne
({
mid
:
mi
d
},
function
(
err
,
role
)
{
function
getLimitActionRef
(
userI
d
,
callback
){
ForumLimitActionRef
.
findOne
({
userId
:
userI
d
},
function
(
err
,
role
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
@@ -90,8 +90,8 @@ exports.createLimitActionRef=function(entity,callback){
};
//根据MID和EntCode获取
exports
.
getLimitActionRefByMIdAndEntCode
=
function
(
mi
d
,
ent_code
,
callback
){
ForumLimitActionRef
.
findOne
({
mid
:
mi
d
,
ent_code
:
ent_code
},
function
(
err
,
role
)
{
exports
.
getLimitActionRefByMIdAndEntCode
=
function
(
userI
d
,
ent_code
,
callback
){
ForumLimitActionRef
.
findOne
({
userId
:
userI
d
,
ent_code
:
ent_code
},
function
(
err
,
role
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
@@ -102,8 +102,8 @@ exports.getLimitActionRefByMIdAndEntCode=function(mid,ent_code,callback){
};
//根据MID获取
exports
.
getLimitActionRefByMid
=
function
(
mi
d
,
callback
){
getLimitActionRef
(
mi
d
,
function
(
err
,
role
)
{
exports
.
getLimitActionRefByMid
=
function
(
userI
d
,
callback
){
getLimitActionRef
(
userI
d
,
function
(
err
,
role
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
@@ -165,10 +165,10 @@ exports.getAllLimitActionRef= function(conditions,callback) {
//检查用户是否被禁言
exports
.
checkLimitActionProhibitionOfSpeech
=
function
(
mi
d
,
callback
)
{
if
(
mi
d
){
exports
.
checkLimitActionProhibitionOfSpeech
=
function
(
userI
d
,
callback
)
{
if
(
userI
d
){
var
isProhibition
=
false
;
getLimitActionRef
(
mi
d
,
function
(
err
,
forumLimitActionRef
){
getLimitActionRef
(
userI
d
,
function
(
err
,
forumLimitActionRef
){
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
@@ -179,8 +179,15 @@ exports.checkLimitActionProhibitionOfSpeech = function(mid,callback) {
for
(
var
i
=
0
;
i
<
limit_actions
.
length
;
i
+=
1
)
{
var
limit_action
=
limit_actions
[
i
];
if
(
limit_action
.
limit_action_type
==
'forum_prohibition_of_speech'
){
isProhibition
=
compareTime
(
new
Date
(),
limit_action
.
begin_time
,
limit_action
.
end_time
);
break
;
if
(
limit_action
.
begin_time
&&
limit_action
.
end_time
){
var
begin_time
=
new
Date
(
limit_action
.
begin_time
).
getTime
(),
ent_time
=
new
Date
(
limit_action
.
end_time
).
getTime
(),
now
=
new
Date
().
getTime
();
if
(
now
>=
begin_time
&&
now
<=
ent_time
){
isProhibition
=
true
;
break
;
}
}
}
}
callback
(
null
,
isProhibition
);
...
...
@@ -196,10 +203,10 @@ exports.checkLimitActionProhibitionOfSpeech = function(mid,callback) {
//检查用户是否被禁加积分
exports
.
checkLimitActionProhibitionAddIntegral
=
function
(
mi
d
,
callback
)
{
if
(
mi
d
){
exports
.
checkLimitActionProhibitionAddIntegral
=
function
(
userI
d
,
callback
)
{
if
(
userI
d
){
var
isProhibition
=
false
;
getLimitActionRef
(
mi
d
,
function
(
err
,
forumLimitActionRef
){
getLimitActionRef
(
userI
d
,
function
(
err
,
forumLimitActionRef
){
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
@@ -210,12 +217,21 @@ exports.checkLimitActionProhibitionAddIntegral = function(mid,callback) {
for
(
var
i
=
0
;
i
<
limit_actions
.
length
;
i
+=
1
)
{
var
limit_action
=
limit_actions
[
i
];
if
(
limit_action
.
limit_action_type
==
'forum_not_add_integral'
){
isProhibition
=
compareTime
(
new
Date
(),
limit_action
.
begin_time
,
limit_action
.
end_time
);
break
;
if
(
limit_action
.
begin_time
&&
limit_action
.
end_time
){
var
begin_time
=
new
Date
(
limit_action
.
begin_time
).
getTime
(),
ent_time
=
new
Date
(
limit_action
.
end_time
).
getTime
(),
now
=
new
Date
().
getTime
();
if
(
now
>=
begin_time
&&
now
<=
ent_time
){
isProhibition
=
true
;
break
;
}
}
}
}
if
(
isProhibition
){
console
.
log
(
'送积分'
);
console
.
log
(
'Integral:!送积分'
);
}
else
{
console
.
log
(
'Integral:送积分'
);
}
callback
(
null
,
isProhibition
);
}
else
{
...
...
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