| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取商品秒杀活动 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getSeckillActivityInfoById") |
| | | public R<SeckillActivityInfo> getSeckillActivityInfoById(@RequestParam("id") Integer id){ |
| | | SeckillActivityInfo one = seckillActivityInfoService.getById(id); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/manageList") |
| | |
| | | Goods goods) |
| | | { |
| | | IPage<SeckillActivityVO> IPage = seckillActivityInfoMapper.querySeckillActivity(Page.of(pageNum, pageSize), goods); |
| | | for (SeckillActivityVO record : IPage.getRecords()) { |
| | | LocalDateTime startTime = record.getStartTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime endTime = record.getEndTime(); |
| | | if (endTime.isBefore(now)){ |
| | | record.setStatus(3); //已结束 |
| | | }else if (startTime.isBefore(now)){ |
| | | record.setStatus(2); // 已开始 |
| | | }else { |
| | | record.setStatus(1); // 未开始 |
| | | } |
| | | } |
| | | return R.ok(IPage); |
| | | } |
| | | |