|
|
|
|
@ -142,5 +142,27 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
|
return $user->count();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 指定时间内的被投企业
|
|
|
|
|
*/
|
|
|
|
|
public static function yhInvested($start_date, $end_date, $status = null, $course_ids = null)
|
|
|
|
|
{
|
|
|
|
|
$courseSignByType = CourseSign::whereDate('created_at', '>=', $start_date)
|
|
|
|
|
->whereDate('created_at', '<=', $end_date)
|
|
|
|
|
->where(function ($query) use ($status, $course_ids) {
|
|
|
|
|
if (isset($status)) {
|
|
|
|
|
$query->where('status', $status);
|
|
|
|
|
}
|
|
|
|
|
if (isset($course_ids)) {
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
}
|
|
|
|
|
})->whereNotIn('status', [4, 5])
|
|
|
|
|
->get();
|
|
|
|
|
return Company::whereHas('users', function ($query) use ($courseSignByType) {
|
|
|
|
|
$query->whereIn('id', $courseSignByType->pluck('user_id'));
|
|
|
|
|
})->where('is_yh_invested', 1)->count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|