| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
| | | return;
|
| | | }
|
| | | // 保存20分钟
|
| | | String key = "JD-goods-" + goods.getSkuId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.JDGoods, goods.getSkuId() + "" );
|
| | | redisManager.cacheCommonString(key, new Gson().toJson(goods), 60 * 20);
|
| | | }
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public JDGoods getGoodsInfo(long goodsId){
|
| | | String key = "JD-goods-" + goodsId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.JDGoods, goodsId + "");
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return JsonUtil.getSimpleGson().fromJson(value, JDGoods.class);
|