2024-12-09 16:53:29 +08:00
|
|
|
package com.ai.da.controller;
|
|
|
|
|
|
|
|
|
|
|
2024-12-23 14:31:48 +08:00
|
|
|
import com.ai.da.common.response.PageBaseResponse;
|
2024-12-09 16:53:29 +08:00
|
|
|
import com.ai.da.common.response.Response;
|
|
|
|
|
import com.ai.da.model.dto.AffiliateQueryDTO;
|
2024-12-16 10:26:02 +08:00
|
|
|
import com.ai.da.model.vo.AffiliateInvitationDetailsVO;
|
2024-12-09 16:53:29 +08:00
|
|
|
import com.ai.da.model.vo.AffiliateVO;
|
|
|
|
|
import com.ai.da.service.AffiliateService;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
2024-12-16 10:26:02 +08:00
|
|
|
import io.swagger.annotations.Api;
|
2024-12-09 16:53:29 +08:00
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/api/affiliate")
|
2024-12-16 10:26:02 +08:00
|
|
|
@Api(tags = "Affiliate模块")
|
2024-12-09 16:53:29 +08:00
|
|
|
public class AffiliateController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AffiliateService affiliateService;
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "注册成为affiliate")
|
|
|
|
|
@GetMapping("/registration")
|
2024-12-18 11:53:41 +08:00
|
|
|
public Response<Boolean> completeGuidance(@RequestParam(value = "promotionMethod", required = false) String promotionMethod) {
|
2024-12-09 16:53:29 +08:00
|
|
|
return Response.success(affiliateService.registerAsAnAffiliate(promotionMethod));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取affiliate列表")
|
|
|
|
|
@PostMapping("/list")
|
2024-12-23 14:31:48 +08:00
|
|
|
public Response<PageBaseResponse<AffiliateVO>> getAffiliateList(@Valid @RequestBody AffiliateQueryDTO affiliateQueryDTO) {
|
2024-12-09 16:53:29 +08:00
|
|
|
return Response.success(affiliateService.getAffiliateList(affiliateQueryDTO));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取affiliate个人中心")
|
|
|
|
|
@GetMapping("/personalCenter")
|
|
|
|
|
public Response<AffiliateVO> personalAffiliateCenter() {
|
|
|
|
|
return Response.success(affiliateService.personalAffiliateCenter());
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-18 11:53:41 +08:00
|
|
|
@ApiOperation(value = "获取个人佣金图表数据")
|
|
|
|
|
@GetMapping("/getPersonalMonthlyIncome")
|
|
|
|
|
public Response<double[]> getPersonalMonthlyIncome(@RequestParam("year")int year) {
|
|
|
|
|
return Response.success(affiliateService.getPersonalMonthlyIncome(year));
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 16:53:29 +08:00
|
|
|
@ApiOperation(value = "审批affiliate申请")
|
|
|
|
|
@GetMapping("/approval")
|
|
|
|
|
public Response<Boolean> applicationApproval(@RequestParam("id") Long id, @RequestParam("isApproved")Boolean isApproved) {
|
|
|
|
|
return Response.success(affiliateService.applicationApproval(id, isApproved));
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-18 11:53:41 +08:00
|
|
|
/*@ApiOperation(value = "定时计算佣金")
|
2024-12-09 16:53:29 +08:00
|
|
|
@GetMapping("/testTask")
|
|
|
|
|
public Response<String> testTask() {
|
|
|
|
|
affiliateService.updateAffiliateInfoWithPayment();
|
|
|
|
|
return Response.success("success ");
|
2024-12-18 11:53:41 +08:00
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/*@ApiOperation(value = "每月发送结算邮件")
|
|
|
|
|
@GetMapping("/commissionCalculation")
|
2025-02-04 15:29:22 +08:00
|
|
|
public Response<String> commissionCalculation(@RequestParam("year") Integer year, @RequestParam("month") Integer month) {
|
|
|
|
|
affiliateService.commissionCalculation(year, month);
|
2024-12-18 11:53:41 +08:00
|
|
|
return Response.success("success ");
|
|
|
|
|
}*/
|
2024-12-09 16:53:29 +08:00
|
|
|
|
|
|
|
|
@ApiOperation(value = "affiliate链接浏览量增加")
|
|
|
|
|
@GetMapping("/viewsIncrease")
|
|
|
|
|
public Response<Boolean> viewsGet(@RequestParam("id") Long id) {
|
|
|
|
|
return Response.success(affiliateService.affiliateLinkViewsIncrease(id));
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-16 10:26:02 +08:00
|
|
|
@ApiOperation(value = "获取每个affiliate产生的收入")
|
2024-12-18 11:53:41 +08:00
|
|
|
@PostMapping("/getEachAffiliateGeneratedRevenue")
|
|
|
|
|
public Response<IPage<AffiliateInvitationDetailsVO>> getEachAffiliateGeneratedRevenue(@RequestBody AffiliateQueryDTO affiliateQueryDTO) {
|
|
|
|
|
return Response.success(affiliateService.getEachAffiliateGeneratedRevenue(affiliateQueryDTO));
|
2024-12-16 10:26:02 +08:00
|
|
|
}
|
|
|
|
|
|
2024-12-09 16:53:29 +08:00
|
|
|
|
|
|
|
|
}
|