AdminAppointmentController.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 小夏 < 449134904@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\talent\controller;
  12. use app\admin\model\UserModel;
  13. use app\talent\model\TalentAppointmentLogModel;
  14. use app\talent\model\TalentAppointmentModel;
  15. use app\talent\model\TalentModel;
  16. use cmf\controller\AdminBaseController;
  17. class AdminAppointmentController extends AdminBaseController
  18. {
  19. public function index()
  20. {
  21. $param = $this->request->param();
  22. //搜索条件
  23. $where = [];
  24. if (!empty($param['name'])) {
  25. $where[] = ['cmf_talent_appointment.name', 'like', "%{$param['name']}%"];
  26. }
  27. if (!empty($param['mobile'])) {
  28. $where[] = ['cmf_talent_appointment.mobile', '=', $param['mobile']];
  29. }
  30. if (!empty($param['shift'])) {
  31. $where[] = ['shift', 'like', "%{$param['shift']}%"];
  32. }
  33. $list = TalentAppointmentModel::alias('ta')
  34. ->join('cmf_talent t', 'ta.talent_id = t.id')
  35. ->field(['ta.*','t.name','t.mobile'])
  36. ->where($where)
  37. ->append(['status_text'])
  38. ->paginate(10, false, ['query' => $param]);
  39. $this->assign('name', isset($param['name']) ? $param['name'] : '');
  40. $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : '');
  41. $this->assign('shift', isset($param['shift']) ? $param['shift'] : '');
  42. $this->assign('list', $list->items());
  43. $this->assign('page', $list->render());
  44. return $this->fetch();
  45. }
  46. public function edit()
  47. {
  48. $id = $this->request->param('id', 0, 'intval');
  49. $info = TalentModel::get($id);
  50. $this->assign('info', $info);
  51. return $this->fetch();
  52. }
  53. public function editPost()
  54. {
  55. if ($this->request->isPost()) {
  56. $data = $this->request->post();
  57. TalentModel::update($data, ['id' => $data['id']]);
  58. $this->success('编辑成功!', url('index'));
  59. }
  60. }
  61. public function log()
  62. {
  63. $param = $this->request->param();
  64. $list = TalentAppointmentLogModel::order('create_time desc')->paginate(10, false, ['query' => $param]);
  65. $this->assign('list', $list->items());
  66. $this->assign('page', $list->render());
  67. return $this->fetch();
  68. }
  69. }