Browse Source

fix

release_toaliyun_real
winter 1 year ago
parent
commit
069179105c
4 changed files with 32 additions and 3 deletions
  1. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  2. +4
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  3. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumCacheKey.java
  4. +25
    -0
      mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java

+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java View File

@@ -231,6 +231,7 @@ public class WxCouponController extends BaseController {
CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId(),null);
CouponCacheUtils.removeOnlyCouponCache(redisTemplate, wxCoupon.getId());
CouponCacheUtils.removeOldDetailCache(redisTemplate);
CouponCacheUtils.removeOldDetailHtmlCache(redisTemplate);
return new ResultData();
}


+ 4
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java View File

@@ -624,7 +624,8 @@ public class WxCouponController extends BaseController {
boolean hasKey = cdRedisTemplate.hasKey(key);
if (hasKey) {
// 从缓存获取用户信息
WxCouponCVo wxCouponCVo = operations.get(key);
//WxCouponCVo wxCouponCVo = operations.get(key);
WxCouponCVo wxCouponCVo = CouponCacheUtils.getOldDetailHtmlCache(redisTemplate, couponChannelIdL, couponIdL);
return new ResultData(wxCouponCVo);
}
WxCouponCVo wxCouponCVo = null;
@@ -639,7 +640,8 @@ public class WxCouponController extends BaseController {
}

// 插入缓存
operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS);
//operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS);
CouponCacheUtils.setOldDetaileHtmlCache(redisTemplate, wxCouponCVo, couponChannelIdL, couponIdL);

return new ResultData(wxCouponCVo);
}


+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumCacheKey.java View File

@@ -17,7 +17,8 @@ public enum EnumCacheKey {
TOPIC_LIST(6, "topiList_"),
COUPON_CHANNEL_STOCK(7, "couponChannelStock:couponChannelStock_"),
DOUYIN_LIVE_PAGE_LIST(8,"douyinLiveList"),
OLD_DETAIL(9,"cc:")
OLD_DETAIL(9,"cc:"),
OLD_DETAIL_HTML(10,"ch:")
;
private static Map<Integer,EnumCacheKey> map = new HashMap<Integer,EnumCacheKey>();
static {


+ 25
- 0
mallinkService/src/main/java/com/iformall/service/util/CouponCacheUtils.java View File

@@ -157,4 +157,29 @@ public class CouponCacheUtils {
return RedisCacheUtils.getCacheObject(template, key,WxCouponCVo.class);
}
public static void removeOldDetailHtmlCache(RedisTemplate<String, Object> template) {
String key = EnumCacheKey.OLD_DETAIL_HTML.getMessage();
RedisCacheUtils.removeCachePrefix(template, key);
}
public static void setOldDetaileHtmlCache(RedisTemplate<String, Object> template,WxCouponCVo coupon,Long couponChannelIdL,Long couponIdL) {
String key = EnumCacheKey.OLD_DETAIL_HTML.getMessage();
if(couponChannelIdL > 0){
key = key + couponChannelIdL;
}else if(couponIdL > 0){
key = key + couponIdL;
}
RedisCacheUtils.cache(template, key, coupon, 3600);
}
public static WxCouponCVo getOldDetailHtmlCache(RedisTemplate<String, Object> template,Long couponChannelIdL,Long couponIdL) {
String key = EnumCacheKey.OLD_DETAIL_HTML.getMessage();
if(couponChannelIdL > 0){
key = key + couponChannelIdL;
}else if(couponIdL > 0){
key = key + couponIdL;
}
return RedisCacheUtils.getCacheObject(template, key,WxCouponCVo.class);
}
}

Loading…
Cancel
Save