| | |
| | | public void saveTaoBaoGoodsBriefTemp(TaoBaoGoodsBrief goods) {
|
| | | if (goods == null)
|
| | | return;
|
| | | String key = "taobao-goods-temp-" + goods.getAuctionId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsTemp, goods.getAuctionId() + "");
|
| | | if (Constant.IS_OUTNET) {
|
| | | // 暂存4个小时的分享
|
| | | cacheCommonString(key, JsonUtil.getSimpleGson().toJson(goods), 60 * 60 * 4);
|
| | |
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoGoodsTemp(Long auctionId) {
|
| | | String key = "taobao-goods-temp-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsTemp, auctionId + "");
|
| | | String value = getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return JsonUtil.getSimpleGson().fromJson(value, TaoBaoGoodsBrief.class);
|
| | |
| | | * @param auctionId
|
| | | */
|
| | | public void deleteTaoBaoGoodsBrief(Long auctionId) {
|
| | | String key = "taobao-goods-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoods, auctionId + "");
|
| | | if (Constant.IS_OUTNET)
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoGoodsBrief(long auctionId) throws TaobaoGoodsDownException {
|
| | | long startTime = System.currentTimeMillis();
|
| | | String key = "taobao-goods-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoods, auctionId + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | }
|
| | |
|
| | | public List<ImageInfo> getTaoBaoGoodsDetailImgs(long auctionId) {
|
| | | String key = "taobao-goods-detailimgs-size-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsDetailimgs, auctionId + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | |
|
| | | public String getXCXCouponToken(TaoBaoGoodsBrief tb) {
|
| | | List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
|
| | | String key = "taobao-couple-xcx-" + tb.getAuctionId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoCoupleXCX, tb.getAuctionId() + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | * @param ip
|
| | | */
|
| | | public boolean ipFrequencyLimit(String ip, String apiName) {
|
| | | String key = ip + "-" + StringUtil.Md5(apiName);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, ip + "-" + StringUtil.Md5(apiName));
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | long count = jedis.incr(key);
|
| | |
| | | }
|
| | |
|
| | | public boolean frequencyLimit(String key, int timeS, int num) {
|
| | | key = "frequency-" + key;
|
| | | key = RedisKeyEnum.getRedisKey(RedisKeyEnum.frequencyLimit, key);
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | long count = jedis.incr(key);
|
| | |
| | | * @return
|
| | | */
|
| | | public List<String> getTBImg(Long auctionId) {
|
| | | String key = "taobao-img-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoImgs, auctionId + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | * @return
|
| | | */
|
| | | public TaoBaoShopInfo getTBShopInfo(String shopTitle, Long sellerId, Long auctionId) {
|
| | | String key = "taobao-shop-" + sellerId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoShop, sellerId +"");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | public boolean isSmsFrequencyLimit(String phone, int type) {
|
| | | if (!Constant.IS_OUTNET)
|
| | | return false;
|
| | | String key = "sms-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMS, phone + "-" + type);
|
| | | String value = getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return false;
|
| | |
| | | public void sendSms(String phone, int type) {
|
| | | if (!Constant.IS_OUTNET)
|
| | | return;
|
| | | String key = "sms-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMS, phone + "-" + type);
|
| | | setString(key, "1", 10);
|
| | | }
|
| | |
|
| | | public void clearSMSFrequencyLimit(String phone, int type) {
|
| | | if (!Constant.IS_OUTNET)
|
| | | return;
|
| | | String key = "sms-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMS, phone + "-" + type);
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | |
| | | */
|
| | |
|
| | | public void saveSMSVCode(String phone, int type, String code) {
|
| | | String key = "smscode-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + type);
|
| | | // 保存2分钟
|
| | | setString(key, code, 120);
|
| | | }
|
| | |
| | | public String getSMSVCode(String phone, int type) {
|
| | | // if (!Constant.IS_OUTNET)
|
| | | // return "";
|
| | | String key = "smscode-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + type);
|
| | | // 保存2分钟
|
| | | return getString(key);
|
| | | }
|
| | |
| | | public void clearSMSVCode(String phone, int type) {
|
| | | // if (!Constant.IS_OUTNET)
|
| | | // return;
|
| | | String key = "smscode-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + type);
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | |
| | | * 保存绑定支付宝短信验证码的正确性
|
| | | */
|
| | | public void saveBindAlipayAccountSMSState(String phone) {
|
| | | String key = "smsstate-alipay-" + phone;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSStateAlipay, phone + "" );
|
| | | // 验证后十分钟有效
|
| | | setString(key, "1", 10 * 60);
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public boolean isBindAlipayAccountSMSStateValid(String phone) {
|
| | | String key = "smsstate-alipay-" + phone;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSStateAlipay, phone + "" );
|
| | | return !StringUtil.isNullOrEmpty(getString(key));
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | public void setInviteShortLink(long uid, String shortlink) {
|
| | | String value = "";
|
| | | String key = "invite-shortlink-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.inviteShortLink, uid + "" );
|
| | | if (Constant.IS_OUTNET) {
|
| | |
|
| | | value = getCommonString(key);
|
| | |
| | | * @return
|
| | | */
|
| | | public String getInviteShortLink(long uid) {
|
| | |
|
| | | String value = "";
|
| | | String key = "invite-shortlink-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.inviteShortLink, uid + "" );
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
|
| | |
| | | * @param token
|
| | | */
|
| | | public void saveCommonTaoToken(Long auctionId, String token) {
|
| | | String key = "taobao-common-token-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenCommon, auctionId + "" );
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 口令缓存10天
|
| | |
| | | * @return
|
| | | */
|
| | | public String getCommonTaoToken(Long auctionId) {
|
| | | String key = "taobao-common-token-" + auctionId;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenCommon, auctionId + "" );
|
| | | if (Constant.IS_OUTNET) {
|
| | | return getCommonString(key);
|
| | | }
|
| | |
| | | * @param token
|
| | | */
|
| | | public void saveTLJToken(String url, String token) {
|
| | | String key = "taobao-tlj-token-" + StringUtil.Md5(url);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenTLJ, StringUtil.Md5(url));
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 口令缓存10天
|
| | |
| | | * @return
|
| | | */
|
| | | public String getTLJToken(String url) {
|
| | | String key = "taobao-common-token-" + StringUtil.Md5(url);
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenTLJ, StringUtil.Md5(url));
|
| | | if (Constant.IS_OUTNET) {
|
| | | return getCommonString(key);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public JDGoods getJDGoods(long goodsId) {
|
| | | String key = "jingdong-goods-" + goodsId;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.jingDongGoods, goodsId +"");
|
| | | String value = getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(goodsId);
|
| | |
| | | }
|
| | |
|
| | | public PDDGoodsDetail getPDDGoodsDetail(long goodsId) {
|
| | | String key = "pinduoduo-goods-" + goodsId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.pinDuoDuoGoods, goodsId +"");
|
| | |
|
| | | String value = getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|