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
467e5e14
Commit
467e5e14
authored
Apr 23, 2015
by
刘文胜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of git.wxpai.cn:scrmgroup/pisns-forum-api into development
parents
646033df
fda25b63
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
747 additions
and
283 deletions
+747
-283
forumThread.js
app/controllers/admin/forumThread.js
+474
-258
forumInfo.js
app/controllers/mobile/forumInfo.js
+3
-2
forumShare.js
app/controllers/mobile/forumShare.js
+176
-1
forumTag.js
app/controllers/mobile/forumTag.js
+1
-1
forumThread.js
app/controllers/mobile/forumThread.js
+8
-5
forumPVLog.js
app/models/forumPVLog.js
+7
-3
forumUVLog.js
app/models/forumUVLog.js
+7
-3
forumCommentService.js
app/service/forumCommentService.js
+20
-3
forumThreadService.js
app/service/forumThreadService.js
+38
-4
httpService.js
app/service/httpService.js
+2
-1
user.js
app/utils/user.js
+11
-2
No files found.
app/controllers/admin/forumThread.js
View file @
467e5e14
This diff is collapsed.
Click to expand it.
app/controllers/mobile/forumInfo.js
View file @
467e5e14
...
@@ -41,7 +41,8 @@ router.post('/info/create', function(req, res, next) {
...
@@ -41,7 +41,8 @@ router.post('/info/create', function(req, res, next) {
router
.
get
(
'/info/:fid/get'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/info/:fid/get'
,
function
(
req
,
res
,
next
)
{
var
fid
=
req
.
params
.
fid
||
null
;
var
fid
=
req
.
params
.
fid
||
null
;
if
(
fid
)
{
if
(
fid
)
{
httpService
.
createLog
(
req
,
fid
,
2
);
var
source
=
req
.
session
.
mobileForumUser
.
source
;
httpService
.
createLog
(
req
,
source
,
fid
,
2
);
async
.
waterfall
([
async
.
waterfall
([
function
(
callback
)
{
function
(
callback
)
{
//更新浏览数
//更新浏览数
...
@@ -133,7 +134,7 @@ router.get('/info/:fid/threads', function(req, res, next) {
...
@@ -133,7 +134,7 @@ router.get('/info/:fid/threads', function(req, res, next) {
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
fid
=
req
.
params
.
fid
;
var
fid
=
req
.
params
.
fid
;
var
sort
=
'top -topTime -created'
var
sort
=
'
-
top -topTime -created'
var
conditions
=
{
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
level
:
1
level
:
1
...
...
app/controllers/mobile/forumShare.js
View file @
467e5e14
...
@@ -17,8 +17,8 @@ module.exports = function(app) {
...
@@ -17,8 +17,8 @@ module.exports = function(app) {
app
.
use
(
'/v1/forum'
,
router
);
app
.
use
(
'/v1/forum'
,
router
);
};
};
function
write
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
)
{
function
write
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
)
{
link
=
config
.
service
+
link
+
"&mid="
+
mid
;
res
.
writeHead
(
200
,
{
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/javascript'
,
'Content-Type'
:
'text/javascript'
,
'Cache-Control'
:
'no-cache'
,
'Cache-Control'
:
'no-cache'
,
...
@@ -74,3 +74,178 @@ function getWX(res, title, desc, link, imgUrl, mid,ent_code, id,type,forumThread
...
@@ -74,3 +74,178 @@ function getWX(res, title, desc, link, imgUrl, mid,ent_code, id,type,forumThread
}
}
//微信分享接口
router
.
get
(
'/:ent_code/share.js'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
type
=
req
.
query
.
type
;
var
id
=
req
.
query
.
id
;
var
uId
=
req
.
session
.
mobileForumUser
.
userId
;
var
mid
=
0
;
if
(
req
.
session
.
openUser
&&
req
.
session
.
openUser
.
mid
)
{
mid
=
req
.
session
.
openUser
.
mid
;
}
var
ent_code
=
req
.
params
.
ent_code
;
var
link
=
'/app/forum/'
+
ent_code
+
'/index?pageUrl='
;
if
(
type
)
{
//板块微信接口
if
(
type
===
'Info'
)
{
then
(
function
(
cont
)
{
forumShareConfigService
.
getByKey
(
ent_code
,
'share'
,
function
(
err
,
result
)
{
var
title
=
''
,
desc
=
''
,
imgUrl
=
''
;
if
(
result
)
{
result
=
result
.
meta_value
;
for
(
var
i
=
0
;
i
<
result
.
length
;
i
++
)
{
if
(
result
[
i
].
type
===
'info'
)
{
title
=
result
[
i
].
title
;
desc
=
result
[
i
].
desc
;
imgUrl
=
result
[
i
].
imgUrl
;
}
}
if
(
id
)
{
link
=
link
+
'index&infoId='
+
id
;
}
else
{
link
=
link
+
'index'
;
}
link
=
link
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
}
else
{
cont
(
err
);
}
});
}).
fail
(
function
(
cont
,
err
)
{
console
.
error
(
err
);
res
.
json
({
result
:
false
,
code
:
'10002'
});
});
}
else
if
(
!
id
)
{
console
.
error
(
"ID不能为空"
);
res
.
json
({
message
:
'ID不能为空'
,
result
:
false
,
code
:
'10002'
});
}
else
if
(
type
===
'Thread'
)
{
then
(
function
(
cont
)
{
//获得文章
forumThreadService
.
getById
(
id
,
function
(
err
,
result
)
{
if
(
result
)
{
cont
(
null
,
result
);
}
else
{
cont
(
err
);
}
});
}).
then
(
function
(
cont
,
result
)
{
//如果没有share值则用默认值
if
(
!
result
.
share
||
result
.
share_type
==
2
)
{
forumShareConfigService
.
getByKey
(
ent_code
,
'share'
,
function
(
err
,
sc
)
{
var
title
=
''
,
desc
=
''
,
imgUrl
=
''
;
if
(
sc
)
{
if
(
result
.
type
===
1
||
(
result
.
type
===
2
&&
result
.
level
===
2
))
{
link
=
link
+
'thread&infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
}
else
if
(
result
.
type
===
2
&&
result
.
level
===
1
)
{
link
=
link
+
'topicList&infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
}
else
if
(
result
.
type
===
3
)
{
link
=
link
+
'photoList&infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
}
//1、文章 2、话题 3、照片墙
sc
=
sc
.
meta_value
;
for
(
var
i
=
0
;
i
<
sc
.
length
;
i
++
)
{
if
(
result
.
type
===
1
||
(
result
.
type
===
2
&&
result
.
level
===
2
))
{
if
(
sc
[
i
].
type
===
'article'
)
{
title
=
sc
[
i
].
title
;
desc
=
sc
[
i
].
desc
;
imgUrl
=
sc
[
i
].
imgUrl
;
}
}
else
if
(
result
.
type
===
2
&&
result
.
level
===
1
)
{
if
(
sc
[
i
].
type
===
'topic'
)
{
title
=
sc
[
i
].
title
;
desc
=
sc
[
i
].
desc
;
imgUrl
=
sc
[
i
].
imgUrl
;
}
}
else
if
(
result
.
type
===
3
)
{
if
(
sc
[
i
].
type
===
'photo'
)
{
title
=
sc
[
i
].
title
;
desc
=
sc
[
i
].
desc
;
imgUrl
=
sc
[
i
].
imgUrl
;
}
}
}
link
=
link
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
result
.
_id
,
type
,
result
);
}
else
{
cont
(
err
);
}
});
}
else
{
//如果有分享设置,则返回分享设置
forumShareService
.
getById
(
result
.
share
,
function
(
err
,
forumShare
)
{
//1、文章 2、话题 3、照片墙
if
(
result
.
type
===
1
||
(
result
.
type
===
2
&&
result
.
level
===
2
))
{
link
=
link
+
'thread&infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//key = 'article';
}
else
if
(
result
.
type
===
2
&&
result
.
level
===
1
)
{
link
=
link
+
'topicList&infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//key = 'topic';
}
else
if
(
result
.
type
===
3
)
{
link
=
link
+
'photoList&infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//key = 'photo';
}
link
=
link
+
'&uId='
+
uId
;
getWX
(
res
,
forumShare
.
title
,
forumShare
.
description
,
link
,
forumShare
.
icon
,
mid
,
ent_code
,
result
.
_id
,
type
,
result
);
});
}
}).
fail
(
function
(
cont
,
err
)
{
console
.
error
(
err
);
res
.
json
({
result
:
false
,
code
:
'10002'
});
});
}
}
else
{
res
.
json
({
result
:
false
,
code
:
'10002'
});
}
});
//微信分享接口
router
.
get
(
'/:ent_code/timeline'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_timeline'
,
ent_code
=
req
.
session
.
user
.
ent_code
;
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
});
app/controllers/mobile/forumTag.js
View file @
467e5e14
...
@@ -58,7 +58,7 @@ router.get('/tag/:tid/threads', function(req, res, next) {
...
@@ -58,7 +58,7 @@ router.get('/tag/:tid/threads', function(req, res, next) {
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
tid
=
req
.
params
.
tid
;
var
tid
=
req
.
params
.
tid
;
var
sort
=
'tag_top -tag_topTime -created'
;
var
sort
=
'
-
tag_top -tag_topTime -created'
;
var
conditions
=
{
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
ent_code
:
req
.
session
.
user
.
ent_code
};
};
...
...
app/controllers/mobile/forumThread.js
View file @
467e5e14
...
@@ -175,15 +175,16 @@ router.get('/thread/:tid/get', function(req, res, next) {
...
@@ -175,15 +175,16 @@ router.get('/thread/:tid/get', function(req, res, next) {
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
//文章类型 1、文章 2、话题 3、照片墙
//文章类型 1、文章 2、话题 3、照片墙
var
info_id
=
thread
.
info
.
_id
,
var
info_id
=
thread
.
info
.
_id
,
pid
=
thread
.
pid
;
pid
=
thread
.
pid
,
source
=
req
.
session
.
mobileForumUser
.
source
;
if
(
thread
.
type
==
1
&&
thread
.
level
==
1
)
{
if
(
thread
.
type
==
1
&&
thread
.
level
==
1
)
{
httpService
.
createLog
(
req
,
info_id
,
3
,
1
,
tid
);
httpService
.
createLog
(
req
,
source
,
info_id
,
3
,
1
,
tid
);
}
else
if
(
thread
.
type
==
1
&&
thread
.
level
==
2
)
{
}
else
if
(
thread
.
type
==
1
&&
thread
.
level
==
2
)
{
httpService
.
createLog
(
req
,
info_id
,
3
,
4
,
tid
,
pid
);
httpService
.
createLog
(
req
,
source
,
info_id
,
3
,
4
,
tid
,
pid
);
}
else
if
(
thread
.
type
==
2
&&
thread
.
level
==
1
)
{
}
else
if
(
thread
.
type
==
2
&&
thread
.
level
==
1
)
{
httpService
.
createLog
(
req
,
info_id
,
3
,
2
,
tid
);
httpService
.
createLog
(
req
,
source
,
info_id
,
3
,
2
,
tid
);
}
else
if
(
thread
.
type
==
3
&&
thread
.
level
==
1
)
{
}
else
if
(
thread
.
type
==
3
&&
thread
.
level
==
1
)
{
httpService
.
createLog
(
req
,
info_id
,
3
,
3
,
tid
);
httpService
.
createLog
(
req
,
source
,
info_id
,
3
,
3
,
tid
);
}
}
...
@@ -690,6 +691,8 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
...
@@ -690,6 +691,8 @@ 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
tid
=
req
.
params
.
tid
||
null
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
conditions
=
{
var
conditions
=
{
...
...
app/models/forumPVLog.js
View file @
467e5e14
...
@@ -45,11 +45,15 @@ var ForumPVLogSchema = new Schema({
...
@@ -45,11 +45,15 @@ var ForumPVLogSchema = new Schema({
index
:
true
index
:
true
},
},
p_thread
:
{
//父文章ID
p_thread
:
{
//父文章ID
type
:
Number
,
type
:
String
,
index
:
true
index
:
true
,
ref
:
'forumThread'
},
},
source
:
{
//分享者
source
:
{
//分享者
type
:
String
type
:
String
,
require
:
true
,
index
:
true
,
ref
:
'ForumUser'
},
},
ip
:
{
//IP地址
ip
:
{
//IP地址
type
:
String
type
:
String
...
...
app/models/forumUVLog.js
View file @
467e5e14
...
@@ -45,11 +45,15 @@ var ForumUVLogSchema = new Schema({
...
@@ -45,11 +45,15 @@ var ForumUVLogSchema = new Schema({
index
:
true
index
:
true
},
},
p_thread
:
{
//父文章ID
p_thread
:
{
//父文章ID
type
:
Number
,
type
:
String
,
index
:
true
index
:
true
,
ref
:
'forumThread'
},
},
source
:
{
//分享者
source
:
{
//分享者
type
:
String
type
:
String
,
require
:
true
,
index
:
true
,
ref
:
'ForumUser'
},
},
ip
:
{
//IP地址
ip
:
{
//IP地址
type
:
String
type
:
String
...
...
app/service/forumCommentService.js
View file @
467e5e14
...
@@ -38,7 +38,6 @@ exports.updateCommentStatusById=function(cid,status,callback){
...
@@ -38,7 +38,6 @@ exports.updateCommentStatusById=function(cid,status,callback){
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
console
.
log
(
result
);
callback
(
null
,
null
);
callback
(
null
,
null
);
}
}
});
});
...
@@ -51,7 +50,6 @@ exports.updateCommentById=function(cid,entity,callback){
...
@@ -51,7 +50,6 @@ exports.updateCommentById=function(cid,entity,callback){
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
console
.
log
(
result
);
callback
(
null
,
null
);
callback
(
null
,
null
);
}
}
});
});
...
@@ -84,6 +82,7 @@ function countAll(conditions,callback) {
...
@@ -84,6 +82,7 @@ function countAll(conditions,callback) {
//获取全部列表数据
//获取全部列表数据
exports
.
getAllComment
=
function
(
conditions
,
pageNo
,
pageSize
,
callback
)
{
exports
.
getAllComment
=
function
(
conditions
,
pageNo
,
pageSize
,
callback
)
{
countAll
(
conditions
,
function
(
err
,
count
){
countAll
(
conditions
,
function
(
err
,
count
){
if
(
err
){
if
(
err
){
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -91,7 +90,7 @@ exports.getAllComment= function(conditions,pageNo,pageSize,callback) {
...
@@ -91,7 +90,7 @@ exports.getAllComment= function(conditions,pageNo,pageSize,callback) {
}
else
{
}
else
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
console
.
log
(
"count:"
+
count
);
ForumComment
.
find
(
conditions
).
populate
(
'from'
).
populate
(
'to'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
ForumComment
.
find
(
conditions
).
populate
(
'from'
).
populate
(
'to'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -199,3 +198,21 @@ exports.updateCommentCount=function(cid,callback){
...
@@ -199,3 +198,21 @@ exports.updateCommentCount=function(cid,callback){
}
}
});
});
};
};
// 查找数组元素下标
function
indexOf
(
array
,
val
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
array
[
i
]
==
val
)
return
i
;
}
return
-
1
;
};
// 删除数组指定值
exports
.
remove
=
function
(
array
,
val
)
{
var
index
=
indexOf
(
array
,
val
);
if
(
index
>
-
1
)
{
array
.
splice
(
index
,
1
);
}
return
array
;
};
\ No newline at end of file
app/service/forumThreadService.js
View file @
467e5e14
...
@@ -254,9 +254,9 @@ exports.getThreadById = function(tid, callback) {
...
@@ -254,9 +254,9 @@ exports.getThreadById = function(tid, callback) {
//根据ID更新文章
//根据ID更新文章
exports
.
updateThreadById
=
function
(
tid
,
entity
,
callback
)
{
exports
.
updateThreadById
=
function
(
tid
,
entity
,
callback
)
{
var
shareEntity
=
entity
.
share
;
var
shareEntity
=
entity
.
share
;
if
(
entity
.
share
&&
entity
.
share
.
_id
)
{
if
(
entity
.
share
&&
entity
.
share
.
_id
)
{
entity
.
share
=
entity
.
share
.
_id
;
entity
.
share
=
entity
.
share
.
_id
;
}
else
{
}
else
{
entity
.
share
=
''
;
entity
.
share
=
''
;
}
}
if
(
entity
.
share
)
{
if
(
entity
.
share
)
{
...
@@ -283,7 +283,7 @@ exports.updateThreadById = function(tid, entity, callback) {
...
@@ -283,7 +283,7 @@ exports.updateThreadById = function(tid, entity, callback) {
});
});
}
else
{
}
else
{
if
(
shareEntity
&&
(
shareEntity
.
title
||
shareEntity
.
description
||
shareEntity
.
icon
))
{
if
(
shareEntity
&&
(
shareEntity
.
title
||
shareEntity
.
description
||
shareEntity
.
icon
))
{
shareEntity
.
ent_code
=
entity
.
ent_code
;
shareEntity
.
ent_code
=
entity
.
ent_code
;
var
forumShare
=
new
ForumShare
(
shareEntity
);
var
forumShare
=
new
ForumShare
(
shareEntity
);
...
@@ -650,7 +650,7 @@ exports.updateThreadShareCount = function(threadId, callback) {
...
@@ -650,7 +650,7 @@ exports.updateThreadShareCount = function(threadId, callback) {
};
};
//更新文章评论数
//更新文章评论数
exports
.
updateThreadCommentCount
=
function
(
threadId
,
callback
)
{
exports
.
updateThreadCommentCount
Inc
=
function
(
threadId
,
callback
)
{
ForumThread
.
update
({
ForumThread
.
update
({
_id
:
threadId
_id
:
threadId
},
{
},
{
...
@@ -671,6 +671,23 @@ exports.updateThreadCommentCount = function(threadId, callback) {
...
@@ -671,6 +671,23 @@ exports.updateThreadCommentCount = function(threadId, callback) {
});
});
};
};
//更新文章评论数
exports
.
updateThreadCommentCount
=
function
(
threadId
,
comment_count
,
callback
)
{
ForumThread
.
update
({
_id
:
threadId
},
{
'comment_count'
:
comment_count
},
null
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
null
);
}
});
};
//更新文章浏览数
//更新文章浏览数
exports
.
updateThreadPvCount
=
function
(
threadId
,
callback
)
{
exports
.
updateThreadPvCount
=
function
(
threadId
,
callback
)
{
ForumThread
.
update
({
ForumThread
.
update
({
...
@@ -692,3 +709,20 @@ exports.updateThreadPvCount = function(threadId, callback) {
...
@@ -692,3 +709,20 @@ exports.updateThreadPvCount = function(threadId, callback) {
}
}
});
});
};
};
// 查找数组元素下标
function
indexOf
(
array
,
val
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
array
[
i
]
==
val
)
return
i
;
}
return
-
1
;
};
// 删除数组指定值
exports
.
remove
=
function
(
array
,
val
)
{
var
index
=
indexOf
(
array
,
val
);
if
(
index
>
-
1
)
{
array
.
splice
(
index
,
1
);
}
return
array
;
};
app/service/httpService.js
View file @
467e5e14
...
@@ -50,10 +50,11 @@ var getClientIP = function(req) {
...
@@ -50,10 +50,11 @@ var getClientIP = function(req) {
return
ipAddress
;
return
ipAddress
;
};
};
exports
.
createLog
=
function
(
req
,
info
,
type
,
thread_type
,
thread
,
p_thread
)
{
exports
.
createLog
=
function
(
req
,
source
,
info
,
type
,
thread_type
,
thread
,
p_thread
)
{
var
logObj
=
{
var
logObj
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
source
:
source
,
mid
:
req
.
session
.
openUser
.
mid
,
mid
:
req
.
session
.
openUser
.
mid
,
open_id
:
req
.
session
.
mobileForumUser
.
openId
,
open_id
:
req
.
session
.
mobileForumUser
.
openId
,
user
:
req
.
session
.
mobileForumUser
.
userId
,
user
:
req
.
session
.
mobileForumUser
.
userId
,
...
...
app/utils/user.js
View file @
467e5e14
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
var
forumUserService
=
require
(
'../service/forumUserService'
);
var
forumUserService
=
require
(
'../service/forumUserService'
);
exports
.
getMobileUser
=
function
(
req
){
exports
.
getMobileUser
=
function
(
req
){
//
return req.session.mobileForumUser.userId;
return
req
.
session
.
mobileForumUser
.
userId
;
return
'55015675868b65a028187c49'
;
//
return '55015675868b65a028187c49';
}
}
exports
.
getOpenId
=
function
(
req
){
exports
.
getOpenId
=
function
(
req
){
...
@@ -24,6 +24,10 @@ exports.identifyUser=function() {
...
@@ -24,6 +24,10 @@ exports.identifyUser=function() {
userId
:
doc
.
_id
,
userId
:
doc
.
_id
,
openId
:
doc
.
uid
openId
:
doc
.
uid
};
};
if
(
req
.
session
.
source
){
req
.
session
.
mobileForumUser
.
source
=
req
.
session
.
source
;
delete
req
.
session
.
source
;
}
next
(
null
);
next
(
null
);
}
else
{
}
else
{
if
(
req
.
session
.
tmpOpenId
){
if
(
req
.
session
.
tmpOpenId
){
...
@@ -44,6 +48,11 @@ exports.identifyUser=function() {
...
@@ -44,6 +48,11 @@ exports.identifyUser=function() {
userId
:
doc
.
_id
,
userId
:
doc
.
_id
,
openId
:
doc
.
uid
openId
:
doc
.
uid
};
};
if
(
req
.
session
.
source
){
req
.
session
.
mobileForumUser
.
source
=
req
.
session
.
source
;
delete
req
.
session
.
source
;
}
next
(
null
);
next
(
null
);
}
}
});
});
...
...
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