master
cody 3 months ago
parent b026445c36
commit 9e243853ab

@ -75,13 +75,19 @@ class CourseSignController extends BaseController
{
$all = request()->all();
$clear = request('clear', 1);
$list = $this->model->with(['course.typeDetail', 'user' => function ($query) use ($all, $clear) {
if ($clear) {
$query->with(['company', 'courseSigns' => function ($q) {
$q->where('status', 1)->with('course');
}]);
$list = $this->model->with([
'course.typeDetail',
'user' => function ($query) use ($all, $clear) {
if ($clear) {
$query->with([
'company',
'courseSigns' => function ($q) {
$q->where('status', 1)->with('course.type');
}
]);
}
}
}])->whereHas('user', function ($query) use ($all) {
])->whereHas('user', function ($query) use ($all) {
if (isset($all['is_vip'])) {
$query->where('is_vip', $all['is_vip']);
}
@ -146,7 +152,7 @@ class CourseSignController extends BaseController
if (isset($all['course_type_id'])) {
$course_type_id = explode(',', $all['course_type_id']);
$courses = Course::where(function ($query) use ($all) {
// if (isset($all['start_date'])) {
// if (isset($all['start_date'])) {
// $query->where('start_date', '>=', $all['start_date']);
// }
// if (isset($all['end_date'])) {
@ -280,7 +286,8 @@ class CourseSignController extends BaseController
// 检测手机号是否存在
if (isset($all['mobile'])) {
$otherUser = User::where('mobile', $all['mobile'])->where('id', '!=', $model->id)->first();
if ($otherUser) return $this->fail([ResponseCode::ERROR_BUSINESS, '该手机号已存在']);
if ($otherUser)
return $this->fail([ResponseCode::ERROR_BUSINESS, '该手机号已存在']);
}
} else {
$model = $this->model;
@ -289,7 +296,8 @@ class CourseSignController extends BaseController
// 检测手机号是否存在
if (isset($all['mobile'])) {
$otherUser = User::where('mobile', $all['mobile'])->first();
if ($otherUser) return $this->fail([ResponseCode::ERROR_BUSINESS, '该手机号已存在']);
if ($otherUser)
return $this->fail([ResponseCode::ERROR_BUSINESS, '该手机号已存在']);
}
}
$original = $model->getOriginal();
@ -436,7 +444,8 @@ class CourseSignController extends BaseController
} else {
if (in_array($k, ['company_type', 'type'])) {
$list[$key][$k] = str_replace('、', ',', $value[$v]);
$list[$key][$k] = str_replace('', ',', $list[$key][$k]);;
$list[$key][$k] = str_replace('', ',', $list[$key][$k]);
;
} else {
$list[$key][$k] = $value[$v];
}
@ -542,7 +551,8 @@ class CourseSignController extends BaseController
}
$course = Course::find($course_id);
$fee_status = $course->is_fee;
if ($item['status'] == 0) $fee_status = 0;
if ($item['status'] == 0)
$fee_status = 0;
$courseSign = CourseSign::updateOrCreate($signWhere, ['is_import' => 1, 'user_id' => $user->id, 'status' => $item['status'], 'fee_status' => $fee_status, 'course_id' => $course_id, 'data' => $signData]);
// 加预约次数
if ($item['status'] == 1) {
@ -600,7 +610,8 @@ class CourseSignController extends BaseController
$idsArray = explode(',', $all['ids']);
foreach ($idsArray as $id) {
$model = $this->model->find($id);
if (empty($model)) continue;
if (empty($model))
continue;
$data = ['course_id' => $all['course_id'], 'course_sign_id' => $id, 'status_text' => CourseSign::$intToString['status'][$all['status']]];
$model->status = $all['status'];
$model->reason = $all['reason'] ?? '';
@ -689,7 +700,8 @@ class CourseSignController extends BaseController
try {
foreach ($idsArray as $id) {
$model = $this->model->find($id);
if (empty($model)) continue;
if (empty($model))
continue;
if ($model->fee_status == 0) {
Notification::send(User::find($model->user_id), new FeeNotify($data));
}

@ -826,8 +826,8 @@ class UserController extends BaseController
foreach ($dataArray as $key => $value) {
// 获取姓名、公司名称、职位
$name = $value['姓名'] ?? $value['name'] ?? '';
$companyName = $value['公司名称'] ?? $value['company_name'] ?? '';
$companyPosition = $value['职'] ?? $value['company_position'] ?? '';
$companyName = $value['公司'] ?? $value['company_name'] ?? '';
$companyPosition = $value['职'] ?? $value['company_position'] ?? '';
// 通过姓名、公司名称、职位匹配用户
$matchedUser = null;
@ -885,6 +885,7 @@ class UserController extends BaseController
// 构建返回结果
$result = [
'headers' => $rowTableFieldByComment, // 表头信息,键为字段名,值为中文注释
'list' => $list,
'matched_count' => count($list) - count($unmatchedUsers),
'unmatched_count' => count($unmatchedUsers),

Loading…
Cancel
Save