123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace App\Http\Controllers;
- use App\Models\JobList;
- use App\Models\LookJob;
- use Carbon\Carbon;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\Validator;
- class LookJobController extends Controller
- {
- /**获取个人找活信息列表**/
- public function GetUserInfoList(Request $request){
- $page_index=$request->input('page_index');
- $page_size=$request->input('page_size');
- $user_id=Auth::user()->id;
- return $this->success(LookJob::info($user_id,$page_index,$page_size));
- }
- /**获取找活列表信息**/
- public function GetLookJobList(Request $request){
- $page_index=$request->input('page_index');
- $page_size=$request->input('page_size');
- $status=true;
- if (!Auth::check()){
- $status=false;
- }
- $classify_pid=$request->input('classify_pid');
- $classify_id=$request->input('classify_id');
- $province=$request->input('province');
- $city=$request->input('city');
- $team_label=$request->input('team_label');
- return $this->success(LookJob::GetJobList($page_index,$page_size,$status,$classify_pid,$classify_id,$province,$city,$team_label));
- }
- public function GetLookJobDetail(Request $request){
- $id=$request->input('id');
- $status=true;
- if (!Auth::check()){
- $status=false;
- }
- return $this->success(LookJob::GetLookJobDetail($id,$status));
- }
- /**新增找活信息***/
- public function AddUpdateInfo(Request $request){
- $data=$request->all();
- $rules=[
- 'classify_id' => 'required',//所属分类
- 'mobile' => 'required',//联系电话
- 'province' => 'required',
- 'city' => 'required',
- 'area' => 'required',//招工地址
- 'address' => 'required',//招工地址
- 'username' => 'required|max:20',//联系人
- 'description' => 'required|max:500',//项目简介
- // 'longitude' => 'required',//纬度
- // 'latitude' => 'required',//经度
- 'work_time' => 'required',//工龄
- 'team_label' => 'required',//人员构成
- 'nation' => 'required',//民族
- 'sex' => 'required',//性别
- 'datetime' => 'required',//出生日期
- ];
- $messages=[
- 'required'=>':attribute 是必填项!',
- 'max'=>':attribute 超过最大值'
- ];
- $validator = Validator::make($data, $rules, $messages);
- if($validator->fails()){
- return $this->fail(['400013',$validator->errors()->first()]);
- }
- if ($request->has('id')){
- LookJob::updateInfo($data);
- return $this->success();
- }
- $data['user_id']=Auth::user()->id;
- $data['created_at']=Carbon::now();
- $data['updated_at']=Carbon::now();
- LookJob::add($data);
- return $this->success();
- }
- /**点击更新招满、进行时的装态**/
- public function UpdateStatus(Request $request){
- $id=$request->input('id');
- $status=$request->input('status');
- LookJob::updateStatus($id,$status);
- return $this->success();
- }
- /**删除招找活*/
- public function DelLookJobInfo(Request $request){
- $id=$request->input('id');
- LookJob::DelJobInfo($id);
- return $this->success();
- }
- }
|