userId]; return $where; } public function lists():array { $msgType = $this->params['msg_type']; $where = []; $this->count = 0; $lists = []; switch ($msgType){ case 1: $where[] = ['master_worker_id', '=', $this->userId]; $where[] = ['show_type', '=', YesNoEnum::NO] ; if(ServiceWorkLog::where($where)->count() === 0){ array_pop($where); } $lists = ServiceWorkLog::where($where) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); $this->count = ServiceWorkLog::where($where)->count(); break; case 3: $where[] = ['worker_id', '=', $this->userId]; $where[] = ['show_type', '=', YesNoEnum::NO]; if(MasterWorkerAccountLog::where($where)->count() === 0){ array_pop($where); } $lists = MasterWorkerAccountLog::where($where) ->append(['action_text']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); $this->count = MasterWorkerAccountLog::where($where)->count(); break; case 4: $where[] = ['is_show', '=', YesNoEnum::YES]; Article::where($where)->count(); $lists = Article::where($where) ->field('id,cid,title,desc,image,click_virtual,click_actual,create_time') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); break; } return $lists; } public function count(): int { return $this->count; } }