Outjob.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. namespace app\worker\controller;
  3. use app\worker\BaseController;
  4. use app\common\model\AgentMarket as AgentMarketModel;
  5. use app\common\model\OutRecruit as OutRecruitModel;
  6. use app\common\model\OutRecruitReport as OutRecruitReportModel;
  7. use think\facade\Request;
  8. class Outjob extends BaseController
  9. {
  10. /**
  11. * 招聘信息
  12. */
  13. public function index()
  14. {
  15. $workerid = $this->access_worker['id'];
  16. if (Request::isAjax()) {
  17. $limit = input('limit/d', 20);
  18. $page = input('page/d', 1);
  19. $map = [];
  20. $map[] = ['worker_id', '=', $workerid];
  21. $keywords = input('keywords/s', "");
  22. if (!empty($keywords)) {
  23. $map[] = ['title', 'like', '%' . $keywords . '%'];
  24. }
  25. $status = input('status/d');
  26. if (!empty($status)) {
  27. $map[] = ['status', '=', $status];
  28. }
  29. $list = OutRecruitModel::where($map)
  30. ->order(['priority' => 'desc', 'id' => 'desc'])
  31. ->limit($limit)
  32. ->page($page)
  33. ->append(['status_text'])
  34. ->select();
  35. $count = OutRecruitModel::where($map)->count();
  36. if ($count == 0) {
  37. exit(json_encode([
  38. 'code' => 1,
  39. 'msg' => "未查询到数据",
  40. ]));
  41. }
  42. exit(json_encode([
  43. 'code' => 0,
  44. 'msg' => "",
  45. 'count' => $count,
  46. 'data' => $list,
  47. ]));
  48. } else {
  49. return view('outjob/index');
  50. }
  51. }
  52. public function editrecruit()
  53. {
  54. $id = input('id/d', 0);
  55. $data = [
  56. 'title' => input('title/s', ""),
  57. 'company_name' => input('company_name/s', ""),
  58. 'num' => input('num/d', 1),
  59. 'province' => input('province/s', ""),
  60. 'city' => input('city/s', ""),
  61. 'district' => input('district/s', ""),
  62. 'address' => input('address/s', ""),
  63. 'agegroup' => input('agegroup/s', ""),
  64. 'tags' => input('tags/a', []),
  65. 'requirement' => input('requirement/s', ""),
  66. 'comdetails' => input('comdetails/s', ""),
  67. 'picall' => input('picall/a', []),
  68. 'salary' => input('salary/s', ""),
  69. 'telephone' => input('telephone/s', ""),
  70. 'remark' => input('remark/s', ""),
  71. 'priority' => input('priority/d', 255),
  72. 'volume' => input('volume/d', 0),
  73. 'market_content' => input('market_content/s', ""),
  74. 'is_bargain' => input('is_bargain/d', 1),
  75. 'updatetime' => time(),
  76. ];
  77. $data['status'] = 2;
  78. if (empty($id)) {
  79. $data['worker_id'] = $this->access_worker['id'];
  80. $data['createtime'] = time();
  81. OutRecruitModel::create($data);
  82. } else {
  83. OutRecruitModel::update($data, ['id' => $id]);
  84. }
  85. exit(json_encode([
  86. 'code' => 0,
  87. ]));
  88. }
  89. public function delrecruit()
  90. {
  91. $id = input('id/d');
  92. $res = OutRecruitReportModel::where('recruit_id', $id)->find();
  93. if (!empty($res)) {
  94. exit(json_encode([
  95. 'code' => 1,
  96. 'msg' => "已有报备记录,无法删除",
  97. ]));
  98. }
  99. OutRecruitModel::destroy($id);
  100. exit(json_encode([
  101. 'code' => 0,
  102. ]));
  103. }
  104. public function recruitform()
  105. {
  106. $id = input('id/d, 0');
  107. $recruit = OutRecruitModel::findOrEmpty($id);
  108. return view('outjob/recruitform', [
  109. 'recruit' => $recruit,
  110. ]);
  111. }
  112. public function market()
  113. {
  114. if (Request::isAjax()) {
  115. $limit = input('limit/d', 20);
  116. $page = input('page/d', 1);
  117. $list = AgentMarketModel::limit($limit)
  118. ->page($page)
  119. ->append(['is_bargain_text'])
  120. ->select();
  121. $count = AgentMarketModel::count();
  122. if ($count == 0) {
  123. exit(json_encode([
  124. 'code' => 1,
  125. 'msg' => "未查询到数据",
  126. ]));
  127. }
  128. exit(json_encode([
  129. 'code' => 0,
  130. 'msg' => "",
  131. 'count' => $count,
  132. 'data' => $list,
  133. ]));
  134. } else {
  135. return view('outjob/market');
  136. }
  137. }
  138. }