| | |
| | | }
|
| | | }
|
| | |
|
| | | public boolean frequencyLimit(String key, int timeS, int num) {
|
| | | key = "frequency-" + key;
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | long count = jedis.incr(key);
|
| | | if (count == 1)
|
| | | jedis.expire(key, timeS);
|
| | | if (count >= num)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取淘宝图片
|
| | | *
|
| | |
| | | return JsonUtil.jsonToList(value, clazz);
|
| | | }
|
| | |
|
| | | |
| | | public JDGoods getJDGoods(long goodsId) {
|
| | | String key = "jingdong-goods-" + goodsId;
|
| | |
|
| | |
| | | return JsonUtil.getSimpleGson().fromJson(value, JDGoods.class);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | public PDDGoodsDetail getPDDGoodsDetail(long goodsId) {
|
| | | String key = "pinduoduo-goods-" + goodsId;
|