Commit 6dbe6a4c authored by 陈家荣's avatar 陈家荣

修改查询社区情况接口

parent 9d6180a8
...@@ -581,8 +581,9 @@ router.post('/getThreadSexStatistic', function(req, res, next) { ...@@ -581,8 +581,9 @@ router.post('/getThreadSexStatistic', function(req, res, next) {
//社区情况(首页_第二版) //社区情况(首页_第二版)
router.get('/statistic_v2', function(req, res, next) { router.get('/statistic_v2', function(req, res, next) {
var yesterday = moment(new Date().getTime() - 24 * 3600 * 1000).format('YYYY-MM-DD'), var yesterday = moment(new Date(req.query.day)).format('YYYY-MM-DD'),
before_yesterday = moment(new Date().getTime() - 2 * 24 * 3600 * 1000).format('YYYY-MM-DD'); before_yesterday = moment(new Date(req.query.day).getTime() - 1 * 24 * 3600 * 1000).format('YYYY-MM-DD');
var ent_code = req.query.ent_code, var ent_code = req.query.ent_code,
y_begin = new Date(yesterday), //昨天开始时间 y_begin = new Date(yesterday), //昨天开始时间
y_end = new Date(yesterday + ' 23:59:59'), //昨天结束时间 y_end = new Date(yesterday + ' 23:59:59'), //昨天结束时间
...@@ -652,7 +653,10 @@ router.get('/statistic_v2', function(req, res, next) { ...@@ -652,7 +653,10 @@ router.get('/statistic_v2', function(req, res, next) {
function(cont) { function(cont) {
//总访问用户 //总访问用户
var match = { var match = {
ent_code: ent_code ent_code: ent_code,
created:{
$lte: y_end
}
}; };
aggregate(ForumUvLog, match, { aggregate(ForumUvLog, match, {
mid: '$mid' mid: '$mid'
...@@ -665,7 +669,10 @@ router.get('/statistic_v2', function(req, res, next) { ...@@ -665,7 +669,10 @@ router.get('/statistic_v2', function(req, res, next) {
function(cont) { function(cont) {
//总发帖数 //总发帖数
var match = { var match = {
ent_code: ent_code ent_code: ent_code,
created: {
$lte: y_end
}
}; };
ForumThread.count(match, function(err, count) { ForumThread.count(match, function(err, count) {
cont(err, count); cont(err, count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment