From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java | 83 +++++++++++++++++++++-------------------- 1 files changed, 42 insertions(+), 41 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java b/fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java index eaf3e93..388a9f8 100644 --- a/fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java +++ b/fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java @@ -1,41 +1,42 @@ -package com.yeshi.fanli.manager.util; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Component; - -import com.yeshi.fanli.util.StringUtil; - -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.params.SetParams; - -@Component -public class AtomMethodCallManager { - - @Resource - private JedisPool jedisPool; - - /** - * 浜嬩欢鎵ц - * - * @param key - * 浜嬩欢鍞竴鏍囪瘑锛岃涓庡叿浣撶殑涓氬姟閫昏緫鐩哥粨鍚� - * @param call - */ - public void excute(String key, AtomMethodCallInterface call) { - String redisKey = "atom-" + StringUtil.Md5(key); - Jedis jedis = jedisPool.getResource(); - try { - if (StringUtil.isNullOrEmpty(jedis.set(redisKey, "1", new SetParams().nx().ex(60)))) { - System.out.println("璇风◢鍚庡啀璇�"); - return; - } - call.excute(); - } finally { - jedis.del(redisKey); - jedis.close(); - } - } - -} +package com.yeshi.fanli.manager.util; + +import javax.annotation.Resource; + +import com.yeshi.fanli.util.RedisManager; +import org.springframework.stereotype.Component; + +import com.yeshi.fanli.util.StringUtil; + +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.params.SetParams; + +@Component +public class AtomMethodCallManager { + + @Resource + private RedisManager redisManager; + + /** + * 浜嬩欢鎵ц + * + * @param key + * 浜嬩欢鍞竴鏍囪瘑锛岃涓庡叿浣撶殑涓氬姟閫昏緫鐩哥粨鍚� + * @param call + */ + public void excute(String key, AtomMethodCallInterface call) { + String redisKey = "atom-" + StringUtil.Md5(key); + Jedis jedis = redisManager.getJedis(); + try { + if (StringUtil.isNullOrEmpty(jedis.set(redisKey, "1", new SetParams().nx().ex(60)))) { + System.out.println("璇风◢鍚庡啀璇�"); + return; + } + call.excute(); + } finally { + jedis.del(redisKey); + jedis.close(); + } + } + +} -- Gitblit v1.8.0