Commit fb26d915 authored by 陈家荣's avatar 陈家荣

修改论坛文章获取日期的函数

parent fd1effd0
......@@ -19,6 +19,8 @@ var ForumPvLog = mongoose.model('ForumPVLog'),
ForumUser = mongoose.model('ForumUser'),
ForumThread = mongoose.model('ForumThread');
var Mongoose = require('mongoose');
var ObjectId = Mongoose.Types.ObjectId;
module.exports = function(app) {
app.use('/admin/forum', router);
......@@ -50,7 +52,11 @@ function date_format(date) {
//获取日期之间所有日期
function get_all_date(begin, end) {
var date_array = [];
if (begin === end) return date_array;
// if (begin === end) return date_array;
if (begin === end){
date_array.push(end.replace(/-/g, "/"));
return date_array;
}
var ab = begin.split('-');
var ae = end.split('-');
var db = new Date();
......@@ -395,13 +401,14 @@ router.post('/getThreadActionStatistic', function(req, res, next) {
mapReduce(ForumPraiseLog, match, group, d, cont);
});
});
//统计所有评论
var comment_tasks = [];
_.forEach(all_data_array, function(d) {
comment_tasks.push(function(cont) {
var match = {
thread: t_id,
// thread: t_id,
thread: new ObjectId(t_id),
created: {
$gte: new Date(d + ' 00:00:00'),
$lte: new Date(d + ' 23:59:59')
......
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