Comment.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\admin\controller\qingdong\report;
  3. use addons\qingdong\model\Staff;
  4. use app\common\controller\Backend;
  5. use addons\qingdong\model\Comment as CommentModel;
  6. use think\DB;
  7. /**
  8. * 工作报告评论
  9. */
  10. class Comment extends Backend {
  11. public function _initialize() {
  12. parent::_initialize();
  13. $this->model = new CommentModel();
  14. }
  15. /**
  16. * 工作报告评论
  17. */
  18. public function index() {
  19. $this->request->filter(['strip_tags']);
  20. if ($this->request->isAjax()) {
  21. $this->relationSearch = true;
  22. //0:全部 1:我负责的 2:下属负责的
  23. $type = input('type',0);
  24. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  25. switch($type){
  26. case 1:
  27. $staff = Staff::info();
  28. $wheres['staff_id'] = $staff->id;
  29. break;
  30. case 2:
  31. $wheres['staff_id'] = array('in',Staff::getLowerStaffId());
  32. break;
  33. default:
  34. $wheres['staff_id'] = array('in',Staff::getMyStaffIds());
  35. break;
  36. }
  37. $wheres['relation_type'] = 5;
  38. $list = $this->model->where($where)->where($wheres)->with(['staff','daily'])->order($sort, $order)->paginate($limit);
  39. $row = $list->items();
  40. $result = array("total" => $list->total(), "rows" => $row);
  41. return json($result);
  42. }
  43. return $this->view->fetch();
  44. }
  45. }