|
|
|
|
@ -124,10 +124,10 @@ class CourseController extends CommonController
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
])->withCount([
|
|
|
|
|
'courseSigns as my_user' => function ($query) {
|
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
|
}
|
|
|
|
|
])->find($all['course_id']);
|
|
|
|
|
'courseSigns as my_user' => function ($query) {
|
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
|
}
|
|
|
|
|
])->find($all['course_id']);
|
|
|
|
|
return $this->success($detail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -212,9 +212,11 @@ class CourseController extends CommonController
|
|
|
|
|
$all = \request()->all();
|
|
|
|
|
$messages = [
|
|
|
|
|
'course_id.required' => '课程id必填',
|
|
|
|
|
'data.required' => '表单必填',
|
|
|
|
|
];
|
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
|
'course_id' => 'required'
|
|
|
|
|
'course_id' => 'required',
|
|
|
|
|
'data' => 'required'
|
|
|
|
|
], $messages);
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
@ -801,54 +803,54 @@ class CourseController extends CommonController
|
|
|
|
|
$query->where('status', 1);
|
|
|
|
|
}
|
|
|
|
|
})->with([
|
|
|
|
|
'courseSigns' => function ($query) use ($all) {
|
|
|
|
|
$query->where('status', 1)->whereHas('course', function ($q) {
|
|
|
|
|
$q->where('is_fee', 1);
|
|
|
|
|
})->with('course.teacher', 'course.typeDetail')
|
|
|
|
|
->orderByRaw("FIELD(fee_status, 1, 0, 2,3)");
|
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
|
$query->where('course_id', $all['course_id']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
])->where(function ($query) use ($all) {
|
|
|
|
|
if ($all['type'] == 1) {
|
|
|
|
|
$query->where('is_schoolmate', 1);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['name'])) {
|
|
|
|
|
$query->where('name', 'like', '%' . $all['name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_business'])) {
|
|
|
|
|
$query->where('company_business', 'like', '%' . $all['company_business'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_name'])) {
|
|
|
|
|
$query->where('company_name', 'like', '%' . $all['company_name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_position'])) {
|
|
|
|
|
$query->where('company_position', $all['company_position']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_area'])) {
|
|
|
|
|
$query->where('company_area', 'like', '%' . $all['company_area'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_type'])) {
|
|
|
|
|
$company_type = explode(',', $all['company_type']);
|
|
|
|
|
$query->where(function ($q) use ($company_type) {
|
|
|
|
|
foreach ($company_type as $v) {
|
|
|
|
|
$q->orWhereRaw('FIND_IN_SET(?, company_type)', [$v]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_industry'])) {
|
|
|
|
|
$company_industry = explode(',', $all['company_industry']);
|
|
|
|
|
$query->where(function ($q) use ($company_industry) {
|
|
|
|
|
foreach ($company_industry as $v) {
|
|
|
|
|
$q->orWhereRaw('FIND_IN_SET(?, company_industry)', [$v]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
'courseSigns' => function ($query) use ($all) {
|
|
|
|
|
$query->where('status', 1)->whereHas('course', function ($q) {
|
|
|
|
|
$q->where('is_fee', 1);
|
|
|
|
|
})->with('course.teacher', 'course.typeDetail')
|
|
|
|
|
->orderByRaw("FIELD(fee_status, 1, 0, 2,3)");
|
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
|
$query->where('course_id', $all['course_id']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
])->where(function ($query) use ($all) {
|
|
|
|
|
if ($all['type'] == 1) {
|
|
|
|
|
$query->where('is_schoolmate', 1);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['name'])) {
|
|
|
|
|
$query->where('name', 'like', '%' . $all['name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_business'])) {
|
|
|
|
|
$query->where('company_business', 'like', '%' . $all['company_business'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_name'])) {
|
|
|
|
|
$query->where('company_name', 'like', '%' . $all['company_name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_position'])) {
|
|
|
|
|
$query->where('company_position', $all['company_position']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_area'])) {
|
|
|
|
|
$query->where('company_area', 'like', '%' . $all['company_area'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_type'])) {
|
|
|
|
|
$company_type = explode(',', $all['company_type']);
|
|
|
|
|
$query->where(function ($q) use ($company_type) {
|
|
|
|
|
foreach ($company_type as $v) {
|
|
|
|
|
$q->orWhereRaw('FIND_IN_SET(?, company_type)', [$v]);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['letter'])) {
|
|
|
|
|
$query->where('letter', $all['letter']);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_industry'])) {
|
|
|
|
|
$company_industry = explode(',', $all['company_industry']);
|
|
|
|
|
$query->where(function ($q) use ($company_industry) {
|
|
|
|
|
foreach ($company_industry as $v) {
|
|
|
|
|
$q->orWhereRaw('FIND_IN_SET(?, company_industry)', [$v]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['letter'])) {
|
|
|
|
|
$query->where('letter', $all['letter']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
|
$list = $list->orderBy('letter')->paginate(10);
|
|
|
|
|
} else {
|
|
|
|
|
|