Ejobs.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\mobile\EmpBaseController;
  4. use app\common\model\Comjobs as ComjobsModel;
  5. use app\common\model\ComjobsCate as ComjobsCateModel;
  6. use app\common\model\ComjobsLog as ComjobsLogModel;
  7. class Ejobs extends EmpBaseController
  8. {
  9. /**
  10. * 招聘
  11. */
  12. public function form()
  13. {
  14. $workerid = $this->worker->id;
  15. $comjobsid = input('id/d', 0);
  16. $comjobs = ComjobsModel::field([
  17. 'id', 'title', 'cateid', 'address', 'agegroup', 'tags', 'comdetails', 'requirement',
  18. 'companydetails', 'wtype', 'zwagall', 'recruit_num', 'telephone', 'remark', 'picall',
  19. ])->where('workerid', '=', $workerid)->where('id', '=', $comjobsid)->find();
  20. if (empty($comjobs)) {
  21. $comjobs = "{cateid:0}";
  22. } else {
  23. $comjobs->tags = implode(",", $comjobs->tags);
  24. }
  25. $catelist = ComjobsCateModel::field('title as text,id')->order(['priority' => 'desc', 'id' => 'desc'])->select();
  26. return view('ejobs/form', [
  27. 'job' => $comjobs,
  28. 'catelist' => $catelist,
  29. ]);
  30. }
  31. public function formPost()
  32. {
  33. $post = $this->request->post();
  34. $post['tags'] = explode(",", $post['tags']);
  35. $post['status'] = 2;
  36. $post['updatetime'] = time();
  37. $post['picall'] = empty($post['picall']) ? [] : $post['picall'];
  38. if (empty($post['id'])) {
  39. $post['workerid'] = $this->worker->id;
  40. $post['sex'] = 2;
  41. $post['priority'] = 0;
  42. $post['province'] = '福建省';
  43. $item['city'] = '福州市';
  44. $item['district'] = '马尾区';
  45. $post['bwagall'] = $post['zwagall'];
  46. $post['emp_time'] = [];
  47. $post['createtime'] = time();
  48. ComjobsModel::create($post);
  49. } else {
  50. ComjobsModel::update($post, ['id' => $post['id'], 'workerid' => $this->worker->id]);
  51. }
  52. page_result(0, "");
  53. }
  54. public function job()
  55. {
  56. return view('ejobs/job', [
  57. 'status' => $this->request->get('status', 0),
  58. ]);
  59. }
  60. public function listJob()
  61. {
  62. $page = input('page/d', 1);
  63. $size = input('size/d', 20);
  64. $map = [];
  65. $workerid = $this->worker->id;
  66. $map[] = ['workerid', '=', $workerid];
  67. $status = input('status/d', 1);
  68. if (!empty($status)) {
  69. $map[] = ['status', '=', $status];
  70. }
  71. $comjobsid = input('comjobsid/d', 0);
  72. if (!empty($comjobsid)) {
  73. $map[] = ['comjobsid', '=', $comjobsid];
  74. }
  75. $orderby = ['createtime' => 'desc', 'id' => 'desc'];
  76. $list = ComjobsLogModel::with(['comjobs', 'user'])
  77. ->where($map)
  78. ->append(['status_text'])
  79. ->order($orderby)
  80. ->page($page)
  81. ->limit($size)
  82. ->select();
  83. page_result(0, "", $list);
  84. }
  85. public function statusJob()
  86. {
  87. $id = $this->request->post('id');
  88. $info = ComjobsModel::where('id', $id)->where('workerid', $this->worker->id)->find();
  89. if (empty($info)) {
  90. page_result(1, "岗位不存在");
  91. }
  92. if ($info['status'] < 3) {
  93. page_result(1, "请等待后台审核");
  94. }
  95. $info->status = $this->request->post('status');
  96. $info->save();
  97. page_result(0, "");
  98. }
  99. }