master
cody 4 weeks ago
parent 5d392beb2d
commit 55164f1605

@ -110,14 +110,14 @@ class CourseSign extends SoftDeletesModel
$courseSignByType = CourseSign::whereDate('created_at', '>=', $start_date) $courseSignByType = CourseSign::whereDate('created_at', '>=', $start_date)
->whereDate('created_at', '<=', $end_date) ->whereDate('created_at', '<=', $end_date)
->whereHas('user', function ($query) use ($area) { ->whereHas('user', function ($query) use ($area) {
// if (isset($area)) { if (isset($area)) {
// if ($area == '苏州市外') { if ($area == '苏州市外') {
// $allArea = ParameterDetail::where('parameter_id', 5)->get(); $allArea = ParameterDetail::where('parameter_id', 5)->get();
// $query->whereNotIn('company_area', $allArea->pluck('value')); $query->whereNotIn('company_area', $allArea->pluck('value'));
// } else { } else {
// $query->where('company_area', $area); $query->where('company_area', $area);
// } }
// } }
})->where(function ($query) use ($status, $course_ids) { })->where(function ($query) use ($status, $course_ids) {
if (isset($status)) { if (isset($status)) {
$query->where('status', $status); $query->where('status', $status);

@ -28,22 +28,22 @@ class EventServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
DB::listen( // DB::listen(
function ($query) { // function ($query) {
$tmp = str_replace('?', '"' . '%s' . '"', $query->sql); // $tmp = str_replace('?', '"' . '%s' . '"', $query->sql);
$qBindings = []; // $qBindings = [];
foreach ($query->bindings as $key => $value) { // foreach ($query->bindings as $key => $value) {
if (is_numeric($key)) { // if (is_numeric($key)) {
$qBindings[] = $value; // $qBindings[] = $value;
} else { // } else {
$tmp = str_replace(':' . $key, '"' . $value . '"', $tmp); // $tmp = str_replace(':' . $key, '"' . $value . '"', $tmp);
} // }
} // }
$tmp = vsprintf($tmp, $qBindings); // $tmp = vsprintf($tmp, $qBindings);
$tmp = str_replace("\\", "", $tmp); // $tmp = str_replace("\\", "", $tmp);
Log::info(' execution time: ' . $query->time . 'ms; ' . $tmp . "\n\t"); // Log::info(' execution time: ' . $query->time . 'ms; ' . $tmp . "\n\t");
} // }
); // );
} }
/** /**

Loading…
Cancel
Save