|
...
|
...
|
@@ -2,8 +2,11 @@ |
|
|
|
|
|
|
|
namespace App\Console\Commands\DayCount;
|
|
|
|
|
|
|
|
use App\Models\Projects\InquiryInfo;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use App\Models\Inquiry\InquiryCount as InquiryCountModel;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
...
|
...
|
@@ -56,10 +59,23 @@ class InquiryCount extends Command |
|
|
|
* @time :2023/7/14 16:21
|
|
|
|
*/
|
|
|
|
public function handle(){
|
|
|
|
$data = [];
|
|
|
|
//获取昨天的时间
|
|
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
|
|
$inquiryInfoModel = new InquiryInfo();
|
|
|
|
foreach ($this->status as $k){
|
|
|
|
|
|
|
|
$total = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']]])->count();
|
|
|
|
$untreated = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']],'status'=>1])->count();
|
|
|
|
$invalid = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']],'status'=>0])->count();
|
|
|
|
$data[] = [
|
|
|
|
'status'=>$k,
|
|
|
|
'day'=>$yesterday,
|
|
|
|
'total'=>$total ?? 0,
|
|
|
|
'untreated'=>$untreated ?? 0,
|
|
|
|
'invalid'=>$invalid ?? 0
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$inquiryCount = new InquiryCountModel();
|
|
|
|
$inquiryCount->insert($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|