|
|
|
@ -9,6 +9,7 @@ use App\Helpers\ResponseCode;
|
|
|
|
use App\Models\AccompanyOrder;
|
|
|
|
use App\Models\AccompanyOrder;
|
|
|
|
use App\Models\AppointmentTotalLog;
|
|
|
|
use App\Models\AppointmentTotalLog;
|
|
|
|
use App\Models\Calendar;
|
|
|
|
use App\Models\Calendar;
|
|
|
|
|
|
|
|
use App\Models\Company;
|
|
|
|
use App\Models\Config;
|
|
|
|
use App\Models\Config;
|
|
|
|
use App\Models\Course;
|
|
|
|
use App\Models\Course;
|
|
|
|
use App\Models\CourseAppointmentTotal;
|
|
|
|
use App\Models\CourseAppointmentTotal;
|
|
|
|
@ -124,10 +125,10 @@ class CourseController extends CommonController
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
])->withCount([
|
|
|
|
])->withCount([
|
|
|
|
'courseSigns as my_user' => function ($query) {
|
|
|
|
'courseSigns as my_user' => function ($query) {
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
])->find($all['course_id']);
|
|
|
|
])->find($all['course_id']);
|
|
|
|
return $this->success($detail);
|
|
|
|
return $this->success($detail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -266,6 +267,17 @@ class CourseController extends CommonController
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, '以下字段为必填项:' . implode('、', $missingFields)]);
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, '以下字段为必填项:' . implode('、', $missingFields)]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 检测 company_name 字段是否包含特殊符号
|
|
|
|
|
|
|
|
if (isset($all['data']) && is_array($all['data'])) {
|
|
|
|
|
|
|
|
foreach ($all['data'] as $item) {
|
|
|
|
|
|
|
|
if (isset($item['field']) && $item['field'] === 'company_name' && !empty($item['value'])) {
|
|
|
|
|
|
|
|
$validation = Company::validateCompanyName($item['value']);
|
|
|
|
|
|
|
|
if (!$validation['valid']) {
|
|
|
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, $validation['message']]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
$result = CourseSign::create([
|
|
|
|
$result = CourseSign::create([
|
|
|
|
'is_change' => $all['is_change'] ?? 0,
|
|
|
|
'is_change' => $all['is_change'] ?? 0,
|
|
|
|
'course_id' => $all['course_id'],
|
|
|
|
'course_id' => $all['course_id'],
|
|
|
|
@ -803,54 +815,54 @@ class CourseController extends CommonController
|
|
|
|
$query->where('status', 1);
|
|
|
|
$query->where('status', 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})->with([
|
|
|
|
})->with([
|
|
|
|
'courseSigns' => function ($query) use ($all) {
|
|
|
|
'courseSigns' => function ($query) use ($all) {
|
|
|
|
$query->where('status', 1)->whereHas('course', function ($q) {
|
|
|
|
$query->where('status', 1)->whereHas('course', function ($q) {
|
|
|
|
$q->where('is_fee', 1);
|
|
|
|
$q->where('is_fee', 1);
|
|
|
|
})->with('course.teacher', 'course.typeDetail')
|
|
|
|
})->with('course.teacher', 'course.typeDetail')
|
|
|
|
->orderByRaw("FIELD(fee_status, 1, 0, 2,3)");
|
|
|
|
->orderByRaw("FIELD(fee_status, 1, 0, 2,3)");
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
$query->where('course_id', $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]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
])->where(function ($query) use ($all) {
|
|
|
|
}
|
|
|
|
if ($all['type'] == 1) {
|
|
|
|
if (isset($all['company_industry'])) {
|
|
|
|
$query->where('is_schoolmate', 1);
|
|
|
|
$company_industry = explode(',', $all['company_industry']);
|
|
|
|
}
|
|
|
|
$query->where(function ($q) use ($company_industry) {
|
|
|
|
if (isset($all['name'])) {
|
|
|
|
foreach ($company_industry as $v) {
|
|
|
|
$query->where('name', 'like', '%' . $all['name'] . '%');
|
|
|
|
$q->orWhereRaw('FIND_IN_SET(?, company_industry)', [$v]);
|
|
|
|
}
|
|
|
|
|
|
|
|
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]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['letter'])) {
|
|
|
|
|
|
|
|
$query->where('letter', $all['letter']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['letter'])) {
|
|
|
|
|
|
|
|
$query->where('letter', $all['letter']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
$list = $list->orderBy('letter')->paginate(10);
|
|
|
|
$list = $list->orderBy('letter')->paginate(10);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|