From adf749e8da2bfce006390b008f6b9e8606b62180 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期四, 28 八月 2025 17:02:30 +0800 Subject: [PATCH] update --- cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java index d1e0d3e..912a123 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java @@ -153,22 +153,23 @@ } vip.setCouponList(couponVipRespList); String ticketJson = vip.getTicketJson(); - JSONArray ticketJsonArray = JSONArray.parseArray(ticketJson); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - - for (Object o : ticketJsonArray) { - JSONObject ticketJsonObject = (JSONObject) o; - TicketVipResp ticketVipResp = new TicketVipResp(); - Integer count = ticketJsonObject.getInteger("count"); - ticketVipResp.setName(ticketJsonObject.getString("name")); - ticketVipResp.setTime(ticketJsonObject.getInteger("time")); - ticketVipResp.setCount(ticketJsonObject.getInteger("count")); - ticketVipResp.setStartTime(simpleDateFormat.format(new Date())); - Date date = new Date(); - // 给这个date加X天 - date.setTime(date.getTime() + ticketJsonObject.getInteger("time") * 24 * 60 * 60 * 1000); - ticketVipResp.setEffectiveTime(simpleDateFormat.format(date)); - ticketVipRespList.add(ticketVipResp); + if(ticketJson!=null){ + JSONArray ticketJsonArray = JSONArray.parseArray(ticketJson); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + for (Object o : ticketJsonArray) { + JSONObject ticketJsonObject = (JSONObject) o; + TicketVipResp ticketVipResp = new TicketVipResp(); + Integer count = ticketJsonObject.getInteger("count"); + ticketVipResp.setName(ticketJsonObject.getString("name")); + ticketVipResp.setTime(ticketJsonObject.getInteger("time")); + ticketVipResp.setCount(ticketJsonObject.getInteger("count")); + ticketVipResp.setStartTime(simpleDateFormat.format(new Date())); + Date date = new Date(); + // 给这个date加X天 + date.setTime(date.getTime() + ticketJsonObject.getInteger("time") * 24 * 60 * 60 * 1000); + ticketVipResp.setEffectiveTime(simpleDateFormat.format(date)); + ticketVipRespList.add(ticketVipResp); + } } vip.setTicketList(ticketVipRespList); } -- Gitblit v1.7.1