|
|
|
|
@ -176,10 +176,10 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
|
* @param array|null $course_ids 课程ID(仅在自定义时间时生效)
|
|
|
|
|
* @param bool $retList 是否返回列表
|
|
|
|
|
*/
|
|
|
|
|
public static function yhInvestedTotal($start_date = null, $end_date = null, $retList = false)
|
|
|
|
|
public static function yhInvestedTotal($start_date = null, $end_date = null, $course_ids, $retList = false)
|
|
|
|
|
{
|
|
|
|
|
// 默认时间:获取所有学员,不限制课程
|
|
|
|
|
$userIds = self::getStudentList($start_date, $end_date, 1, null)->get()->pluck('user_id');
|
|
|
|
|
$userIds = self::getStudentList($start_date, $end_date, 1, $course_ids)->get()->pluck('user_id');
|
|
|
|
|
|
|
|
|
|
// 获取这些学员所在的被投企业
|
|
|
|
|
$companies = Company::whereHas('users', function ($query) use ($userIds) {
|
|
|
|
|
@ -296,15 +296,15 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
|
$years = [];
|
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
|
// 从开始和结束日期中提取年份范围
|
|
|
|
|
$startYear = (int) date('Y', strtotime($start_date));
|
|
|
|
|
$endYear = (int) date('Y', strtotime($end_date));
|
|
|
|
|
$startYear = (int)date('Y', strtotime($start_date));
|
|
|
|
|
$endYear = (int)date('Y', strtotime($end_date));
|
|
|
|
|
// 生成所有年份的数组
|
|
|
|
|
for ($year = $startYear; $year <= $endYear; $year++) {
|
|
|
|
|
$years[] = $year;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 如果没有提供日期,使用当前年份
|
|
|
|
|
$years[] = (int) date('Y');
|
|
|
|
|
$years[] = (int)date('Y');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取这些公司中标记为被投的公司
|
|
|
|
|
@ -320,7 +320,7 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
|
foreach ($projectUsers as $item) {
|
|
|
|
|
$investDate = $item['investDate'] ?? null;
|
|
|
|
|
if ($investDate) {
|
|
|
|
|
$investYear = (int) date('Y', strtotime($investDate));
|
|
|
|
|
$investYear = (int)date('Y', strtotime($investDate));
|
|
|
|
|
if (in_array($investYear, $years)) {
|
|
|
|
|
$hasInvestInYears = true;
|
|
|
|
|
break;
|
|
|
|
|
|