From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期六, 18 一月 2020 12:06:27 +0800 Subject: [PATCH] 用户注册信息 --- fanli/src/main/java/com/yeshi/fanli/util/cache/TaoBaoGoodsCacheUtil.java | 63 ++++++++++++++++++++++++++++++- 1 files changed, 61 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/cache/TaoBaoGoodsCacheUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/cache/TaoBaoGoodsCacheUtil.java index 1206fc3..f2be083 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/cache/TaoBaoGoodsCacheUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/cache/TaoBaoGoodsCacheUtil.java @@ -6,6 +6,7 @@ import com.google.gson.Gson; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; +import com.yeshi.fanli.util.RedisKeyEnum; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; @@ -22,7 +23,7 @@ public void saveCommonTaoBaoGoodsInfo(TaoBaoGoodsBrief goods) { if (goods == null || goods.getAuctionId() == null) return; - String key = "taobao-goods-common-" + goods.getAuctionId(); + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsCommon, goods.getAuctionId() + ""); // 淇濆瓨20鍒嗛挓 redisManager.cacheCommonString(key, new Gson().toJson(goods), 60 * 20); } @@ -34,7 +35,7 @@ * @return */ public TaoBaoGoodsBrief getCommonTaoBaoGoodsInfo(long auctionId) { - String key = "taobao-goods-common-" + auctionId; + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsCommon, auctionId + ""); String value = redisManager.getCommonString(key); if (!StringUtil.isNullOrEmpty(value)) { return new Gson().fromJson(value, TaoBaoGoodsBrief.class); @@ -42,4 +43,62 @@ return null; } + /** + * 鏄惁鍙互娣诲姞鍒版洿鏂伴槦鍒椾腑 + * + * @param auctionId + * @return + */ + public boolean canAddToUpdateQueue(Long auctionId) { + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoQueue, auctionId + ""); + String value = redisManager.getCommonString(key); + if (StringUtil.isNullOrEmpty(value)) + return true; + else + return false; + } + + /** + * 澧炲姞娣诲姞鍒伴槦鍒椾腑鐨勮褰� + * + * @param auctionId + */ + public void addAddToQueueHistory(Long auctionId) { + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoQueue, auctionId + ""); + redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 鏈夋晥鏈�2涓皬鏃� + } + + /** + * 鏌ヨ鍟嗗搧鏄惁闇�瑕佹洿鏂� + * + * @param actionId + * @return + */ + public boolean needUpdate(Long actionId) { + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUpdate, actionId + ""); + String value = redisManager.getCommonString(key); + if (StringUtil.isNullOrEmpty(value)) + return true; + else + return false; + } + + /** + * 娣诲姞鏇存柊璁板綍鏁版嵁 + * + * @param actionId + * @return + */ + public void addUpdateHistory(Long actionId) { + String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUpdate, actionId + ""); + redisManager.cacheCommonString(key, "1", 60 * 60 * 1);// 鏈夋晥鏈�1涓皬鏃� + } + + /** + * 鍒犻櫎鏇存柊璁板綍 + */ + public void removeUpdateHistory() { + // TODO 鍑屾櫒鍒犻櫎缂撳瓨璁板綍 + } + } -- Gitblit v1.8.0