Blame view

application/admin/controller/antis/report/Comment.php 1.53 KB
2db47680   hexiaodong   chore: 初始提交 php 遗...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  <?php
  
  namespace app\admin\controller\antis\report;
  use addons\antis\model\Staff;
  use app\common\controller\Backend;
  use addons\antis\model\Comment as CommentModel;
  use think\DB;
  
  
  /**
   * 工作报告评论
   */
  class Comment extends Backend {
      public function _initialize() {
          parent::_initialize();
          $this->model = new CommentModel();
      }
  
  
      /**
       * 工作报告评论
       */
      public function index() {
          $this->request->filter(['strip_tags']);
          if ($this->request->isAjax()) {
              $this->relationSearch = true;
              //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'] = 5;
              $list   = $this->model->where($where)->where($wheres)->with(['staff','daily'])->order($sort, $order)->paginate($limit);
              $row    = $list->items();
              $result = array("total" => $list->total(), "rows" => $row);
  
              return json($result);
          }
  
          return $this->view->fetch();
      }
  
  }