master
cody 4 months ago
parent 3341c8c191
commit a22eb8cad7

@ -55,9 +55,11 @@ class UserController extends BaseController
{ {
$all = request()->all(); $all = request()->all();
$list = $this->model->with(underlineToHump($all['show_relation'] ?? [])) $list = $this->model->with(underlineToHump($all['show_relation'] ?? []))
->with(['courseSigns' => function ($query) use ($all) { ->with([
$query->where('status', 1)->with('course.teacher', 'course.typeDetail'); 'courseSigns' => function ($query) use ($all) {
}])->where(function ($query) use ($all) { $query->where('status', 1)->with('course.teacher', 'course.typeDetail');
}
])->where(function ($query) use ($all) {
if (isset($all['keyword'])) { if (isset($all['keyword'])) {
$query->whereHas('courses', function ($q) use ($all) { $query->whereHas('courses', function ($q) use ($all) {
$q->where('name', 'like', '%' . $all['keyword'] . '%'); $q->where('name', 'like', '%' . $all['keyword'] . '%');
@ -196,13 +198,22 @@ class UserController extends BaseController
$start_date = $year . '-01-01'; $start_date = $year . '-01-01';
$end_date = $year . '-12-31'; $end_date = $year . '-12-31';
$list = $this->model->with('appointments', 'companyIndustryDetail', $list = $this->model->with(
'companyPositionDetail', 'companyAreaDetail', 'company') 'appointments',
->with(['courseSigns' => function ($query) { 'companyIndustryDetail',
$query->with('course.typeDetail')->orderBy('fee_status', 'desc'); 'companyPositionDetail',
}])->withCount(['appointments' => function ($query) { 'companyAreaDetail',
$query->whereIn('status', [0, 1]); 'company'
}]); )
->with([
'courseSigns' => function ($query) {
$query->with('course.typeDetail')->orderBy('fee_status', 'desc');
}
])->withCount([
'appointments' => function ($query) {
$query->whereIn('status', [0, 1]);
}
]);
// 是否被投企业 // 是否被投企业
if (isset($all['is_yh_invested'])) { if (isset($all['is_yh_invested'])) {
$list = $list->whereHas('company', function ($query) use ($all) { $list = $list->whereHas('company', function ($query) use ($all) {
@ -221,9 +232,16 @@ class UserController extends BaseController
// 新数据 // 新数据
if (isset($all['company_tag'])) { if (isset($all['company_tag'])) {
$list = $list->whereHas('company', function ($query) use ($all) { $list = $list->whereHas('company', function ($query) use ($all) {
foreach (explode(',', $all['company_tag']) as $v) { $string = explode(',', $all['company_tag']);
$query->orWhere('company_tag', 'like', '%' . $v . '%'); $query->where(function ($q) use ($string) {
} foreach ($string as $index => $v) {
if ($index === 0) {
$q->where('company_tag', 'like', '%' . trim($v) . '%');
} else {
$q->orWhere('company_tag', 'like', '%' . trim($v) . '%');
}
}
});
}); });
} }
@ -522,7 +540,8 @@ class UserController extends BaseController
} else { } else {
if (in_array($k, ['company_type', 'type'])) { if (in_array($k, ['company_type', 'type'])) {
$list[$key][$k] = str_replace('、', ',', $value[$v]); $list[$key][$k] = str_replace('、', ',', $value[$v]);
$list[$key][$k] = str_replace('', ',', $list[$key][$k]);; $list[$key][$k] = str_replace('', ',', $list[$key][$k]);
;
} else { } else {
$list[$key][$k] = $value[$v]; $list[$key][$k] = $value[$v];
} }
@ -673,7 +692,7 @@ class UserController extends BaseController
if (isset($all['is_schoolmate'])) { if (isset($all['is_schoolmate'])) {
$data['is_schoolmate'] = $all['is_schoolmate']; $data['is_schoolmate'] = $all['is_schoolmate'];
} }
// if (isset($all['is_black'])) { // if (isset($all['is_black'])) {
// $data['is_black'] = $all['is_black']; // $data['is_black'] = $all['is_black'];
// } // }
$this->model->whereIn('id', $idsArray)->update($data); $this->model->whereIn('id', $idsArray)->update($data);

Loading…
Cancel
Save