|
@@ -61,16 +61,17 @@ class ExcellentResidents extends Command
|
|
public function handle()
|
|
public function handle()
|
|
{
|
|
{
|
|
$this->line("开始统计星球居民相关内容");
|
|
$this->line("开始统计星球居民相关内容");
|
|
- $time = Carbon::now()->startOfDay()->toDateTimeString();
|
|
|
|
|
|
+ $yesterday_start = Carbon::now()->addDays(-1)->startOfDay()->toDateTimeString();
|
|
|
|
+ $yesterday_end = Carbon::now()->addDays(-1)->endOfDay()->toDateTimeString();
|
|
$sum_quantity_issued = $this->behavior
|
|
$sum_quantity_issued = $this->behavior
|
|
->leftJoin('comment_account_record as c','behavior.virus_behavior_id','=','c.virus_behavior_id')
|
|
->leftJoin('comment_account_record as c','behavior.virus_behavior_id','=','c.virus_behavior_id')
|
|
->leftJoin('general_ledger_record as g','behavior.virus_behavior_id','=','g.virus_behavior_id')
|
|
->leftJoin('general_ledger_record as g','behavior.virus_behavior_id','=','g.virus_behavior_id')
|
|
->leftJoin('registered_accounts_record as a','behavior.virus_behavior_id','=','a.virus_behavior_id')
|
|
->leftJoin('registered_accounts_record as a','behavior.virus_behavior_id','=','a.virus_behavior_id')
|
|
->leftJoin('release_record as r','behavior.virus_behavior_id','=','r.virus_behavior_id')
|
|
->leftJoin('release_record as r','behavior.virus_behavior_id','=','r.virus_behavior_id')
|
|
- ->where('c.created_at', '>=', $time)
|
|
|
|
- ->orwhere('g.created_at', '>=', $time)
|
|
|
|
- ->orwhere('a.created_at', '>=', $time)
|
|
|
|
- ->orwhere('r.created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('c.created_at', [$yesterday_start,$yesterday_end])
|
|
|
|
+ ->orwhereBetween('g.created_at', [$yesterday_start,$yesterday_end])
|
|
|
|
+ ->orwhereBetween('a.created_at', [$yesterday_start,$yesterday_end])
|
|
|
|
+ ->orwhereBetween('r.created_at', [$yesterday_start,$yesterday_end])
|
|
->get(array(
|
|
->get(array(
|
|
DB::raw('SUM(c.quantity_issued) as c_quantity_issued'),
|
|
DB::raw('SUM(c.quantity_issued) as c_quantity_issued'),
|
|
DB::raw('SUM(g.quantity_issued) as g_quantity_issued'),
|
|
DB::raw('SUM(g.quantity_issued) as g_quantity_issued'),
|
|
@@ -86,7 +87,7 @@ class ExcellentResidents extends Command
|
|
|
|
|
|
//文章被评论最多用户
|
|
//文章被评论最多用户
|
|
$comment = $this->commentRecord
|
|
$comment = $this->commentRecord
|
|
- ->where('created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
$comment = $comment->toArray();
|
|
$comment = $comment->toArray();
|
|
@@ -96,7 +97,7 @@ class ExcellentResidents extends Command
|
|
|
|
|
|
//昨日拉新最多用户
|
|
//昨日拉新最多用户
|
|
$registered = $this->registeredRecord
|
|
$registered = $this->registeredRecord
|
|
- ->where('created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
->select(DB::raw('count(*) as count'), 'superior_uid as content_author_id')//作为用户ID
|
|
->select(DB::raw('count(*) as count'), 'superior_uid as content_author_id')//作为用户ID
|
|
->groupBy('superior_uid')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('superior_uid')->orderBy('count', 'desc')->limit(1)->get();
|
|
$registered = $registered->toArray();
|
|
$registered = $registered->toArray();
|
|
@@ -111,7 +112,7 @@ class ExcellentResidents extends Command
|
|
->first();
|
|
->first();
|
|
$collent = $this->generalRecord
|
|
$collent = $this->generalRecord
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
- ->where('created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
$collent = $collent->toArray();
|
|
$collent = $collent->toArray();
|
|
@@ -126,7 +127,7 @@ class ExcellentResidents extends Command
|
|
->first();
|
|
->first();
|
|
$like = $this->generalRecord
|
|
$like = $this->generalRecord
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
- ->where('created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
$like = $like->toArray();
|
|
$like = $like->toArray();
|
|
@@ -141,7 +142,7 @@ class ExcellentResidents extends Command
|
|
->first();
|
|
->first();
|
|
$forward = $this->generalRecord
|
|
$forward = $this->generalRecord
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
- ->where('created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
$forward = $forward->toArray();
|
|
$forward = $forward->toArray();
|
|
@@ -156,7 +157,7 @@ class ExcellentResidents extends Command
|
|
->first();
|
|
->first();
|
|
$read = $this->generalRecord
|
|
$read = $this->generalRecord
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
->where('virus_behavior_id', $virus_id->virus_behavior_id)
|
|
- ->where('created_at', '>=', $time)
|
|
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->select(DB::raw('count(*) as count'), 'content_author_id', 'related_content_id')
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
$read = $read->toArray();
|
|
$read = $read->toArray();
|