categoryService = $categoryService; $this->CategoryDistrictRepository = $categoryDistrictRepository; $this->CategoryMajorRepository = $CategoryMajorRepository; $this->CategoryRepository = $CategoryRepository; } public function uploadHead() { $image_data = request()->pic1; $saveName = 'person/images/' . uniqid() . '.jpg'; $data = base64_decode($image_data); if (!empty($data)) { $res = Storage::disk('public')->put($saveName, $data); return response()->json(['status' => 1, 'info' => 'success', 'data' => $saveName]); } else { return response()->json(['status' => 0, 'info' => '请上传图片']); } } public function list(Request $request) { $size = 5; $list = JobfairsIc::where('display', 1)->orderBy('ordid', 'desc')->orderBy('id', 'desc')->paginate($size); if ($list->total() > 0) { foreach ($list as $v) { $v['holddate_start_date'] = date('Y-m-d', strtotime($v['holddate_start'])); $v['holddate_start_time'] = date('H:i:s', strtotime($v['holddate_start'])); $v['holddate_end_date'] = date('Y-m-d', strtotime($v['holddate_end'])); $v['holddate_end_time'] = date('H:i:s', strtotime($v['holddate_end'])); $v['companys_arr'] = explode(',', $v['companys']); } } $mobile_dropload = false; if ($list->total() > $size) { $mobile_dropload = true; } if ($request->ajax()) { if ($list->lastPage() < $list->currentPage()) { return response()->json(['status' => 0]); } return response()->json(['status' => 1, 'data' => view('mobile.app.ic.teach.ajax_list', ['list' => $list])->render()]); } $return_data = [ 'list' => $list, 'mobile_dropload' => $mobile_dropload, 'current_url' => \Illuminate\Support\Facades\Request::getRequestUri(), ]; return view('mobile.app.ic.teach.list', $return_data); } public function detail(Request $request) { $info = JobfairsIc::find($request->get('id')); if (empty($info) || $info->display != 1) { $back_url = \Illuminate\Support\Facades\URL::previous(); return $this->showMessage('招聘会不存在或已结束', $back_url, true, '上一页', '3'); } $companys_arr = []; if (!empty($info['companys'])) { $companys = Company::whereIn('id', explode(',', $info['companys']))->get(); foreach ($companys as $company) { $companys_arr[] = ['id' => $company->id, 'name' => $company->companyname]; } } $info['companys_arr'] = $companys_arr; return view('mobile.app.ic.teach.detail', ['info' => $info]); } public function index(Request $request) { $district = $this->categoryService->getDefaultDistrict(); return view('mobile.app.ic.teach.index', [ 'defaultCity' => $district->defaultCity, 'id' => $request->get('id'), ]); } public function save(PresentationAppointValidatorRequest $request) { $field = [ 'pid'=>'招聘会场次', 'realname'=>'姓名', 'sex'=> '性别', 'mobile'=>'手机号', 'birthday'=>'出生年月', 'native_place'=>'籍贯', 'fresh'=>'是否应届', 'education'=>'学历', 'school'=>'学校', 'dep'=>'院系', 'pro_type'=>'专业', 'pro_text'=>'具体专业' ]; $data = $request->post(); foreach ($field as $k => $v) { if (empty($data[$k])) { dd($data,$k); return response()->json(['status' => 0, 'msg' => $v . '不能为空']); } } $check = JobFairsIcAppoint::where('pid', $data['pid'])->where('mobile', $data['mobile'])->first(); if (!empty($check)) { return response()->json(['status' => 0, 'msg' => '您已提交过,请勿重复提交']); } //籍贯 $native_place_arr = explode('.', $data['native_place']); $houseRes = $this->CategoryDistrictRepository->getManydistrict($native_place_arr); $native_place_cn = ''; foreach ($houseRes as $k => $v) { $native_place_cn .= $v['name']; } $data['native_place'] = $native_place_cn; //专业类别 $majorArr = $this->CategoryMajorRepository->getCategoryMajor($data['pro_type']); $data['pro_type'] = $majorArr['name']; //学历 $educationArr = $this->CategoryRepository->getCategory($data['education']); $data['education'] = $educationArr['demand']; //其他处理 $data['avatar'] = $data['avatar'] ?? ''; $data['attachment'] = $data['attachment'] ?? ''; JobFairsIcAppoint::create($data); return response()->json(['status' => 1]); } }