package com.tzld.piaoquan.api.controller.contentplatform;

import com.tzld.piaoquan.api.annotation.RequireSign;
import com.tzld.piaoquan.api.model.param.contentplatform.GzhDatastatListParam;
import com.tzld.piaoquan.api.model.param.contentplatform.QwDatastatListParam;
import com.tzld.piaoquan.api.model.vo.contentplatform.GzhDatastatItemVO;
import com.tzld.piaoquan.api.model.vo.contentplatform.QwDatastatItemVO;
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformDatastatService;
import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
import com.tzld.piaoquan.growth.common.utils.page.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/contentPlatform/datastat")
@CrossOrigin(origins = "*")
public class ContentPlatformDatastatController {

    @Autowired
    ContentPlatformDatastatService datastatService;

    @ApiOperation(value = "公众号数据统计")
    @PostMapping("/gzh")
    @RequireSign
    public CommonResponse<Page<GzhDatastatItemVO>> gzhDatastatList(@RequestBody GzhDatastatListParam param) {
        return CommonResponse.success(datastatService.gzhDatastatList(param));
    }

    @ApiOperation(value = "企微数据统计")
    @PostMapping("/qw")
    @RequireSign
    public CommonResponse<Page<QwDatastatItemVO>> qwDatastatList(@RequestBody QwDatastatListParam param) {
        return CommonResponse.success(datastatService.qwDatastatList(param));
    }

    @ApiOperation(value = "公众号数据统计导出")
    @PostMapping("/gzh/export")
    @RequireSign
    public CommonResponse<String> gzhDatastatExport(@RequestBody GzhDatastatListParam param) {
        return CommonResponse.success(datastatService.gzhDatastatExport(param));
    }

    @ApiOperation(value = "企微数据统计导出")
    @PostMapping("/qw/export")
    @RequireSign
    public CommonResponse<String> qwDatastatExport(@RequestBody QwDatastatListParam param) {
        return CommonResponse.success(datastatService.qwDatastatExport(param));
    }
}
