Job.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\green\controller;
  3. use app\common\model\SystemUser;
  4. use app\green\model\GreenJob;
  5. use think\facade\Request;
  6. use think\helper\Time;
  7. class Job extends Common{
  8. public function initialize(){
  9. parent::initialize();
  10. $this->assign('pathMaps',[['name'=>'求职管理','url'=>url("green/job/index")]]);
  11. }
  12. /**
  13. * 列表
  14. */
  15. public function index(){
  16. $condition = [];
  17. $time = Request::param('time/d',0);
  18. $starttime = Request::param('starttime/s');
  19. $endtime = Request::param('endtime/s');
  20. if($time){
  21. switch ($time) {
  22. case 2:
  23. list($start, $end) = Time::yesterday();
  24. break;
  25. case 30:
  26. list($start, $end) = Time::month();
  27. break;
  28. case 60:
  29. list($start, $end) = Time::lastMonth();
  30. break;
  31. default:
  32. list($start, $end) = Time::today();
  33. break;
  34. }
  35. $condition[] = ['create_time','>=',$start];
  36. $condition[] = ['create_time','<=',$end];
  37. }else{
  38. if($starttime){
  39. $condition[] = ['create_time','>=',strtotime($starttime)];
  40. }
  41. if($endtime){
  42. $condition[] = ['create_time','<=',strtotime($endtime)];
  43. }
  44. }
  45. $list = GreenJob::where($this->mini_program)->where($condition)->order('id desc')->paginate(20, false, ['query' => ['starttime' => $starttime, 'endtime' => $endtime, 'time' => $time]]);
  46. foreach ($list as $key => $value) {
  47. $list[$key]->user = SystemUser::where($this->mini_program)->where(['id' => $value->uid])->find();
  48. }
  49. $view['lists'] = $list;
  50. $view['time'] = $time;
  51. $view['starttime'] = $starttime;
  52. $view['endtime'] = $endtime;
  53. return view()->assign($view);
  54. }
  55. /**
  56. * @param int $id
  57. * @return \think\response\View
  58. * @throws \think\exception\DbException
  59. * 详情
  60. */
  61. public function detail(int $id = 0){
  62. $view['info'] = GreenJob::where($this->mini_program)->where(['id' => $id])->find();
  63. return view()->assign($view);
  64. }
  65. }