params['goods_id'] ?? 0]; if (!isset($this->params['id']) || $this->params['id'] == '') { return $where; } switch ($this->params['id']){ case 1://有图 $where[]= ['gci.uri','not null','']; break; case 2://好评 $where[]= ['gc.service_comment','>',3]; break; case 3://中差评 $where[]= ['gc.service_comment','<=',3]; break; default: break; } return $where; } /** * @notes 服务评价列表 * @return array * @author ljj * @date 2022/2/18 11:18 上午 */ public function lists(): array { $lists = GoodsComment::alias('gc') ->leftjoin('goods_comment_image gci', 'gc.id = gci.comment_id') ->with(['goods_comment_image','user']) ->field('gc.id,gc.goods_id,gc.user_id,gc.service_comment,gc.comment,gc.reply,gc.create_time') ->append(['comment_level']) ->where($this->setSearch()) ->limit($this->limitOffset, $this->limitLength) ->order('gc.id','desc') ->group('gc.id') ->select() ->toArray(); return $lists; } /** * @notes 服务评价总数 * @return int * @author ljj * @date 2022/2/18 11:23 上午 */ public function count(): int { return GoodsComment::alias('gc') ->leftjoin('goods_comment_image gci', 'gc.id = gci.comment_id') ->field('gc.id,gc.goods_id,gc.user_id,gc.service_comment,gc.comment,gc.reply') ->where($this->setSearch()) ->count(); } }