|
|
|
|
@ -2,9 +2,8 @@
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
|
|
|
|
use App\Models\Config;
|
|
|
|
|
use App\Models\Visit;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use App\Models\VisitTime;
|
|
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
|
use App\Helpers\ResponseCode;
|
|
|
|
|
|
|
|
|
|
@ -47,14 +46,11 @@ class ChartController extends CommonController
|
|
|
|
|
$month = $all['year'] . '-' . $item;
|
|
|
|
|
$list[] = [
|
|
|
|
|
'month' => $month,
|
|
|
|
|
'plan_total'=>Visit::where('date','like',"%{$month}%")->count(),
|
|
|
|
|
'enter_total'=>Visit::where('date','like',"%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
'cancel_total'=>Visit::where('date','like',"%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
|
|
|
|
|
'plan_total' => Visit::where('date', 'like', "%{$month}%")->count(),
|
|
|
|
|
'enter_total' => Visit::where('date', 'like', "%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
'cancel_total' => Visit::where('date', 'like', "%{$month}%")->where('audit_status', 5)->count(),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -85,20 +81,16 @@ class ChartController extends CommonController
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
}
|
|
|
|
|
$monthList = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
|
|
$timeList = VisitTime::orderBy('start_time','asc')->get();
|
|
|
|
|
$list = [];
|
|
|
|
|
foreach ($monthList as $item) {
|
|
|
|
|
$month = $all['year'] . '-' . $item;
|
|
|
|
|
foreach ($timeList as $item) {
|
|
|
|
|
$list[] = [
|
|
|
|
|
'month' => $month,
|
|
|
|
|
'plan_total'=>Visit::where('date','like',"%{$month}%")->count(),
|
|
|
|
|
'enter_total'=>Visit::where('date','like',"%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
'cancel_total'=>Visit::where('date','like',"%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
|
|
|
|
|
'time' => $item->start_time.'-'.$item->end_time,
|
|
|
|
|
'plan_total' => Visit::where('date', $all['date'])->where('visit_time_id',$item->id)->count(),
|
|
|
|
|
'enter_total' => Visit::where('date', $all['date'])->where('visit_time_id',$item->id)->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
'cancel_total' => Visit::where('date', $all['date'])->where('visit_time_id',$item->id)->where('audit_status', 5)->count(),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -134,14 +126,11 @@ class ChartController extends CommonController
|
|
|
|
|
$month = $all['year'] . '-' . $item;
|
|
|
|
|
$list[] = [
|
|
|
|
|
'month' => $month,
|
|
|
|
|
'plan_total'=>Visit::where('date','like',"%{$month}%")->count(),
|
|
|
|
|
'enter_total'=>Visit::where('date','like',"%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
'cancel_total'=>Visit::where('date','like',"%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
|
|
|
|
|
'plan_total' => Visit::where('type',3)->where('date', 'like', "%{$month}%")->count(),
|
|
|
|
|
'enter_total' => Visit::where('type',3)->where('date', 'like', "%{$month}%")->whereNotNull('accept_admin_sign')->count(),
|
|
|
|
|
'cancel_total' => Visit::where('type',3)->where('date', 'like', "%{$month}%")->where('audit_status', 5)->count(),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|