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
0de04d5b
Commit
0de04d5b
authored
Jul 15, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of git.wxpai.cn:scrmgroup/pisns-forum-api into development
parents
357833c1
35b61279
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
38 deletions
+75
-38
forumInfo.js
app/controllers/mobile/forumInfo.js
+12
-11
forumShare.js
app/controllers/mobile/forumShare.js
+38
-22
forumUser.js
app/controllers/mobile/forumUser.js
+5
-2
forumInfo.js
app/models/forumInfo.js
+9
-1
httpService.js
app/service/httpService.js
+11
-2
No files found.
app/controllers/mobile/forumInfo.js
View file @
0de04d5b
...
...
@@ -307,17 +307,18 @@ router.get('/info/:fid/myThreads', function(req, res, next) {
async
.
waterfall
([
function
(
callback
)
{
forumUserThreadControlService
.
getUserThreadControlById
(
user
.
getMobileUser
(
req
),
function
(
err
,
doc
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
if
(
doc
)
{
callback
(
null
,
doc
);
}
else
{
callback
(
null
,
null
);
}
}
});
callback
();
// forumUserThreadControlService.getUserThreadControlById(user.getMobileUser(req), function(err, doc) {
// if (err) {
// callback(err, null);
// } else {
// if (doc) {
// callback(null, doc);
// } else {
// callback(null, null);
// }
// }
// });
}
],
function
(
err
,
result
)
{
if
(
err
)
{
...
...
app/controllers/mobile/forumShare.js
View file @
0de04d5b
...
...
@@ -93,33 +93,49 @@ router.get('/:ent_code/share.js', function(req, res, next) {
//分享记录对象
share_log
.
type
=
2
;
share_log
.
info
=
id
;
//查询板块默认分享设置
forumShareConfigService
.
getByKey
(
ent_code
,
'share'
,
function
(
err
,
result
)
{
if
(
err
)
{
forumInfoService
.
getInfoById
(
id
,
function
(
err
,
forumInfo
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
BUSY
));
}
else
{
var
title
=
''
,
desc
=
''
,
imgUrl
=
''
;
if
(
result
)
{
//匹配板块默认分享设置
result
=
result
.
meta_value
;
_
.
forEach
(
result
,
function
(
e
){
if
(
e
.
type
===
'info'
)
{
title
=
e
.
title
;
desc
=
e
.
desc
;
imgUrl
=
e
.
imgUrl
;
return
;
}
});
link
=
link
+
'index&infoId='
+
id
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
return
;
}
if
(
forumInfo
.
share_type
==
1
){
var
shareInfo
=
forumInfo
.
share
||
{};
var
title
=
shareInfo
.
title
||
''
,
desc
=
shareInfo
.
desc
||
''
,
imgUrl
=
shareInfo
.
imgUrl
||
''
;
link
=
link
+
'index&infoId='
+
id
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
return
;
}
//默认分享设置 //查询板块默认分享设置
forumShareConfigService
.
getByKey
(
ent_code
,
'share'
,
function
(
err
,
result
)
{
if
(
err
){
console
.
error
(
err
);
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
BUSY
));
}
else
{
//没找到板块默认分享设置
console
.
error
(
'info默认分享设置不存在'
);
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
DATA_NOTEXITS
));
var
title
=
''
,
desc
=
''
,
imgUrl
=
''
;
if
(
result
)
{
//匹配板块默认分享设置
result
=
result
.
meta_value
;
_
.
forEach
(
result
,
function
(
e
){
if
(
e
.
type
===
'info'
)
{
title
=
e
.
title
;
desc
=
e
.
desc
;
imgUrl
=
e
.
imgUrl
;
return
;
}
});
link
=
link
+
'index&infoId='
+
id
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
}
else
{
//没找到板块默认分享设置
console
.
error
(
'info默认分享设置不存在'
);
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
DATA_NOTEXITS
));
}
}
}
}
);
});
}
else
if
(
type
===
'Thread'
)
{
share_log
.
type
=
3
;
share_log
.
thread
=
id
;
...
...
app/controllers/mobile/forumUser.js
View file @
0de04d5b
...
...
@@ -17,7 +17,8 @@ module.exports = function(app) {
};
//获取用户信息
router
.
get
(
'/user/get'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/user/:fid/get'
,
function
(
req
,
res
,
next
)
{
var
fid
=
req
.
params
.
fid
||
null
;
var
rs
=
{};
async
.
parallel
([
function
(
cb
){
...
...
@@ -32,7 +33,9 @@ router.get('/user/get', function(req, res, next) {
function
(
cb
){
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
from
:
user
.
getMobileUser
(
req
)
from
:
user
.
getMobileUser
(
req
),
status
:
1
,
info
:
fid
};
forumThreadService
.
getAllCountByFid
(
conditions
,
function
(
err
,
count
){
if
(
err
)
{
...
...
app/models/forumInfo.js
View file @
0de04d5b
...
...
@@ -41,7 +41,15 @@ var ForumInfoSchema = new Schema({
type
:
Number
,
require
:
true
,
default
:
1
},
},
share_type
:{
//分享类型,1自定义,0和其它为默认
type
:
Number
,
default
:
0
},
share
:{
//desc title imgUrl
type
:
Object
,
default
:{}
},
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/service/httpService.js
View file @
0de04d5b
...
...
@@ -19,7 +19,8 @@ var mongoose = require('mongoose'),
var
ForumPVLog
=
mongoose
.
model
(
'ForumPVLog'
),
ForumUVLog
=
mongoose
.
model
(
'ForumUVLog'
),
ForumShareLog
=
mongoose
.
model
(
'ForumShareLog'
);
ForumShareLog
=
mongoose
.
model
(
'ForumShareLog'
),
ForumThread
=
mongoose
.
model
(
'ForumThread'
);
exports
.
sendRequest
=
function
(
ent_code
,
mid
,
action
,
messageid
,
integral
,
exp
)
{
var
obj
=
{
tag
:
'member'
,
...
...
@@ -153,7 +154,15 @@ exports.createShareLog = function(req,share_type) {
if
(
logObj
){
then
(
function
(
cont
){
var
share_log_model
=
new
ForumShareLog
(
logObj
);
share_log_model
.
save
(
cont
);
share_log_model
.
save
(
function
(
err
){
cont
(
err
);
});
}).
then
(
function
(
cont
){
if
(
logObj
.
thread
){
ForumThread
.
update
({
_id
:
logObj
.
thread
},{
$inc
:{
share_count
:
1
}},
function
(
err
){
cont
(
err
);
});
}
}).
fail
(
function
(
cont
,
err
){
console
.
error
(
err
);
});
...
...
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