| @@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.concurrent.TimeUnit; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/order/") | @RequestMapping("/api/order/") | ||||
| @@ -87,6 +88,13 @@ public class WxOrderController extends BaseController { | |||||
| if (hasKey) { | if (hasKey) { | ||||
| // 从缓存获取用户信息 | // 从缓存获取用户信息 | ||||
| wxCouponCVo = operations.get(key); | wxCouponCVo = operations.get(key); | ||||
| } else { | |||||
| // 游戏没有入缓存,需要从数据库中读取 | |||||
| wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId()); | |||||
| if (wxCouponCVo != null) { | |||||
| // 游戏优化,进缓存 | |||||
| cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); | |||||
| } | |||||
| } | } | ||||
| if (wxCouponCVo == null) { | if (wxCouponCVo == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||