master
cody 2 weeks ago
parent 16b5972407
commit 12e352b220

@ -152,17 +152,23 @@ class CourseSign extends SoftDeletesModel
*/
public static function yhInvested($start_date = null, $end_date = null, $retList = false)
{
$courseSignByTypeQuery = self::getStudentList($start_date, $end_date, 1, null);
$list = Company::whereHas('users', function ($query) use ($courseSignByTypeQuery) {
$query->whereIn('id', $courseSignByTypeQuery->get()->pluck('user_id'));
})->where('is_yh_invested', 1)->get();
if ($retList) {
// 返回列表
return $list;
} else {
// 返回统计数据
return $list->count();
$userIds = self::getStudentList($start_date, $end_date, 1, null)->get()->pluck('user_id');
$companies = Company::whereHas('users', fn($q) => $q->whereIn('id', $userIds))
->where('is_yh_invested', 1)->get();
// 非默认时间:按 investDate 筛选
if ($start_date && $start_date != CourseType::START_DATE) {
$startDate = substr($start_date, 0, 10);
$endDate = substr($end_date, 0, 10);
$companies = $companies->filter(function ($company) use ($startDate, $endDate) {
return collect($company->project_users ?? [])->contains(function ($item) use ($startDate, $endDate) {
$investDate = $item['investDate'] ?? null;
return $investDate && $investDate >= $startDate && $investDate <= $endDate;
});
});
}
return $retList ? $companies->values() : $companies->count();
}
/**
@ -341,10 +347,21 @@ class CourseSign extends SoftDeletesModel
// 检测关键词
$companyNameKeyword = [
'元禾控股', '元禾原点', '元禾厚望', '元禾重元',
'元禾璞华', '元禾谷风', '元禾绿柳', '元禾辰坤', '元禾沙湖',
'禾裕集团', '苏州科服', '信诚管理咨询',
'集成电路公司', '常州团队', '国企元禾'
'元禾控股',
'元禾原点',
'元禾厚望',
'元禾重元',
'元禾璞华',
'元禾谷风',
'元禾绿柳',
'元禾辰坤',
'元禾沙湖',
'禾裕集团',
'苏州科服',
'信诚管理咨询',
'集成电路公司',
'常州团队',
'国企元禾'
];
$company = Company::where(function ($query) use ($companyNameKeyword) {
foreach ($companyNameKeyword as $item) {

Loading…
Cancel
Save