request->param(); if (isset($param['check_status']) && $param['check_status'] == 0) { return [ '=' =>['type'] ]; } else { return [ '=' =>['type', 'check_status'] ]; } } public function queryWhere() { $where = []; // if (isset($param['type']) && $param['type'] == 2) { $adminId = User::where(['id' => $this->userId])->with('company')->value('admin_id'); $where[] = ['check_admin_ids', '=', $adminId]; // 只有片区经理才能查看 // } return $where; } public function lists(): array { return Approve::where($this->searchWhere) ->where($this->queryWhere()) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->withAttr('extend',function ($value, $data) { return json_decode($data['extend'], true); }) ->select() ->toArray(); } public function count(): int { return Approve::where($this->searchWhere)->count(); } }