Ver código fonte

修复debug版本h5服务器地址获取错误的bug

zengjiebin 7 anos atrás
pai
commit
65c8d94e44

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1116,7 +1116,7 @@ public class CommonUtil {
                         if (urlConfig != null) {
                             String url = urlConfig.getString(Config.KEY_SMALL_STATION_URL);
                             if (TextUtils.isEmpty(url))
-                                Config.SMALL_STATION_URL = TestUtil.isSheep() ? Config.SMALL_STATION_URL_SHEEP : Config.SMALL_STATION_URL_TEST;
+                                Config.initSMALL_STATION_URL();
                             else
                                 Config.SMALL_STATION_URL = url;
                         }

+ 7 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

@@ -72,8 +72,14 @@ public class Config {
     public static String SMALL_STATION_URL_SHEEP = "http://smallstation.kfzs.com";
     public static String SMALL_STATION_URL_TEST = "http://10.8.210.20:8080";
     //在数据库中表 config 中 配置 small_station_url后,可以进行设置 ,否则使用默认的值
-    public static String SMALL_STATION_URL = TextUtils.equals(SheepApp.getInstance().getConnectAddress().getName(), "sheep") ? SMALL_STATION_URL_SHEEP : SMALL_STATION_URL_TEST;
+    public static String SMALL_STATION_URL;
 
+    static {
+        initSMALL_STATION_URL();
+    }
+    public static void initSMALL_STATION_URL(){
+        SMALL_STATION_URL = TextUtils.equals(SheepApp.getInstance().getConnectAddress().getName(), "sheep") ? SMALL_STATION_URL_SHEEP : SMALL_STATION_URL_TEST;
+    }
     public static String getUrlByPath(String path, String...query){
         String url = SMALL_STATION_URL + path;
         if(query != null && query.length > 0){