package com.tzld.piaoquan.recommend.server.client;

import org.springframework.stereotype.Component;

/**
 * @author dyp
 */
@Component
public class RecommendClient {
//    @GrpcClient("recommend-server")
//    private RecommendServiceGrpc.RecommendServiceBlockingStub client;
//
//    public List<VideoProto> homepageRecommend(RecommendRequest request) {
//
//        RecommendResponse response = client.homepageRecommend(request);
//        if (response == null
//                || !response.hasResult()) {
//            log.info("homepageRecommend grpc error");
//            return Collections.emptyList();
//        }
//        if (response.getResult().getCode() != 1) {
//            log.info("homepageRecommend grpc code={}, msg={}", response.getResult().getCode(),
//                    response.getResult().getMessage());
//            return Collections.emptyList();
//        }
//        return response.getVideoCount() > 0 ? response.getVideoList() : Collections.emptyList();
//    }
//
//    public List<VideoProto> relevantRecommend(RecommendRequest request) {
//        RecommendResponse response = client.relevantRecommend(request);
//        if (response == null
//                || !response.hasResult()) {
//            log.info("relevantRecommend grpc error");
//            return Collections.emptyList();
//        }
//        if (response.getResult().getCode() != 1) {
//            log.info("relevantRecommend grpc code={}, msg={}", response.getResult().getCode(),
//                    response.getResult().getMessage());
//            return Collections.emptyList();
//        }
//        return response.getVideoCount() > 0 ? response.getVideoList() : Collections.emptyList();
//    }
}
