|
|
|
@ -100,7 +100,7 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 指定时间内的报名信息(未去重)
|
|
|
|
* 指定时间内的报名信息(未去重)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static function courseSignsTotal($start_date, $end_date, $status = null, $course_ids = null, $retList = false, $courseType = null)
|
|
|
|
public static function courseSignsTotal($start_date, $end_date, $status = null, $course_ids = null, $retList = false, $needHistory = true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$totalQuery = self::getStudentList($start_date, $end_date, $status, $course_ids);
|
|
|
|
$totalQuery = self::getStudentList($start_date, $end_date, $status, $course_ids);
|
|
|
|
if ($retList) {
|
|
|
|
if ($retList) {
|
|
|
|
@ -110,21 +110,24 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
// 基础数据
|
|
|
|
// 基础数据
|
|
|
|
$baseTotal = $totalQuery->count();
|
|
|
|
$baseTotal = $totalQuery->count();
|
|
|
|
// 历史数据
|
|
|
|
// 历史数据
|
|
|
|
$historyTotal = HistoryCourse::whereHas('calendar', function ($query) {
|
|
|
|
$historyTotal = 0;
|
|
|
|
$query->where('is_count_people', 1);
|
|
|
|
if ($needHistory) {
|
|
|
|
})->whereHas('typeDetail', function ($query) {
|
|
|
|
$historyTotal = HistoryCourse::whereHas('calendar', function ($query) {
|
|
|
|
$query->where('is_history', 1);
|
|
|
|
$query->where('is_count_people', 1);
|
|
|
|
})->where(function ($query) use ($start_date, $end_date) {
|
|
|
|
})->whereHas('typeDetail', function ($query) {
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
$query->where('is_history', 1);
|
|
|
|
$query->whereBetween('start_time', [$start_date, $end_date])
|
|
|
|
})->where(function ($query) use ($start_date, $end_date) {
|
|
|
|
->orWhereBetween('end_time', [$start_date, $end_date]);
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
})->where(function ($query) use ($courseType) {
|
|
|
|
$query->whereBetween('start_time', [$start_date, $end_date])
|
|
|
|
$course_type_id = $courseType ?? request('course_type_id');
|
|
|
|
->orWhereBetween('end_time', [$start_date, $end_date]);
|
|
|
|
if ($course_type_id) {
|
|
|
|
})->where(function ($query) {
|
|
|
|
$course_type_id = explode(',', $course_type_id);
|
|
|
|
$course_type_id = request('course_type_id');
|
|
|
|
$query->whereIn('type', $course_type_id);
|
|
|
|
if ($course_type_id) {
|
|
|
|
}
|
|
|
|
$course_type_id = explode(',', $course_type_id);
|
|
|
|
})->sum('course_type_signs_pass');
|
|
|
|
$query->whereIn('type', $course_type_id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})->sum('course_type_signs_pass');
|
|
|
|
|
|
|
|
}
|
|
|
|
// 返回统计数据
|
|
|
|
// 返回统计数据
|
|
|
|
return $historyTotal + $baseTotal;
|
|
|
|
return $historyTotal + $baseTotal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -133,7 +136,7 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 指定时间内的报名信息(去重)
|
|
|
|
* 指定时间内的报名信息(去重)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static function courseSignsTotalByUnique($start_date, $end_date, $status = null, $course_ids = null, $retList = false, $courseType = null)
|
|
|
|
public static function courseSignsTotalByUnique($start_date, $end_date, $status = null, $course_ids = null, $retList = false, $needHistory = true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$totalQuery = self::getStudentList($start_date, $end_date, $status, $course_ids);
|
|
|
|
$totalQuery = self::getStudentList($start_date, $end_date, $status, $course_ids);
|
|
|
|
$user = User::whereIn('id', $totalQuery->get()->pluck('user_id'))->groupBy('mobile')->get();
|
|
|
|
$user = User::whereIn('id', $totalQuery->get()->pluck('user_id'))->groupBy('mobile')->get();
|
|
|
|
@ -142,22 +145,25 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
return $user;
|
|
|
|
return $user;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$baseTotal = $user->count();
|
|
|
|
$baseTotal = $user->count();
|
|
|
|
// 历史数据
|
|
|
|
$historyTotal = 0;
|
|
|
|
$historyTotal = HistoryCourse::whereHas('calendar', function ($query) use ($courseType) {
|
|
|
|
if ($needHistory) {
|
|
|
|
$query->where('is_count_people', 1);
|
|
|
|
// 历史数据
|
|
|
|
})->whereHas('typeDetail', function ($query) {
|
|
|
|
$historyTotal = HistoryCourse::whereHas('calendar', function ($query) {
|
|
|
|
$query->where('is_history', 1);
|
|
|
|
$query->where('is_count_people', 1);
|
|
|
|
})->where(function ($query) use ($start_date, $end_date) {
|
|
|
|
})->whereHas('typeDetail', function ($query) {
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
$query->where('is_history', 1);
|
|
|
|
$query->whereBetween('start_time', [$start_date, $end_date])
|
|
|
|
})->where(function ($query) use ($start_date, $end_date) {
|
|
|
|
->orWhereBetween('end_time', [$start_date, $end_date]);
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
})->where(function ($query) use ($courseType) {
|
|
|
|
$query->whereBetween('start_time', [$start_date, $end_date])
|
|
|
|
$course_type_id = $courseType ?? request('course_type_id');
|
|
|
|
->orWhereBetween('end_time', [$start_date, $end_date]);
|
|
|
|
if ($course_type_id) {
|
|
|
|
})->where(function ($query) {
|
|
|
|
$course_type_id = explode(',', $course_type_id);
|
|
|
|
$course_type_id = request('course_type_id');
|
|
|
|
$query->whereIn('type', $course_type_id);
|
|
|
|
if ($course_type_id) {
|
|
|
|
}
|
|
|
|
$course_type_id = explode(',', $course_type_id);
|
|
|
|
})->sum('course_type_signs_pass_unique');
|
|
|
|
$query->whereIn('type', $course_type_id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})->sum('course_type_signs_pass_unique');
|
|
|
|
|
|
|
|
}
|
|
|
|
// 统计数据
|
|
|
|
// 统计数据
|
|
|
|
return $baseTotal + $historyTotal;
|
|
|
|
return $baseTotal + $historyTotal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|