IndexController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Admin\Controllers\Ic;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\PostAppointIc;
  5. use Encore\Admin\Auth\Permission;
  6. use Encore\Admin\Layout\Content;
  7. use Illuminate\Http\Request;
  8. class IndexController extends Controller
  9. {
  10. public function postInfoList(Content $content, Request $request){
  11. Permission::check('icPostInfoList');
  12. $search_data = $request->all();
  13. $where = [];
  14. foreach ($search_data as $k => $v) {
  15. if ($k == 'realname') {
  16. $where[] = [$k, 'like', "%$v%"];
  17. } elseif (in_array($k,['sex','education'])) {
  18. $where[] = ['post_appoint_ic.'.$k, '=', $v];
  19. }
  20. }
  21. $perpage = 20;
  22. $list = PostAppointIc::where($where)
  23. ->leftJoin("jobs","jobs.id",'=','post_appoint_ic.job_id')
  24. ->select('post_appoint_ic.*','jobs.jobs_name','jobs.company_name')
  25. ->orderBy('updated_at','desc')
  26. ->paginate($perpage);
  27. foreach ($list as $k => $v){
  28. $v->native_place_cn = get_district_cn($v->native_place);
  29. $v->education = get_category($v->education);
  30. if($v->sex == 1){
  31. $list[$k]['sex'] = '男';
  32. }else{
  33. $list[$k]['sex'] = '女';
  34. }
  35. if($v->status == 0){
  36. $list[$k]['status'] = '未下载';
  37. }else{
  38. $list[$k]['status'] = '已下载';
  39. }
  40. }
  41. return $content
  42. ->header('信息管理')
  43. ->description('投递岗位人员信息列表')
  44. ->body(view('admin.ic.post_appoint_list')->with([
  45. 'list' => $list,
  46. 'search_data' => $search_data
  47. ]));
  48. }
  49. public function postStatus(Request $request){
  50. Permission::check('icPostInfoList');
  51. $info = PostAppointIc::where(['id' => $request->id])->first();
  52. if($info){
  53. $info->status = 1;
  54. $info->save();
  55. return response()->json(['status' => 1, 'msg' => '跳转下载中!', 'data' => 'ok', 'url' => $info->attachment]);
  56. }else{
  57. return response()->json(['status' => 0, 'msg' => '找不到记录!', 'data' => 'fail']);
  58. }
  59. //return "/storage/recruit/word/" . $recruit->name_en . '/' .$appoint->audit .$word_url;
  60. }
  61. }