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
4589ac08
Commit
4589ac08
authored
Mar 11, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
da6694ac
' into bugfix_0311_share_log
parents
74398475
da6694ac
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
772 additions
and
393 deletions
+772
-393
forumThread.js
app/controllers/admin/forumThread.js
+74
-89
forumThread.js
app/controllers/mobile/forumThread.js
+245
-65
forumCommentService.js
app/service/forumCommentService.js
+106
-0
forumThreadService.js
app/service/forumThreadService.js
+286
-185
redisThreadList.js
app/utils/redisThreadList.js
+55
-51
user.js
app/utils/user.js
+6
-3
No files found.
app/controllers/admin/forumThread.js
View file @
4589ac08
...
@@ -322,7 +322,7 @@ router.post('/thread/:tid/:fid/unTop', function(req, res, next) {
...
@@ -322,7 +322,7 @@ router.post('/thread/:tid/:fid/unTop', function(req, res, next) {
}
}
});
});
//文章
推荐
//文章
加精
router
.
post
(
'/thread/:tid/:fid/recommend'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/:fid/recommend'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
,
var
tid
=
req
.
params
.
tid
,
fid
=
req
.
params
.
fid
,
fid
=
req
.
params
.
fid
,
...
@@ -364,7 +364,7 @@ router.post('/thread/:tid/:fid/recommend', function(req, res, next) {
...
@@ -364,7 +364,7 @@ router.post('/thread/:tid/:fid/recommend', function(req, res, next) {
}
}
});
});
//文章取消
推荐
//文章取消
加精
router
.
post
(
'/thread/:tid/:fid/unRecommend'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/:fid/unRecommend'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
;
//文章ID
var
tid
=
req
.
params
.
tid
;
//文章ID
var
fid
=
req
.
params
.
fid
;
//板块ID
var
fid
=
req
.
params
.
fid
;
//板块ID
...
@@ -398,6 +398,9 @@ router.get('/threads/list', function(req, res, next) {
...
@@ -398,6 +398,9 @@ router.get('/threads/list', function(req, res, next) {
var
eventStatus
=
req
.
query
.
eventStatus
;
var
eventStatus
=
req
.
query
.
eventStatus
;
var
recommend_threads
=
req
.
query
.
recommend_threads
;
//推荐帖子
var
recommend_threads
=
req
.
query
.
recommend_threads
;
//推荐帖子
var
top_threads
=
req
.
query
.
top_threads
;
//置顶帖子
var
top_threads
=
req
.
query
.
top_threads
;
//置顶帖子
var
begin_time
=
req
.
query
.
begin_time
;
var
end_time
=
req
.
query
.
end_time
;
var
title
=
req
.
query
.
title
;
var
sortBy
=
{
var
sortBy
=
{
top
:
-
1
,
top
:
-
1
,
top_order_idx
:
-
1
,
top_order_idx
:
-
1
,
...
@@ -476,6 +479,22 @@ router.get('/threads/list', function(req, res, next) {
...
@@ -476,6 +479,22 @@ router.get('/threads/list', function(req, res, next) {
conditions
[
'event.eventEndTime'
]
=
{
$gt
:
today
};
conditions
[
'event.eventEndTime'
]
=
{
$gt
:
today
};
}
}
}
}
if
(
begin_time
&&
end_time
){
conditions
.
created
=
{
$gte
:
begin_time
,
$lte
:
end_time
};
}
else
if
(
end_time
){
conditions
.
created
=
{
$lte
:
end_time
};
}
else
if
(
begin_time
){
conditions
.
created
=
{
$gte
:
begin_time
};
}
if
(
title
)
{
conditions
.
title
=
{
$regex
:
title
,
$options
:
'i'
}
}
if
(
mid
)
{
if
(
mid
)
{
forumThreadService
.
getAllThreadByFidAndMid
(
mid
,
conditions
,
pageNo
,
pageSize
,
sortBy
,
function
(
err
,
results
)
{
forumThreadService
.
getAllThreadByFidAndMid
(
mid
,
conditions
,
pageNo
,
pageSize
,
sortBy
,
function
(
err
,
results
)
{
if
(
err
)
{
if
(
err
)
{
...
@@ -536,32 +555,43 @@ router.get('/threads/list', function(req, res, next) {
...
@@ -536,32 +555,43 @@ router.get('/threads/list', function(req, res, next) {
//直接修改序号
//直接修改序号
function
updateThreadTopIdx
(
id
,
idx
,
callback
){
function
updateThreadTopIdx
(
id
,
idx
,
callback
){
ForumThread
.
update
(
// ForumThread.update({_id:id},{ top_order_idx: idx },
{
_id
:
id
},
// null,
{
top_order_idx
:
idx
},
// function(err,result){
null
,
// if(err){
function
(
err
,
result
){
// console.error(err);
if
(
err
){
// callback(err,null);
console
.
error
(
err
);
// }else{
callback
(
err
,
null
);
// callback(null,true);
}
else
{
// }
callback
(
null
,
true
);
// });
}
forumThreadService
.
updateThread
({
_id
:
id
},
{
top_order_idx
:
idx
},
function
(
err
,
doc
)
{
});
if
(
err
){
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
true
);
}
});
}
}
function
updateThreadNewRecommendIdx
(
id
,
idx
,
callback
){
function
updateThreadNewRecommendIdx
(
id
,
idx
,
callback
){
ForumThread
.
update
(
// ForumThread.update({_id:id},{ new_recommend_order_idx: idx },null, function(err,result){
{
_id
:
id
},
// if(err){
{
new_recommend_order_idx
:
idx
},
// console.error(err);
null
,
// callback(err,null);
function
(
err
,
result
){
// }else{
if
(
err
){
// callback(null,true);
console
.
error
(
err
);
// }
callback
(
err
,
null
);
// });
}
else
{
callback
(
null
,
true
);
forumThreadService
.
updateThread
({
_id
:
id
},
{
new_recommend_order_idx
:
idx
},
function
(
err
,
doc
)
{
}
if
(
err
){
});
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
true
);
}
});
}
}
router
.
put
(
'/top_threads/orderIDX/:id/:order'
,
function
(
req
,
res
,
next
)
{
router
.
put
(
'/top_threads/orderIDX/:id/:order'
,
function
(
req
,
res
,
next
)
{
var
id
=
req
.
params
.
id
;
var
id
=
req
.
params
.
id
;
...
@@ -587,7 +617,6 @@ router.put('/recommend_threads/orderIDX/:id/:order', function(req, res, next) {
...
@@ -587,7 +617,6 @@ router.put('/recommend_threads/orderIDX/:id/:order', function(req, res, next) {
});
});
//评论列表
//评论列表
router
.
get
(
'/thread/:tid/comment/list'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/thread/:tid/comment/list'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
tid
=
req
.
params
.
tid
||
null
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
...
@@ -619,10 +648,24 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
...
@@ -619,10 +648,24 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
if
(
e
.
level
==
1
)
{
if
(
e
.
level
==
1
)
{
cb
(
null
,
e
);
cb
(
null
,
e
);
}
else
{
}
else
{
forumCommentService
.
getCommentParent
(
e
.
_id
,
function
(
err
,
p_comment
)
{
forumCommentService
.
getCommentParent
(
new
mongoose
.
Types
.
ObjectId
(
e
.
_id
),
function
(
err
,
p_comment
)
{
var
comment
=
e
.
toObject
();
if
(
p_comment
&&
p_comment
.
floor
){
comment
.
floor
=
p_comment
.
floor
;
var
comment
=
e
.
toObject
();
cb
(
null
,
comment
);
comment
.
floor
=
p_comment
.
floor
;
cb
(
null
,
comment
);
}
else
if
(
p_comment
&&
!
p_comment
.
floor
){
//上一级没有楼层就再查上一级的评论
forumCommentService
.
getCommentParent
(
new
mongoose
.
Types
.
ObjectId
(
p_comment
.
_id
),
function
(
err
,
p_p_comment
)
{
if
(
p_comment
){
var
comment
=
e
.
toObject
();
comment
.
floor
=
p_p_comment
.
floor
;
cb
(
null
,
comment
);
}
else
{
cb
(
null
,
e
);
}
});
}
else
{
cb
(
null
,
e
);
}
});
});
}
}
});
});
...
@@ -887,16 +930,6 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
...
@@ -887,16 +930,6 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
var
tid
=
req
.
body
.
tid
||
null
;
var
tid
=
req
.
body
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
replayComment_id
=
req
.
body
.
replayComment_id
;
var
replayComment_id
=
req
.
body
.
replayComment_id
;
// 获取评论的子评论列表
// 更新文章评论 + 1
forumThreadService
.
updateThreadCommentCountInc
(
tid
,
function
(
err
,
thread
)
{
if
(
err
)
{
console
.
error
(
err
);
}
});
// 更新评论对象
// result.comment_count+=1; // 回复评论+1
forumCommentService
.
updateCommentById
(
cid
,
{
forumCommentService
.
updateCommentById
(
cid
,
{
$push
:
{
$push
:
{
comments
:
replayComment_id
comments
:
replayComment_id
...
@@ -915,53 +948,6 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
...
@@ -915,53 +948,6 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
});
});
});
});
// 更新评论的子评论列表
router
.
post
(
'/thread/comment/update/:cid/comments'
,
function
(
req
,
res
,
next
)
{
var
cid
=
req
.
params
.
cid
||
null
;
var
replayComment_id
=
req
.
body
.
replayComment_id
;
forumCommentService
.
updateCommentById
(
cid
,
{
$push
:
{
comments
:
replayComment_id
}
},
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
// 获取评论的子评论列表
// forumCommentService.getCommentById(cid, function(err, result) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// // var commentList = result.comments;
// // result.comments.push(replayComment_id);
// forumCommentService.updateCommentById(cid, {
// $push: {
// comments: replayComment_id
// }
// },
// function(err, result) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// res.json(returnCode.SUCCESS);
// }
// });
// }
// });
});
//添加评论
//添加评论
router
.
post
(
'/thread/comment/add'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/comment/add'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
var
tid
=
req
.
body
.
tid
||
null
;
...
@@ -1009,7 +995,6 @@ router.post('/thread/comment/add', function(req, res, next) {
...
@@ -1009,7 +995,6 @@ router.post('/thread/comment/add', function(req, res, next) {
});
});
}
}
}
}
entity
.
from
=
user
;
entity
.
from
=
user
;
callback
();
callback
();
}
}
...
...
app/controllers/mobile/forumThread.js
View file @
4589ac08
This diff is collapsed.
Click to expand it.
app/service/forumCommentService.js
View file @
4589ac08
...
@@ -616,3 +616,109 @@ exports.getAllCommentByThread = function(conditions, callback) {
...
@@ -616,3 +616,109 @@ exports.getAllCommentByThread = function(conditions, callback) {
}
}
});
});
};
};
/**
* 20160310
* 查询评论列表(包含已删除的二级评论)
*
* **/
exports
.
getAllComment_allstatus
=
function
(
conditions
,
pageNo
,
pageSize
,
callback
)
{
countAll
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
ForumComment
.
find
(
conditions
,
listCommentFields
).
populate
(
'from'
,
'uid mid nickName icon exp'
).
populate
(
'to'
,
'uid mid nickName icon exp'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
var
obj
=
{};
obj
.
total
=
count
;
obj
.
pageNo
=
pageNo
;
obj
.
pageSize
=
pageSize
;
obj
.
items
=
docs
;
if
(
docs
&&
docs
.
length
>
0
)
{
var
asyncTasks
=
[];
docs
.
forEach
(
function
(
doc
)
{
asyncTasks
.
push
(
function
(
callback
)
{
populateComment_allstatus
(
doc
,
function
(
err
,
c
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
var
newobj
=
doc
.
toObject
();
newobj
.
comments
=
(
c
==
null
?
[]
:
c
);
callback
(
null
,
newobj
);
}
});
});
});
async
.
parallel
(
asyncTasks
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
null
,
null
);
}
else
{
obj
.
items
=
results
;
callback
(
null
,
obj
);
}
});
}
else
{
callback
(
null
,
obj
);
}
}
});
}
});
};
//评论
function
populateComment_allstatus
(
doc
,
callback
)
{
if
(
doc
&&
doc
.
comments
.
length
>
0
)
{
var
asyncTasks
=
[];
doc
.
comments
.
forEach
(
function
(
comment
)
{
asyncTasks
.
push
(
function
(
callback
)
{
ForumComment
.
findOne
({
_id
:
comment
}).
populate
({
path
:
'from to'
,
select
:
'uid nickName icon mid'
}).
exec
(
function
(
err
,
c
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
null
,
null
);
}
else
{
if
(
c
)
{
callback
(
null
,
c
);
}
else
{
callback
(
null
);
}
}
});
});
});
async
.
parallel
(
asyncTasks
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
null
,
null
);
}
else
{
var
comments
=
[];
for
(
var
i
=
0
;
i
<
results
.
length
;
i
+=
1
)
{
if
(
results
[
i
])
{
comments
.
push
(
results
[
i
]);
}
}
callback
(
null
,
comments
);
}
});
}
else
{
callback
(
null
,
null
);
}
}
app/service/forumThreadService.js
View file @
4589ac08
This diff is collapsed.
Click to expand it.
app/utils/redisThreadList.js
View file @
4589ac08
'use strict'
;
'use strict'
;
var
redis
=
global
.
redis
;
var
redis
=
global
.
redis
;
var
expire
=
60
*
1
0
;
var
expire
=
60
*
3
0
;
//缓存数量
//缓存数量
var
ThreadRedisCount
=
50
;
var
ThreadRedisCount
=
50
;
...
@@ -12,6 +12,10 @@ var forumThreadService=require('../service/forumThreadService');
...
@@ -12,6 +12,10 @@ var forumThreadService=require('../service/forumThreadService');
var
redisPraiseLog
=
require
(
'./redisPraiseLog'
);
var
redisPraiseLog
=
require
(
'./redisPraiseLog'
);
var
util
=
require
(
'./util'
);
var
util
=
require
(
'./util'
);
var
RefreshFlag
=
true
;
var
tyhread_redis_salt
=
'_tyhread_redis_salt'
;
var
sort
=
{
var
sort
=
{
new_recommend
:
-
1
,
new_recommend
:
-
1
,
new_recommend_order_idx
:
-
1
,
new_recommend_order_idx
:
-
1
,
...
@@ -25,13 +29,13 @@ var sort = {
...
@@ -25,13 +29,13 @@ var sort = {
created
:
-
1
created
:
-
1
};
};
function
getKey
(
ent_code
,
keyID
,
type
){
function
getKey
(
ent_code
,
salt
){
var
key
=
ent_code
+
keyID
+
type
;
var
key
=
ent_code
+
salt
;
return
key
;
return
key
;
}
}
function
setToRedis
(
ent_code
,
keyID
,
type
,
value
){
function
setToRedis
(
ent_code
,
salt
,
value
){
var
key
=
getKey
(
ent_code
,
keyID
,
type
);
var
key
=
getKey
(
ent_code
,
salt
);
if
(
!
redis
){
if
(
!
redis
){
console
.
log
(
'redis error'
);
console
.
log
(
'redis error'
);
return
'error'
return
'error'
...
@@ -42,8 +46,37 @@ function setToRedis(ent_code,keyID,type,value){
...
@@ -42,8 +46,37 @@ function setToRedis(ent_code,keyID,type,value){
});
});
}
}
exports
.
get
=
function
(
ent_code
,
keyID
,
type
,
callback
){
function
getEsenceThreads
(
ent_code
,
salt
,
callback
){
var
key
=
getKey
(
ent_code
,
keyID
,
type
);
var
today
=
new
Date
();
var
conditions
=
{
ent_code
:
ent_code
,
level
:
1
,
status
:
1
,
new_recommend
:
1
,
$or
:
[{
isEvent
:
0
},
{
isEvent
:
null
},
{
isEvent
:
1
,
'event.eventStartTime'
:
{
$lte
:
today
}
}]
};
forumThreadService
.
getThreadWithNotPopulateComment
(
conditions
,
1
,
ThreadRedisCount
,
sort
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
);
}
else
{
util
.
loadLevel
(
ent_code
,
results
.
items
,
function
()
{
setToRedis
(
ent_code
,
salt
,
JSON
.
stringify
(
results
));
callback
(
null
);
});
}
});
};
exports
.
get
=
function
(
ent_code
,
callback
){
var
key
=
getKey
(
ent_code
,
tyhread_redis_salt
);
if
(
!
redis
){
if
(
!
redis
){
console
.
log
(
'redis error'
);
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'error'
);
return
callback
&&
callback
(
'error'
);
...
@@ -51,7 +84,7 @@ exports.get=function(ent_code,keyID,type,callback){
...
@@ -51,7 +84,7 @@ exports.get=function(ent_code,keyID,type,callback){
redis
.
get
(
key
,
function
(
error
,
res
){
redis
.
get
(
key
,
function
(
error
,
res
){
if
(
!
res
){
if
(
!
res
){
//不存在,先获取再返回
//不存在,先获取再返回
getEsenceThreads
(
ent_code
,
keyID
,
type
,
function
(
err
){
getEsenceThreads
(
ent_code
,
tyhread_redis_salt
,
function
(
err
){
redis
.
get
(
key
,
function
(
error
,
res
){
redis
.
get
(
key
,
function
(
error
,
res
){
return
callback
&&
callback
(
error
,
res
.
split
(
","
));
return
callback
&&
callback
(
error
,
res
.
split
(
","
));
});
});
...
@@ -62,8 +95,8 @@ exports.get=function(ent_code,keyID,type,callback){
...
@@ -62,8 +95,8 @@ exports.get=function(ent_code,keyID,type,callback){
});
});
};
};
exports
.
set
=
function
(
ent_code
,
keyID
,
type
,
value
,
callback
){
exports
.
set
=
function
(
ent_code
,
salt
,
value
,
callback
){
var
key
=
getKey
(
ent_code
,
keyID
,
type
);
var
key
=
getKey
(
ent_code
,
salt
);
if
(
!
redis
){
if
(
!
redis
){
console
.
log
(
'redis error'
);
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'error'
);
return
callback
&&
callback
(
'error'
);
...
@@ -74,8 +107,8 @@ exports.set=function(ent_code,keyID,type,value,callback){
...
@@ -74,8 +107,8 @@ exports.set=function(ent_code,keyID,type,value,callback){
});
});
};
};
exports
.
clear
=
function
(
ent_code
,
keyID
,
type
,
callback
){
exports
.
clear
=
function
(
ent_code
,
salt
,
callback
){
var
key
=
getKey
(
ent_code
,
keyID
,
type
);
var
key
=
getKey
(
ent_code
,
salt
);
if
(
!
redis
){
if
(
!
redis
){
console
.
log
(
'redis error'
);
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'error'
);
return
callback
&&
callback
(
'error'
);
...
@@ -85,53 +118,24 @@ exports.clear = function(ent_code,keyID,type,callback){
...
@@ -85,53 +118,24 @@ exports.clear = function(ent_code,keyID,type,callback){
});
});
};
};
function
getEsenceThreads
(
ent_code
,
keyID
,
type
,
callback
){
var
today
=
new
Date
();
var
conditions
=
{
ent_code
:
ent_code
,
level
:
1
,
status
:
1
,
new_recommend
:
1
,
$or
:
[{
isEvent
:
0
},
{
isEvent
:
null
},
{
isEvent
:
1
,
'event.eventStartTime'
:
{
$lte
:
today
}
}]
};
forumThreadService
.
getThreadWithNotPopulateComment
(
conditions
,
1
,
ThreadRedisCount
,
sort
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
);
}
else
{
util
.
loadLevel
(
ent_code
,
results
.
items
,
function
()
{
setToRedis
(
ent_code
,
keyID
,
type
,
JSON
.
stringify
(
results
));
callback
(
null
);
});
}
});
};
//获取缓存列表
//获取缓存列表
exports
.
getRedisEsenceThreads
=
function
(
ent_code
,
keyID
,
type
,
callback
){
exports
.
getRedisEsenceThreads
=
function
(
ent_code
,
callback
){
var
key
=
getKey
(
ent_code
,
keyID
,
type
);
var
key
=
getKey
(
ent_code
,
tyhread_redis_salt
);
getEsenceThreads
(
ent_code
,
keyID
,
type
,
function
(
err
){
getEsenceThreads
(
ent_code
,
tyhread_redis_salt
,
function
(
err
){
redis
.
get
(
key
,
function
(
error
,
res
){
redis
.
get
(
key
,
function
(
error
,
res
){
return
callback
&&
callback
(
error
,
res
.
split
(
","
));
return
callback
&&
callback
(
error
,
res
.
split
(
","
));
});
});
});
});
};
};
//更新缓存列表
/*exports.updateRedisEsenceThreads = function(ent_code,keyID,type,callback){
getEsenceThreads(ent_code, keyID,type, function(err){
callback();
});
};*/
//获取缓存数值
//获取缓存数值
exports
.
getThreadRedisCount
=
function
(){
exports
.
getThreadRedisCount
=
function
(){
return
ThreadRedisCount
;
return
ThreadRedisCount
;
};
//更新缓存列表
exports
.
updateRedisEsenceThreads
=
function
(
ent_code
){
if
(
RefreshFlag
){
getEsenceThreads
(
ent_code
,
tyhread_redis_salt
,
function
(
err
){});
}
};
};
\ No newline at end of file
app/utils/user.js
View file @
4589ac08
...
@@ -23,7 +23,8 @@ exports.identifyUser=function() {
...
@@ -23,7 +23,8 @@ exports.identifyUser=function() {
if
(
doc
){
if
(
doc
){
req
.
session
.
mobileForumUser
=
{
req
.
session
.
mobileForumUser
=
{
userId
:
doc
.
_id
,
userId
:
doc
.
_id
,
openId
:
doc
.
uid
openId
:
doc
.
uid
,
mid
:
doc
.
mid
};
};
if
(
req
.
session
.
source
){
if
(
req
.
session
.
source
){
if
(
req
.
session
.
source
!==
req
.
session
.
mobileForumUser
.
userId
){
if
(
req
.
session
.
source
!==
req
.
session
.
mobileForumUser
.
userId
){
...
@@ -41,7 +42,8 @@ exports.identifyUser=function() {
...
@@ -41,7 +42,8 @@ exports.identifyUser=function() {
uid
:
req
.
session
.
openUser
.
openId
,
uid
:
req
.
session
.
openUser
.
openId
,
nickName
:
req
.
session
.
openUser
.
nickName
,
nickName
:
req
.
session
.
openUser
.
nickName
,
icon
:
req
.
session
.
openUser
.
headPic
,
icon
:
req
.
session
.
openUser
.
headPic
,
ent_code
:
req
.
session
.
user
.
ent_code
ent_code
:
req
.
session
.
user
.
ent_code
,
mid
:
req
.
session
.
openUser
.
mid
};
};
forumUserService
.
createUser
(
entity
,
function
(
err
,
doc
){
forumUserService
.
createUser
(
entity
,
function
(
err
,
doc
){
if
(
err
){
if
(
err
){
...
@@ -49,7 +51,8 @@ exports.identifyUser=function() {
...
@@ -49,7 +51,8 @@ exports.identifyUser=function() {
}
else
{
}
else
{
req
.
session
.
mobileForumUser
=
{
req
.
session
.
mobileForumUser
=
{
userId
:
doc
.
_id
,
userId
:
doc
.
_id
,
openId
:
doc
.
uid
openId
:
doc
.
uid
,
mid
:
doc
.
mid
};
};
if
(
req
.
session
.
source
){
if
(
req
.
session
.
source
){
if
(
req
.
session
.
source
!==
req
.
session
.
mobileForumUser
.
userId
){
if
(
req
.
session
.
source
!==
req
.
session
.
mobileForumUser
.
userId
){
...
...
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