package com.liquidnet.service.kylin.controller;


import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.entity.KylinRecommendActive;
import com.liquidnet.service.kylin.service.impl.KylinRecommendActiveServiceImpl;
import com.liquidnet.service.kylin.utils.DataUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *   推荐活动
 * </p>
 *
 */

@Api(tags = "推荐活动有关接口")
@RestController
@RequestMapping("recommendActive")
@Slf4j
public class KylinRecommendActiveController {
    @Autowired
    private KylinRecommendActiveServiceImpl kylinRecommendActiveService;
    @Autowired
    private DataUtils dataUtils;

    @PostMapping("getRecommendById")
    @ApiOperation("获取推荐活动详情")
    public ResponseDto<List<KylinRecommendActive>> getRecommendById(@RequestParam(value = "bindId")String bindId) {
        String uid = CurrentUtil.getCurrentUid();
        List<KylinRecommendActive> list= dataUtils.getRecommendActive(bindId);
        if(null==list){
            return null;
        }else{
            //循环遍历，查到绑定的详情
            kylinRecommendActiveService.getRecommendById(list);
        }
        return null;
    }


}
