mall + promotion:增加拼团的 mock 返回

This commit is contained in:
YunaiV 2023-06-19 23:35:28 +08:00
parent 8a7f7fd641
commit bf7f68a04b
2 changed files with 50 additions and 0 deletions

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain; package cn.iocoder.yudao.module.promotion.controller.app.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO; import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -10,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -21,6 +25,38 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated @Validated
public class AppBargainActivityController { public class AppBargainActivityController {
@GetMapping("/page")
@Operation(summary = "获得砍价活动活动") // TODO 芋艿只查询进行中且在时间范围内的
// TODO 芋艿缺少 swagger 注解
public CommonResult<PageResult<AppBargainActivityRespVO>> getBargainActivityPage(PageParam pageReqVO) {
List<AppBargainActivityRespVO> activityList = new ArrayList<>();
AppBargainActivityRespVO activity1 = new AppBargainActivityRespVO();
activity1.setId(1L);
activity1.setName("618 大砍价");
activity1.setSpuId(2048L);
activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
activity1.setMarketPrice(50);
activity1.setBargainPrice(100);
activity1.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2)));
activity1.setEndTime(LocalDateTimeUtils.addTime(Duration.ofDays(1)));
activity1.setStock(10);
activityList.add(activity1);
AppBargainActivityRespVO activity2 = new AppBargainActivityRespVO();
activity2.setId(2L);
activity2.setName("双十一砍价");
activity2.setSpuId(4096L);
activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132");
activity2.setMarketPrice(100);
activity2.setBargainPrice(200);
activity2.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2)));
activity2.setEndTime(LocalDateTimeUtils.addTime(Duration.ofDays(1)));
activity2.setStock(0);
activityList.add(activity2);
return success(new PageResult<>(activityList, 10L));
}
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得砍价活动列表", description = "用于小程序首页") @Operation(summary = "获得砍价活动列表", description = "用于小程序首页")
// TODO 芋艿增加 Spring Cache // TODO 芋艿增加 Spring Cache

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 App - 砍价活动 Response VO") @Schema(description = "用户 App - 砍价活动 Response VO")
@Data @Data
public class AppBargainActivityRespVO { public class AppBargainActivityRespVO {
@ -13,9 +15,21 @@ public class AppBargainActivityRespVO {
@Schema(description = "砍价活动名称", required = true, example = "618 大砍价") @Schema(description = "砍价活动名称", required = true, example = "618 大砍价")
private String name; private String name;
@Schema(description = "活动开始时间", required = true)
private LocalDateTime startTime;
@Schema(description = "活动结束时间", required = true)
private LocalDateTime endTime;
@Schema(description = "商品 SPU 编号", required = true, example = "2048") @Schema(description = "商品 SPU 编号", required = true, example = "2048")
private Long spuId; private Long spuId;
@Schema(description = "商品 SKU 编号", required = true, example = "1024")
private Long skuId;
@Schema(description = "砍价库存", required = true, example = "512")
private Integer stock;
@Schema(description = "商品图片", required = true, example = "4096") // SPU picUrl 读取 @Schema(description = "商品图片", required = true, example = "4096") // SPU picUrl 读取
private String picUrl; private String picUrl;