| | |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页"}) |
| | | public R<TableDataInfo> list(Goods goods) |
| | | { |
| | | return R.ok(seckillActivityInfoService.listSeckillActivity(goods)); |
| | |
| | | return R.ok(goodsSeckill); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // 创建 LocalDateTime 对象 |
| | | LocalDateTime localDateTime = LocalDateTime.of(2025, 1, 16, 9, 34, 55); |
| | | |
| | | // 转换为 UTC 时间戳(毫秒) |
| | | long l = localDateTime.toEpochSecond(ZoneOffset.UTC) * 1000; |
| | | System.out.println("UTC 时间戳: " + l); |
| | | |
| | | // 转换为 UTC+8 时间戳(毫秒) |
| | | long l2 = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); |
| | | System.out.println("UTC+8 时间戳: " + l2); |
| | | |
| | | // 将时间戳转换为 yyyy-MM-dd HH:mm:ss 格式的字符串 |
| | | String utcTime = formatTimestamp(l, ZoneOffset.UTC); |
| | | String utcPlus8Time = formatTimestamp(l2, ZoneOffset.of("+8")); |
| | | |
| | | System.out.println("UTC 时间: " + utcTime); |
| | | System.out.println("UTC+8 时间: " + utcPlus8Time); |
| | | } |
| | | |
| | | /** |
| | | * 将时间戳转换为指定时区的 yyyy-MM-dd HH:mm:ss 格式字符串 |
| | | * |
| | | * @param timestamp 时间戳(毫秒) |
| | | * @param zoneOffset 时区偏移量 |
| | | * @return 格式化后的时间字符串 |
| | | */ |
| | | private static String formatTimestamp(long timestamp, ZoneOffset zoneOffset) { |
| | | return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, zoneOffset) |
| | | .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/manageList") |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"后台管理-活动管理-秒杀活动"}) |
| | | public R<IPage<SeckillActivityVO>> manageList(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | Goods goods) |
| | |
| | | }else { |
| | | record.setStatus(1); // 未开始 |
| | | } |
| | | Integer saleNum = orderClient.getGoodsSaleNum(record.getGoodsId(), null).getData(); |
| | | Integer saleNum = orderClient.getGoodsSaleNum(record.getGoodsId(), 2).getData(); |
| | | record.setSaleNum(saleNum); |
| | | } |
| | | return R.ok(IPage); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getSeckillActivityInfoByGoodsId") |
| | | public R<SeckillActivityInfo> getSeckillActivityInfoByGoodsId(@RequestParam("goodsId") Integer goodsId){ |
| | | SeckillActivityInfo seckillActivityInfo = seckillActivityInfoService.getOne(new LambdaQueryWrapper<SeckillActivityInfo>() |
| | | .eq(SeckillActivityInfo::getGoodId, goodsId) |
| | | .eq(SeckillActivityInfo::getDelFlag, 0) |
| | | .eq(SeckillActivityInfo::getIsShelves, 1) |
| | | .last(" and now() between start_time and end_time")); |
| | | return R.ok(seckillActivityInfo); |
| | | } |
| | | |
| | | /** |
| | | * 修改秒杀活动 |
| | | */ |