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
50d0e775
Commit
50d0e775
authored
Feb 02, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新圈子和板块首页话题数不一样BUG,新增不带板块ID搜索帖子接口
parent
ab51954b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
1 deletion
+94
-1
forumInfo.js
app/controllers/mobile/forumInfo.js
+94
-1
No files found.
app/controllers/mobile/forumInfo.js
View file @
50d0e775
...
...
@@ -796,6 +796,7 @@ router.get('/info/myAttend', function(req, res, next) {
router
.
get
(
'/info/list/allWithThreadCount'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
today
=
new
Date
();
async
.
waterfall
([
function
(
callback
)
{
forumInfoService
.
getAllByGid
({
ent_code
:
ent_code
},
1
,
100
,
function
(
err
,
datas
)
{
...
...
@@ -808,7 +809,17 @@ router.get('/info/list/allWithThreadCount', function(req, res, next) {
asyncTasks
.
push
(
function
(
cont
)
{
var
conditions
=
{
ent_code
:
ent_code
,
info
:
info
.
_id
info
:
info
.
_id
,
level
:
1
,
status
:
1
,
$or
:
[{
isEvent
:
0
},
{
isEvent
:
null
},
{
isEvent
:
1
,
'event.eventStartTime'
:
{
$lte
:
today
}
}]
};
forumThreadService
.
getAllCountByFid
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
...
...
@@ -842,4 +853,86 @@ router.get('/info/list/allWithThreadCount', function(req, res, next) {
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
//搜索文章列表,不带板块ID
router
.
get
(
'/info/serachThreads'
,
function
(
req
,
res
,
next
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
content
=
req
.
query
.
content
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
today
=
new
Date
();
var
conditions
=
{
ent_code
:
ent_code
,
status
:
1
,
$or
:
[{
isEvent
:
0
},
{
isEvent
:
null
},
{
isEvent
:
1
,
'event.eventStartTime'
:
{
$lte
:
today
}
}]
};
if
(
content
)
{
conditions
.
content
=
{
$regex
:
content
,
$options
:
'i'
};
}
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
);
}
}
});
}
],
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
result
)
{
conditions
.
_id
=
{
$nin
:
result
.
thread
};
}
//获取子话题数据
forumThreadService
.
getAllThreadByFid
(
conditions
,
pageNo
,
pageSize
,
'-praise_count'
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
//判断是否已经点赞
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
results
.
items
,
function
()
{
redisPraiseLog
.
get
(
ent_code
,
user
.
getMobileUser
(
req
),
'thread'
,
function
(
error
,
docs
)
{
_
.
forEach
(
results
.
items
,
function
(
d
,
i
)
{
if
(
results
.
items
[
i
].
toObject
)
{
results
.
items
[
i
]
=
results
.
items
[
i
].
toObject
();
}
results
.
items
[
i
].
isPraise
=
false
;
for
(
var
k
=
docs
.
length
-
1
;
k
>=
0
;
k
--
)
{
if
(
results
.
items
[
i
].
_id
==
docs
[
k
])
{
results
.
items
[
i
].
isPraise
=
true
;
break
;
}
};
});
res
.
json
(
_
.
assign
(
results
,
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