package org.jeecg.modules.ads.controller;

import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouStrategyListPageService;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/ai/list")
@RestController
public class AiKuaiShouStrategyListPageCtrl {

    @Autowired
    IAiKuaiShouStrategyListPageService aiKuaiShouStrategyListPageService;

    @PostMapping("/pageStrategy")
    public Result<PageInfo<JSONObject>> pageStrategy(@RequestBody JSONObject params){
        Result<PageInfo<JSONObject>> result=new Result<>();
        if(params.isEmpty()){
            result.error500("参数为空");
        }else {
            result.setSuccess(true);
            result.setResult(aiKuaiShouStrategyListPageService.pageStrategy(params));
        }
        return result;
    }

    @PostMapping("/pageCampaign")
    public Result<PageInfo<JSONObject>> pageCampaign(@RequestBody JSONObject params){
        Result<PageInfo<JSONObject>> result=new Result<>();
        if(params.isEmpty()){
            result.error500("参数为空");
        }else {
            result.setSuccess(true);
            result.setResult(aiKuaiShouStrategyListPageService.pageCampaign(params));
        }
        return result;
    }

    @PostMapping("/pageUnit")
    public Result<PageInfo<JSONObject>> pageUnit(@RequestBody JSONObject params){
        Result<PageInfo<JSONObject>> result=new Result<>();
        if(params.isEmpty()){
            result.error500("参数为空");
        }else {
            result.setSuccess(true);
            result.setResult(aiKuaiShouStrategyListPageService.pageUnit(params));
        }
        return result;
    }
}
