Ejobs.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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['priority'] = 0;
  41. $post['province'] = '福建省';
  42. $item['city'] = '福州市';
  43. $item['district'] = '马尾区';
  44. $post['bwagall'] = $post['zwagall'];
  45. $post['emp_time'] = [];
  46. $post['createtime'] = time();
  47. ComjobsModel::create($post);
  48. } else {
  49. ComjobsModel::update($post, ['id' => $post['id'], 'workerid' => $this->worker->id]);
  50. }
  51. page_result(0, "");
  52. }
  53. public function job()
  54. {
  55. return view('ejobs/job', [
  56. 'status' => $this->request->get('status', 0),
  57. ]);
  58. }
  59. public function listJob()
  60. {
  61. $page = input('page/d', 1);
  62. $size = input('size/d', 20);
  63. $map = [];
  64. $workerid = $this->worker->id;
  65. $map[] = ['workerid', '=', $workerid];
  66. $status = input('status/d', 1);
  67. if (!empty($status)) {
  68. $map[] = ['status', '=', $status];
  69. }
  70. $comjobsid = input('comjobsid/d', 0);
  71. if (!empty($comjobsid)) {
  72. $map[] = ['comjobsid', '=', $comjobsid];
  73. }
  74. $orderby = ['createtime' => 'desc', 'id' => 'desc'];
  75. $list = ComjobsLogModel::with(['comjobs', 'user'])
  76. ->where($map)
  77. ->append(['status_text'])
  78. ->order($orderby)
  79. ->page($page)
  80. ->limit($size)
  81. ->select();
  82. page_result(0, "", $list);
  83. }
  84. public function statusJob()
  85. {
  86. $id = $this->request->post('id');
  87. $info = ComjobsModel::where('id', $id)->where('workerid', $this->worker->id)->find();
  88. if (empty($info)) {
  89. page_result(1, "岗位不存在");
  90. }
  91. if ($info['status'] < 3) {
  92. page_result(1, "请等待后台审核");
  93. }
  94. $info->status = $this->request->post('status');
  95. $info->save();
  96. page_result(0, "");
  97. }
  98. }