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
fb699211
Commit
fb699211
authored
Jan 25, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加获取板块列表接口
parent
a13a1377
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletion
+53
-1
forumInfo.js
app/controllers/mobile/forumInfo.js
+53
-1
No files found.
app/controllers/mobile/forumInfo.js
View file @
fb699211
...
@@ -25,7 +25,7 @@ module.exports = function(app) {
...
@@ -25,7 +25,7 @@ module.exports = function(app) {
app
.
use
(
'/v1/forum'
,
router
);
app
.
use
(
'/v1/forum'
,
router
);
};
};
//
新增
论坛板块
//论坛板块
router
.
get
(
'/info/list/all'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/info/list/all'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
rs
=
{};
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
...
@@ -794,3 +794,55 @@ router.get('/info/myAttend', function(req, res, next) {
...
@@ -794,3 +794,55 @@ router.get('/info/myAttend', function(req, res, next) {
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
})
})
});
});
//论坛板块
router
.
get
(
'/info/list/allWithThreadCount'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
ent_code
=
req
.
session
.
user
.
ent_code
;
async
.
waterfall
([
function
(
callback
)
{
forumInfoService
.
getAllByGid
({
ent_code
:
ent_code
},
1
,
100
,
function
(
err
,
datas
)
{
callback
(
err
,
datas
.
items
);
});
},
function
(
infos
,
callback
)
{
//获取用户
var
asyncTasks
=
[];
_
.
forEach
(
infos
,
function
(
info
,
i
)
{
asyncTasks
.
push
(
function
(
cont
)
{
var
conditions
=
{
ent_code
:
ent_code
,
info
:
info
.
_id
};
forumThreadService
.
getAllCountByFid
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
console
.
error
(
err
);
cont
(
err
,
null
);
}
else
{
if
(
infos
[
i
].
toObject
)
{
infos
[
i
]
=
infos
[
i
].
toObject
();
}
infos
[
i
].
threadCount
=
count
;
cont
(
null
,
info
);
}
});
});
});
then
.
parallel
(
asyncTasks
).
then
(
function
(
cont
,
datas
)
{
callback
(
null
,
infos
);
}).
fail
(
function
(
err
,
cont
)
{
callback
(
err
,
null
);
});
}
],
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
result
;
res
.
setHeader
(
'Cache-Control'
,
'public, max-age=3600'
);
// 公共缓存一个小时
res
.
setHeader
(
'Expires'
,
new
Date
(
Date
.
now
()
+
3600000
).
toUTCString
());
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
\ No newline at end of file
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