params['type'] ?? 1; $where[] = ['SCA.shop_id','=',$this->shopId]; $where[] = ['SCA.type','=',$type]; $where[] = ['SCA.audit_status','=',ShopEnum::AUDIT_STATUS_WAIT]; return $where; } public function lists(): array { $lists = Coach::alias('C') ->join('shop_coach_apply SCA','C.id = SCA.coach_id') ->field('SCA.id,SCA.coach_id,SCA.type,C.name,C.good_comment,C.work_photo,C.order_num,C.skill_id') ->limit($this->limitOffset, $this->limitLength) ->where($this->setWhere()) ->select() ->toArray(); $skillIds = array_column($lists,'skill_id'); $skillLists = Skill::where(['id'=>$skillIds])->column('name','id'); foreach ($lists as $key => $coach){ $lists[$key]['good_comment'] = $coach['good_comment'].'%'; $lists[$key]['skill_name'] = $skillLists[$coach['skill_id']] ?? ''; } return $lists; } public function count(): int { return Coach::alias('C') ->join('shop_coach_apply SCA','C.id = SCA.coach_id') ->where($this->setWhere()) ->count(); } }