| | |
| | | }
|
| | | }
|
| | |
|
| | | public void increase(String key) {
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | jedis.incr(key);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | | }
|
| | |
|
| | | public void expire(String key,int seconds) {
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | jedis.expire(key, seconds);
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | | }
|
| | |
|
| | | public void cacheCommonString(String key, String value, int seconds) {
|
| | | setString(key, value, seconds);
|
| | | }
|
| | |
| | |
|
| | | public void removeCommonString(String key) {
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 将信息永久保存到Redis
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void saveTaoBaoGoodsBriefForever(TaoBaoGoodsBrief goods) {
|
| | | String key = "taobao-goods-" + goods.getAuctionId();
|
| | | if (Constant.IS_OUTNET) {
|
| | | cacheCommonString(key, JsonUtil.getSimpleGson().toJson(goods));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | | goods.setShopTitle(shopTitle);
|
| | | goods.setSellerId(sellerId);
|
| | | goods.setAuctionId(auctionId);
|
| | | TaoBaoShopInfo info = taoBaoShopService.getTaoBaoShopInfo(goods);
|
| | | |
| | | if(info != null) {
|
| | |
|
| | | if (info != null) {
|
| | | String shopUrl = info.getShopUrl();
|
| | | if(shopUrl != null && shopUrl.contains("tmall://page.tm/shop")) {
|
| | | if (shopUrl != null && shopUrl.contains("tmall://page.tm/shop")) {
|
| | | shopUrl = "http://store.taobao.com/shop/view_shop.htm?user_number_id=" + sellerId;
|
| | | info.setShopUrl(shopUrl);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (Constant.IS_OUTNET && info != null) {
|
| | | value = new Gson().toJson(info);
|
| | | cacheCommonString(key, value, 60 * 60 * 2);
|
| | | }
|
| | | |
| | |
|
| | | return info;
|
| | | } else {
|
| | | TaoBaoShopInfo info = new Gson().fromJson(value, TaoBaoShopInfo.class);
|
| | | |
| | |
|
| | | String shopUrl = info.getShopUrl();
|
| | | if(shopUrl != null && shopUrl.contains("tmall://page.tm/shop")) {
|
| | | if (shopUrl != null && shopUrl.contains("tmall://page.tm/shop")) {
|
| | | shopUrl = "http://store.taobao.com/shop/view_shop.htm?user_number_id=" + sellerId;
|
| | | info.setShopUrl(shopUrl);
|
| | | }
|
| | | |
| | |
|
| | | return info;
|
| | | }
|
| | | }
|