|
...
|
...
|
@@ -6,6 +6,7 @@ use App\Models\Inquiry\InquiryCount as InquiryCountModel; |
|
|
|
use App\Models\Inquiry\InquiryInfo;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
...
|
...
|
@@ -62,20 +63,24 @@ class InquiryCount extends Command |
|
|
|
//获取昨天的时间
|
|
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
|
|
$inquiryInfoModel = new InquiryInfo();
|
|
|
|
foreach ($this->status as $k=>$v){
|
|
|
|
$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[] = [
|
|
|
|
'type'=>$k,
|
|
|
|
'day'=>$yesterday,
|
|
|
|
'total'=>$total ?? 0,
|
|
|
|
'untreated'=>$untreated ?? 0,
|
|
|
|
'invalid'=>$invalid ?? 0
|
|
|
|
];
|
|
|
|
try {
|
|
|
|
foreach ($this->status as $k=>$v){
|
|
|
|
$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[] = [
|
|
|
|
'type'=>$k,
|
|
|
|
'day'=>$yesterday,
|
|
|
|
'total'=>$total ?? 0,
|
|
|
|
'untreated'=>$untreated ?? 0,
|
|
|
|
'invalid'=>$invalid ?? 0
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$inquiryCount = new InquiryCountModel();
|
|
|
|
$inquiryCount->insert($data);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
Log::error('inquiry_count : error');
|
|
|
|
}
|
|
|
|
$inquiryCount = new InquiryCountModel();
|
|
|
|
$inquiryCount->insert($data);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|