chenbiao %!s(int64=3) %!d(string=hai) anos
pai
achega
edde5c6f63

+ 12 - 7
netflix-service/src/main/java/com/cyksj/service/register/impl/SpotifyServiceImpl.java

@@ -148,16 +148,18 @@ public class SpotifyServiceImpl implements SpotifyService {
                     JSONObject resObj = JSONUtil.parseObj(result);
                     if (200 == resObj.getInt("errno")) {
                         JSONObject data = resObj.getJSONObject("data");
-                        ProxyInfo proxy = new ProxyInfo();
-                        proxy.setPort(data.getInt("port"));
-                        proxy.setIp(data.getStr("ip"));
-                        log.info("----------付费IP地址----------\n ip:{}",proxy);
-                        proxyInfos.add(proxy);
-                        redisService.set(RedisKey.DOVEIP,proxy,data.getLong("timeout"));
+                        proxyInfo = new ProxyInfo();
+                        proxyInfo.setPort(data.getInt("port"));
+                        proxyInfo.setIp(data.getStr("ip"));
+                        log.info("----------付费IP地址----------\n ip:{}",proxyInfo);
+                        proxyInfos.add(proxyInfo);
+                        redisService.set(RedisKey.DOVEIP,proxyInfo,data.getLong("timeout"));
                     }else {
                         log.error("----------获取 付费IP 错误 停止循环----------");
                         break;
                     }
+                }else {
+                    proxyInfos.add(proxyInfo);
                 }
             }
 
@@ -186,7 +188,10 @@ public class SpotifyServiceImpl implements SpotifyService {
                         if (StringUtils.isNotBlank(errorMsg) || "你似乎正在使用代理服务。请关闭此类服务,然后再试一次。如需更多帮助,请联系客户服务。".equals(errorMsg) || errorMsg.contains("代理")) {
                             log.info("spotify 注册 被监测出代理服务 。 删除该代理 ip:{}", proxyInfo.getIp());
                             if (proxyInfo.getId() != null) {
-                                proxysMapper.deleteById(proxyInfo.getId());
+                                int count = proxysMapper.deleteById(proxyInfo.getId());
+                                if(count == 0){
+                                    redisService.del(RedisKey.DOVEIP);
+                                }
                             }
                             continue;
                         }