| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\admin\controller\qingdong\contract;
- use addons\qingdong\model\Staff;
- use app\admin\controller\qingdong\Base;
- use addons\qingdong\model\Comment as CommentModel;
- use think\DB;
- /**
- * 评论列表
- * 操作文档:https://doc.fastadmin.net/qingdong
- * 软件介绍:https://www.fastadmin.net/store/qingdong.html
- * 售后微信:qingdong_crm
- */
- class Comment extends Base {
- public function _initialize() {
- parent::_initialize();
- $this->model = new CommentModel();
- }
- /**
- * 评论列表
- * @return string|\think\response\Json
- */
- public function index() {
- $this->request->filter(['strip_tags']);
- if ($this->request->isAjax()) {
- //0:全部 1:我负责的 2:下属负责的
- $type = input('type',0);
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- switch($type){
- case 1:
- $staff = Staff::info();
- $wheres['staff_id'] = $staff->id;
- break;
- case 2:
- $wheres['staff_id'] = array('in',Staff::getLowerStaffId());
- break;
- default:
- $wheres['staff_id'] = array('in',Staff::getMyStaffIds());
- break;
- }
- $wheres['relation_type'] = 3;
- $list = $this->model->where($where)->where($wheres)->with(['staff','record'])->order($sort, $order)->paginate($limit);
- $row = $list->items();
- $result = array("total" => $list->total(), "rows" => $row);
- return json($result);
- }
- return $this->view->fetch();
- }
- }
|