Comment.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\admin\controller\qingdong\leads;
  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. //0:全部 1:我负责的 2:下属负责的
  22. $type = input('type',0);
  23. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  24. switch($type){
  25. case 1:
  26. $staff = Staff::info();
  27. $wheres['staff_id'] = $staff->id;
  28. break;
  29. case 2:
  30. $wheres['staff_id'] = array('in',Staff::getLowerStaffId());
  31. break;
  32. default:
  33. $wheres['staff_id'] = array('in',Staff::getMyStaffIds());
  34. break;
  35. }
  36. $wheres['relation_type'] = 4;
  37. $list = $this->model->where($where)->where($wheres)->with(['staff','record'])->order($sort, $order)->paginate($limit);
  38. $row = $list->items();
  39. $result = array("total" => $list->total(), "rows" => $row);
  40. return json($result);
  41. }
  42. return $this->view->fetch();
  43. }
  44. }