Browse Source

自动化任务优惠券 清除缓存

yuhongqi 1 week ago
parent
commit
2d68ffb38c

+ 1 - 1
fs-admin/src/main/java/com/fs/live/controller/LiveCouponIssueController.java

@@ -82,7 +82,7 @@ public class LiveCouponIssueController extends BaseController
     /**
      * 修改优惠券领取
      */
-    @PreAuthorize("@ss.hasPermi('live:issue:edit')")
+//    @PreAuthorize("@ss.hasPermi('live:issue:edit')")
     @Log(title = "优惠券领取", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody LiveCouponIssue liveCouponIssue)

+ 3 - 0
fs-live-socket/src/main/java/com/fs/live/websocket/service/WebSocketServer.java

@@ -585,6 +585,9 @@ public class WebSocketServer {
                 }
                 LiveCouponIssue liveCouponIssue = liveCouponIssueService.selectLiveCouponIssueById(liveCoupon.getIssueId());
                 LiveCouponIssueRelation relation = liveCouponMapper.selectCouponRelation(task.getLiveId(), liveCouponIssue.getId());
+                if (liveCoupon != null) {
+                    redisCache.setCacheObject(String.format(LiveKeysConstant.LIVE_COUPON_NUM , liveCouponIssue.getId()), liveCouponIssue.getRemainCount().intValue(), 30, TimeUnit.MINUTES);
+                }
                 HashMap<String, Object> data = new HashMap<>();
                 data.put("liveId", task.getLiveId());
                 data.put("couponIssueId", liveCouponIssue.getId());