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
4fa7b2d6
Commit
4fa7b2d6
authored
Sep 15, 2015
by
陈家荣
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复查询禁言和不加积分的接口BUG
parent
53abfb9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
80 deletions
+12
-80
forumIdentifyUser.js
app/controllers/admin/forumIdentifyUser.js
+12
-80
No files found.
app/controllers/admin/forumIdentifyUser.js
View file @
4fa7b2d6
...
...
@@ -9,9 +9,6 @@ var moment = require('moment');
var
forumUserService
=
require
(
'../../service/forumUserService'
);
var
forumThreadService
=
require
(
'../../service/forumThreadService'
);
var
httpService
=
require
(
'../../service/httpService'
);
// var forumLimitActionRefService=require('../../service/forumLimitActionRefService');
// var forumLimitActionConfigService=require('../../service/forumLimitActionConfigService');
var
forumLimitOperationService
=
require
(
'../../service/forumLimitOperationService'
);
...
...
@@ -30,21 +27,23 @@ function date_format(date) {
//判断时间是否在指定范围
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
begin_time
=
new
Date
(
begin_time
).
getTime
(),
ent_time
=
new
Date
(
end_time
).
getTime
(),
this_now
=
new
Date
(
now
).
getTime
(
);
if
(
this_now
>=
begin_time
&&
this_now
<=
ent_time
){
return
true
;
}
else
{
return
false
;
}
}
//验证用户身份
router
.
post
(
'/user/identifyUser'
,
function
(
req
,
res
,
next
){
var
entity
=
req
.
body
;
if
(
!
req
.
session
.
mobileForumUser
){
if
(
req
.
session
.
mobileForumUser
&&
req
.
session
.
mobileForumUser
.
openId
===
entity
.
openId
){
res
.
json
({
result
:
'success'
,
userId
:
req
.
session
.
mobileForumUser
.
userId
});
}
else
if
(
!
req
.
session
.
mobileForumUser
||
req
.
session
.
mobileForumUser
.
openId
!==
entity
.
openId
){
forumUserService
.
getUserByUid
(
entity
.
uid
,
function
(
err
,
doc
){
if
(
err
){
console
.
log
(
err
);
...
...
@@ -55,7 +54,6 @@ router.post('/user/identifyUser',function(req,res,next){
userId
:
doc
.
_id
,
openId
:
doc
.
uid
};
// checkLimitAction(req, res);
res
.
json
({
result
:
'success'
,
userId
:
doc
.
_id
});
}
else
{
forumUserService
.
createUser
(
entity
,
function
(
err
,
doc
){
...
...
@@ -67,7 +65,6 @@ router.post('/user/identifyUser',function(req,res,next){
userId
:
doc
.
_id
,
openId
:
doc
.
uid
};
// checkLimitAction(req, res);
res
.
json
({
result
:
'success'
,
userId
:
doc
.
_id
});
}
});
...
...
@@ -99,15 +96,11 @@ router.get('/user/from/share', function(req, res, next) {
}
}
});
// httpService.sendRequest(ent_code,mid,action);
// res.status(200).end();
});
//检查用户权限 旧版
router
.
post
(
'/user/checkLimitAction'
,
function
(
req
,
res
,
next
)
{
var
entity
=
req
.
body
;
var
userId
=
entity
.
mid
;
var
userId
=
req
.
body
.
userId
;
if
(
userId
){
var
array
=
[];
...
...
@@ -178,64 +171,3 @@ router.post('/user/checkLimitAction', function(req, res, next) {
}
});
//检查用户权限
// router.post('/user/checkLimitAction', function(req, res, next) {
// var entity=req.body;
// var userId = entity.mid;
// if(userId){
// forumLimitActionConfigService.getAllLimitActionConfig(function(err,configs){
// if(err){
// console.error(err);
// res.json(returnCode.BUSY);
// }else{k
// var array = [];
// forumLimitActionRefService.getLimitActionRefByMid(userId,function(err,forumLimitActionRef){
// if (err) {
// console.error(err);
// var returnObject = {
// errcode:'success',
// configs:configs,
// data:array
// }
// res.json(returnObject);
// } 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];
// var flag = compareTime(new Date(), limit_action.begin_time, limit_action.end_time);
// //把flag和limit_action_type 放进session
// var obj = {
// result : flag,
// code : limit_action.limit_action_type
// }
// array.push(obj);
// }
// var returnObject = {
// errcode:'success',
// configs:configs,
// data:array
// }
// res.json(returnObject);
// }else{
// var returnObject = {
// errcode:'success',
// configs:configs,
// data:[]
// }
// res.json(returnObject);
// }
// }
// });
// }
// });
// }else{
// var returnObject = {
// errcode:'success',
// configs:configs,
// data:[]
// }
// res.json(returnObject);
// }
// });
strong
@strong
mentioned in commit
b8ad3a20
·
Sep 16, 2015
mentioned in commit
b8ad3a20
mentioned in commit b8ad3a2013f4655a3d8073d5d2a4f0554994dc41
Toggle commit list
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