| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 | 
							- <?php
 
- namespace App\Admin\Controllers\Content;
 
- use App\Http\Controllers\Controller;
 
- use App\Models\Recuperate;
 
- use App\Models\RecuperateApply;
 
- use App\Models\RecuperateLog;
 
- use App\Models\RecuperateTime;
 
- use Encore\Admin\Controllers\HasResourceActions;
 
- use Encore\Admin\Grid;
 
- use Encore\Admin\Layout\Content;
 
- use Illuminate\Http\Request;
 
- use Encore\Admin\Facades\Admin;
 
- class RecuperateApplyController extends Controller
 
- {
 
-     use HasResourceActions;
 
-     /**
 
-      * Index interface.
 
-      *
 
-      * @param Content $content
 
-      * @return Content
 
-      */
 
-     public function index(Content $content)
 
-     {
 
-         return $content
 
-             ->header('报名列表')
 
-             ->description(' ')
 
-             ->body(view('admin.content.recuperate_apply')->with(['grid' => $this->grid()]));
 
-     }
 
-     /**
 
-      * Make a grid builder.
 
-      *
 
-      * @return Grid
 
-      */
 
-     protected function grid()
 
-     {
 
-         $grid = new Grid(new RecuperateApply());
 
-         $grid->model()->orderBy('created_at', 'DESC');
 
-         $grid->recuperate_id('套餐id');
 
-         $grid->column('套餐标题')->display(function () {
 
-             //套餐被删除
 
-             if (empty($this->recuperate)) {
 
-                 return '<span style="color:#A0A0A0;">已被删除</span>';
 
-             }
 
-             $style = "color:" . $this->recuperate->tit_color . ';';
 
-             if ($this->recuperate->tit_b == '1') {
 
-                 $style .= 'font-weight:bold;';
 
-             }
 
-             return '<span style="' . $style . '">' . $this->recuperate->title . '</span>';
 
-         })->width(200);
 
-         $grid->small_img('缩略图')->display(function () {
 
-             //套餐被删除
 
-             if (empty($this->recuperate)) {
 
-                 return '';
 
-             }
 
-             if ($this->recuperate->small_img) {
 
-                 return '<span class="vtip" title="<img src=\'' . upload_asset($this->recuperate->small_img) . '\'  height=120>">
 
-                             <img class="avatar small" src="' . upload_asset($this->recuperate->small_img) . '" align="absmiddle" style="width: 22px;height: 22px;">
 
-                         </span>';
 
-             } else {
 
-                 return '';
 
-             }
 
-         });
 
-         $grid->price('套餐金额');
 
-         $grid->user_name('姓名');
 
-         $grid->user_idcard('身份证');
 
-         $grid->mobile('联系电话');
 
-         $grid->wechat('微信号');
 
-         $grid->company_name('工作单位');
 
-         $grid->column('人才层次')->display(function () {
 
-             $level_arr = [
 
-                 '',
 
-                 '第一层次',
 
-                 '第二层次',
 
-                 '第三层次',
 
-                 '第四层次',
 
-                 '第五层次',
 
-                 '第六层次',
 
-                 '第七层次',
 
-             ];
 
-             return $level_arr[$this->level];
 
-         });
 
-         $grid->condition("适用对象类型");
 
-         $grid->column('个税社保')->display(function () {
 
-             $level_arr = [
 
-                 '',
 
-                 '是',
 
-                 '否',
 
-             ];
 
-             return $level_arr[$this->tax];
 
-         });
 
-         $grid->column('年薪')->display(function () {
 
-             $level_arr = [
 
-                 '',
 
-                 '是',
 
-                 '否',
 
-             ];
 
-             return $level_arr[$this->salary];
 
-         });
 
-         $grid->created_at('报名时间');
 
-         $grid->column('审核状态')->display(function () {
 
-             $status_arr = [
 
-                 '待审核',
 
-                 '审核通过',
 
-                 '审核不通过',
 
-                 '取消活动',
 
-             ];
 
-             $reason     = $this->reason ? '<a style="margin-left: 5px;" data-reason="' . $this->reason . '" class="audit_log"><i class="fa fa-eye"></i></a>' : '';
 
-             return '<span style="color:#FF6600">' . $status_arr[$this->status] . $reason . '</span>';
 
-         });
 
-         //审核功能
 
-         $grid->actions(function ($actions) {
 
-             if ($actions->row['status'] == 0) {
 
-                 $actions->append("<button class='btn btn-primary btn-xs applyaudit' data-code=" . $actions->row['id'] . ">审核</button>");
 
-             }
 
-             /*取消活动*/
 
-             if ($actions->row['status'] != 2 && $actions->row['status'] != 3) {
 
-                 $actions->append("<button class='btn btn-primary btn-xs applyaudits' data-code=" . $actions->row['id'] . ">取消</button>");
 
-             }
 
-         });
 
-         $grid->filter(function ($filter) {
 
-             $filter->disableIdFilter();
 
-             $filter->equal('recuperate_id', '套餐id');
 
-             /*$filter->where(function($query){
 
-                 $recuperate = Recuperate::where('title','like',"%{$this->input}%")->get();
 
-                 $ids = $recuperate->pluck('id')->all();
 
-                 if (empty($ids)) {
 
-                     $query->where('id','=',0);
 
-                 } else {
 
-                     $query->whereIn('recuperate_id',$ids);
 
-                 }
 
-             }, '');*/
 
-             $date3       = date('Y-m-d', strtotime("-3 day"));
 
-             $date7       = date('Y-m-d', strtotime("-7 day"));
 
-             $date30      = date("Y-m-d", strtotime("-1 month"));
 
-             $date180     = date("Y-m-d", strtotime("-6 month"));
 
-             $date360     = date("Y-m-d", strtotime("-1 year"));
 
-             $date_option = [
 
-                 ''       => '不限',
 
-                 $date3   => '三天内',
 
-                 $date7   => '一周内',
 
-                 $date30  => '一月内',
 
-                 $date180 => '半年内',
 
-                 $date360 => '一年内',
 
-             ];
 
-             $filter->where(function ($query) {
 
-                 $query->where('created_at', '>=', "{$this->input}");
 
-             }, '添加时间', 'created_at')->radio($date_option);
 
-             $status_option = [
 
-                 '' => '不限',
 
-                 0  => '待审核',
 
-                 1  => '审核通过',
 
-                 2  => '审核不通过',
 
-             ];
 
-             $filter->where(function ($query) {
 
-                 if (isset($this->input)) {
 
-                     $query->where('status', '=', "{$this->input}");
 
-                 }
 
-             }, '审核状态', 'status')->radio($status_option);
 
-         });
 
-         return $grid;
 
-     }
 
-     public function audit(Request $request)
 
-     {
 
-         $id     = $request->id;
 
-         $status = $request->status;
 
-         $reason = $request->reason;
 
-         $url    = empty($request->url) ? '/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/content/recuperate/apply' : $request->url;
 
-         if (empty($id)) {
 
-             admin_toastr('数据异常', 'error');
 
-             return redirect('/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/content/recuperate/apply');
 
-         }
 
-         $result = RecuperateApply::where('id', '=', $id)->update(['status' => $status, 'reason' => $reason]);
 
-         if ($result) {
 
-             admin_toastr('审核成功', 'success');
 
-         } else {
 
-             admin_toastr('该信息不存在或已审核', 'error');
 
-         }
 
-         return redirect($url);
 
-     }
 
-     public function audit_qx(Request $request)
 
-     {
 
-         $id = $request->id;
 
-         //  $status = $request->status;
 
-         //  $reason = $request->reason;
 
-         $url = empty($request->url) ? '/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/content/recuperate/apply' : $request->url;
 
-         if (empty($id)) {
 
-             admin_toastr('数据异常1', 'error');
 
-             return redirect('/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/content/recuperate/apply');
 
-         }
 
-         $result           = RecuperateApply::where('id', '=', $id)->update(['status' => 3]);
 
-         $recuperate_apply = RecuperateApply::where('id', '=', $id)->select('uid')->first();
 
-         $auditData        = [
 
-             'type'     => 2,
 
-             'admin_id' => \Encore\Admin\Facades\Admin::user()->id,
 
-             'sid'      => $recuperate_apply->uid,
 
-             'content'  => "取消活动",
 
-         ];
 
-         RecuperateLog::create($auditData);
 
-         if ($result) {
 
-             admin_toastr('取消成功', 'success');
 
-         } else {
 
-             admin_toastr('该信息不存在或已审核', 'error');
 
-         }
 
-         return redirect($url);
 
-     }
 
-     /*个人列表*/
 
-     public function appointinfo(Content $content, Request $request)
 
-     {
 
-         $uid             = $request->uid;
 
-         $recuperateApply = RecuperateApply::where('uid', $uid);
 
-         $recuperateTime  = RecuperateTime::where('uid', $uid)->select('id', 'year')->orderBy('id', 'desc')->get();
 
-         if (empty($recuperateApply)) {
 
-             return back();
 
-         }
 
-         $search_data = $request->all();
 
-         $search_data['uid']                = isset($search_data['uid']) ? $search_data['uid'] : $uid;
 
-         $search_data['status']             = isset($search_data['status']) ? $search_data['status'] : 1;
 
-         $search_data['recuperate_time_id'] = isset($search_data['recuperate_time_id']) ? $search_data['recuperate_time_id'] : $recuperateTime[0]->id;
 
-         $where                             = [];
 
-         if (isset($search_data['perpage'])) {
 
-             $perpage = $search_data['perpage'];
 
-         } else {
 
-             $session_data = session('search_data');
 
-             if (isset($session_data['perpage'])) {
 
-                 $perpage = $session_data['perpage'];
 
-             } else {
 
-                 $perpage = 20;
 
-             }
 
-         }
 
-         if (isset($search_data['uid']) || session('manage_search_data')['uid']) {
 
-             if (isset($search_data['page'])) {
 
-                 if (session('search_data')) {
 
-                     $where = session('managewhere');
 
-                     unset($search_data['page']);
 
-                     $search_data = session('manage_search_data');
 
-                 }
 
-             }
 
-             foreach ($search_data as $k => $v) {
 
-                 if ($k == 'status') {
 
-                     $where[] = ['recuperate_apply.status', 'like', "%$v%"];
 
-                 } elseif ($k == 'recuperate_time_id') {
 
-                     $where[] = ['recuperate_apply.recuperate_time_id', '=', $v];
 
-                 } elseif ($k == 'uid') {
 
-                     $where[] = ['recuperate_apply.uid', '=', $v];
 
-                 } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
 
-                     $where[] = [$k, '=', $v];
 
-                 }
 
-             }
 
-             session(['managewhere' => $where]);
 
-             session(['manage_search_data' => $search_data]);
 
-             session()->save();
 
-         }
 
-         $list = RecuperateApply::where($where)
 
-             ->join('recuperate', 'recuperate_apply.recuperate_id', '=', 'recuperate.id', 'left')
 
-             ->join('recuperate_time', 'recuperate_apply.recuperate_time_id', '=', 'recuperate_time.id', 'left')
 
-             ->select('recuperate_apply.*', 'recuperate.title', 'recuperate_time.year')
 
-             ->orderBy('recuperate_apply.id', 'desc')
 
-             ->paginate($perpage);
 
-         return $content
 
-             ->header('招考管理')
 
-             ->description('招考人员信息列表')
 
-             ->body(view('admin.content.recuperate_apply_personal')->with([
 
-                 'list'           => $list,
 
-                 'search_data'    => $search_data,
 
-                 'recuperateTime' => $recuperateTime,
 
-             ]));
 
-     }
 
- }
 
 
  |