CommentModel::getCount PHP Méthode

getCount() public méthode

public getCount ( $Wheres = '' )
    public function getCount($Wheres = '')
    {
        if (is_numeric($Wheres)) {
            deprecated('CommentModel->getCount(int)', 'CommentModel->getCountByDiscussion()');
            return $this->getCountByDiscussion($Wheres);
        }
        return parent::getCount($Wheres);
    }

Usage Example

 public function _default()
 {
     $whereArr = array();
     $department_id = request('department_id');
     if ($department_id) {
         $whereArr[] = "`department_id`='{$department_id}'";
     } else {
         if ($this->userInfo['group']['permission']['type'] == 'surper') {
             $whereArr[] = '1';
         } else {
             $department_ids = array_keys($this->departmentList);
             if ($department_ids) {
                 $whereArr[] = "`department_id` in (" . implode(',', $department_ids) . ")";
             }
         }
     }
     $status = request('status');
     if ($status) {
         $whereArr[] = "`status`='{$status}'";
     }
     $where = $whereArr ? implode(' and ', $whereArr) : '0';
     $page = $this->page(CommentModel::getCount($where));
     $commentList = CommentModel::getList($where, $this->start, $this->perpage);
     $this->assign('page', $page);
     $this->assign('commentList', $commentList);
     $this->display();
 }