Comment.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\admin\controller\qingdong\contract;
  3. use addons\qingdong\model\Staff;
  4. use app\admin\controller\qingdong\Base;
  5. use addons\qingdong\model\Comment as CommentModel;
  6. use think\DB;
  7. /**
  8. * 评论列表
  9. * 操作文档:https://doc.fastadmin.net/qingdong
  10. * 软件介绍:https://www.fastadmin.net/store/qingdong.html
  11. * 售后微信:qingdong_crm
  12. */
  13. class Comment extends Base {
  14. public function _initialize() {
  15. parent::_initialize();
  16. $this->model = new CommentModel();
  17. }
  18. /**
  19. * 评论列表
  20. * @return string|\think\response\Json
  21. */
  22. public function index() {
  23. $this->request->filter(['strip_tags']);
  24. if ($this->request->isAjax()) {
  25. //0:全部 1:我负责的 2:下属负责的
  26. $type = input('type',0);
  27. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  28. switch($type){
  29. case 1:
  30. $staff = Staff::info();
  31. $wheres['staff_id'] = $staff->id;
  32. break;
  33. case 2:
  34. $wheres['staff_id'] = array('in',Staff::getLowerStaffId());
  35. break;
  36. default:
  37. $wheres['staff_id'] = array('in',Staff::getMyStaffIds());
  38. break;
  39. }
  40. $wheres['relation_type'] = 3;
  41. $list = $this->model->where($where)->where($wheres)->with(['staff','record'])->order($sort, $order)->paginate($limit);
  42. $row = $list->items();
  43. $result = array("total" => $list->total(), "rows" => $row);
  44. return json($result);
  45. }
  46. return $this->view->fetch();
  47. }
  48. }