Emp.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\mobile\EmpBaseController;
  4. use app\common\model\WorkerLog as WorkerLogModel;
  5. use app\common\model\ResumeInvite as ResumeInviteModel;
  6. use app\common\model\Comjobs as ComjobsModel;
  7. use app\common\model\ComjobsLog as ComjobsLogModel;
  8. class Emp extends EmpBaseController
  9. {
  10. public function index()
  11. {
  12. $workerid = $this->worker->id;
  13. $countobj = [];
  14. $countobj['yesterday'] = WorkerLogModel::where('workerid', '=', $workerid)->whereDay('createtime', 'yesterday')->sum('ltotal');
  15. $countobj['today'] = WorkerLogModel::where('workerid', '=', $workerid)->whereDay('createtime')->sum('ltotal');
  16. $countobj['total'] = WorkerLogModel::where('workerid', '=', $workerid)->group('userid')->count();
  17. return view('emp/index', [
  18. 'worker' => $this->worker,
  19. 'countobj' => json_encode($countobj),
  20. ]);
  21. }
  22. /**
  23. * 个人信息
  24. */
  25. public function info()
  26. {
  27. return view('emp/info', [
  28. 'worker' => $this->worker->visible(['tilpic', 'title', 'realname', 'mobile', 'address', 'details']),
  29. ]);
  30. }
  31. public function infoPost()
  32. {
  33. $form = input('param.');
  34. foreach ($form as $k => $v) {
  35. $this->worker->$k = $v;
  36. }
  37. $this->worker->save();
  38. page_result(0, '操作成功');
  39. }
  40. /**
  41. * 我的邀请
  42. */
  43. public function invite()
  44. {
  45. return view('emp/invite', [
  46. 'status' => $this->request->get('status', 0),
  47. ]);
  48. }
  49. public function listInvite()
  50. {
  51. $page = input('page/d', 1);
  52. $size = input('size/d', 20);
  53. $status = input('status/d', 0);
  54. $map = [];
  55. $workerid = $this->worker->id;
  56. $map[] = ['workerid', '=', $workerid];
  57. if (!empty($status)) {
  58. $map[] = ['status', '=', $status];
  59. }
  60. $list = ResumeInviteModel::with(['user'])
  61. ->where($map)
  62. ->page($page)
  63. ->limit($size)
  64. ->append(['status_text'])
  65. ->select();
  66. page_result(0, "", $list);
  67. }
  68. /**
  69. * 岗位报名
  70. */
  71. public function apply()
  72. {
  73. $comjobs = ComjobsModel::field(['title as text', 'id as value'])->where('workerid', $this->worker->id)->where('status', '>', 2)->select()->toArray();
  74. array_unshift($comjobs, ['text' => '全部岗位', 'value' => 0]);
  75. return view('emp/apply', [
  76. 'comjobs' => json_encode($comjobs),
  77. 'status' => $this->request->get('status', 0),
  78. 'comjobsid' => $this->request->get('comjobsid', 0),
  79. ]);
  80. }
  81. public function listApply()
  82. {
  83. $page = input('page/d', 1);
  84. $size = input('size/d', 20);
  85. $map = [];
  86. $workerid = $this->worker->id;
  87. $map[] = ['workerid', '=', $workerid];
  88. $status = input('status/d', 0);
  89. if (!empty($status)) {
  90. $map[] = ['status', '=', $status];
  91. }
  92. $comjobsid = input('comjobsid/d', 0);
  93. if (!empty($comjobsid)) {
  94. $map[] = ['comjobsid', '=', $comjobsid];
  95. }
  96. $list = ComjobsLogModel::with(['comjobs', 'user'])
  97. ->where($map)
  98. ->page($page)
  99. ->limit($size)
  100. ->order(['createtime' => 'desc', 'id' => 'desc'])
  101. ->append(['status_text'])
  102. ->select();
  103. page_result(0, "", $list);
  104. }
  105. public function delApply()
  106. {
  107. $workerid = $this->worker->id;
  108. $logid = input('id/d', 0);
  109. $comjobslog = ComjobsLogModel::where(['workerid' => $workerid])->findOrEmpty($logid);
  110. if ($comjobslog->isEmpty()) {
  111. page_result(1, "报名记录信息不存在。");
  112. }
  113. $comjobslog->delete();
  114. page_result(0, "");
  115. }
  116. public function statusApply()
  117. {
  118. $logid = input('id/d', 0);
  119. $workerid = $this->worker->id;
  120. $comjobslog = ComjobsLogModel::where(['workerid' => $workerid])->findOrEmpty($logid);
  121. if ($comjobslog->isEmpty()) {
  122. page_result(1, "报名记录信息不存在。");
  123. }
  124. $status = input('status/d', 1);
  125. $comjobslog->save(['status' => $status]);
  126. page_result(0, "");
  127. }
  128. }