From e5ae856a8b6c4ea73ac9c291c5fc47dfc4503890 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Fri, 25 Dec 2020 18:44:54 +0800 Subject: [PATCH 01/28] bug fix --- app/functions/httpdns.gradle | 28 ++++--------------- .../com/mogo/httpdns/mogo/MogoHttpDns.java | 1 + 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/app/functions/httpdns.gradle b/app/functions/httpdns.gradle index 176938bc92..9edbf9b3f7 100644 --- a/app/functions/httpdns.gradle +++ b/app/functions/httpdns.gradle @@ -2,28 +2,12 @@ project.dependencies { if (Boolean.valueOf(RELEASE)) { - bydautoImplementation rootProject.ext.dependencies.httpdnsnoop - d82xImplementation rootProject.ext.dependencies.httpdnsnoop - em1Implementation rootProject.ext.dependencies.httpdnsnoop - d8xxImplementation rootProject.ext.dependencies.httpdnsnoop - d80xImplementation rootProject.ext.dependencies.httpdnsnoop - em4Implementation rootProject.ext.dependencies.httpdnsnoop - e8xxImplementation rootProject.ext.dependencies.httpdnstencent - f8xxImplementation rootProject.ext.dependencies.httpdnstencent - f80xImplementation rootProject.ext.dependencies.httpdnstencent - f8AmapImplementation rootProject.ext.dependencies.httpdnstencent - em3Implementation rootProject.ext.dependencies.httpdnsnoop + qaImplementation rootProject.ext.dependencies.httpdnsnoop + demoImplementation rootProject.ext.dependencies.httpdnsnoop + onlineImplementation rootProject.ext.dependencies.httpdnsmogo } else { - bydautoImplementation project(':foudations:httpdns-noop') - d82xImplementation project(':foudations:httpdns-noop') - em1Implementation project(':foudations:httpdns-noop') - d8xxImplementation project(':foudations:httpdns-noop') - d80xImplementation project(':foudations:httpdns-noop') - em4Implementation project(':foudations:httpdns-noop') - e8xxImplementation project(':foudations:httpdns-tencent') - f8xxImplementation project(':foudations:httpdns-tencent') - f80xImplementation project(':foudations:httpdns-tencent') - f8AmapImplementation project(':foudations:httpdns-tencent') - em3Implementation project(':foudations:httpdns-noop') + qaImplementation project(':foudations:httpdns-noop') + demoImplementation project(':foudations:httpdns-noop') + onlineImplementation project(':foudations:httpdns-mogo') } } \ No newline at end of file diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index e7b7ab75d9..2753a2527d 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -107,6 +107,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe if (map != null) { for (String key : map.keySet()) { IHttpDnsTtlCallback callback = ttlCallbackMap.get(key); + Logger.d("MogoHttpDns", "onAddressChanged key: " + key); if (callback != null) { callback.onTtl(); }else{ From 51b41630005edb00a225fdacc9bb4a7bb709fa55 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Mon, 28 Dec 2020 11:07:35 +0800 Subject: [PATCH 02/28] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- foudations/httpdns-mogo/build.gradle | 2 +- .../src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index af8c7c97be..6f3d9a6bf8 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.6' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.7' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 2753a2527d..47aa3a4410 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -1,12 +1,14 @@ package com.mogo.httpdns.mogo; import android.content.Context; +import android.os.Debug; import android.text.TextUtils; import android.util.ArrayMap; import androidx.annotation.Nullable; import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.Utils; import com.mogo.httpdns.HttpDnsConst; import com.mogo.httpdns.IHttpDnsCallback; @@ -74,7 +76,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void init(final Context context) { - httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { + httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { @org.jetbrains.annotations.Nullable @Override public HttpDnsSimpleLocation getCurrentLocation() { From 539d5a78c2bf2b2032b0a97cc3e9b49d0ddfcd3a Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Mon, 28 Dec 2020 16:58:13 +0800 Subject: [PATCH 03/28] opt Block Strategy ave speed --- .../com/mogo/module/share/strategyreceiver/BlockStrategy.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt index 6bb1360d4f..75936e070a 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt @@ -138,7 +138,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService } val ave = sum / speedCacheList.size Logger.d(TAG, "平均速度为: $ave") - blockFromSpeed = true + blockFromSpeed = ave <= 10 // 上报平均速度 val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation latLonFromSpeed = MogoLatLng(location.latitude, location.longitude) From ed309f942b9679968baf00a014364b0e877492da Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 29 Dec 2020 11:19:33 +0800 Subject: [PATCH 04/28] opt http dns --- app/build.gradle | 4 ++- app/functions/httpdns.gradle | 4 +-- foudations/httpdns-mogo/build.gradle | 2 +- .../com/mogo/httpdns/mogo/MogoHttpDns.java | 36 ++++++++++++++----- .../base/websocket/WebSocketDnsManager.java | 1 + .../com/mogo/utils/network/OkHttpFactory.java | 4 +++ gradle.properties | 2 +- 7 files changed, 40 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 87bfe5dff1..926263ddff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -484,6 +484,7 @@ dependencies { implementation rootProject.ext.dependencies.moduleextensions implementation rootProject.ext.dependencies.modulemap implementation rootProject.ext.dependencies.moduleSmallMap + implementation rootProject.ext.dependencies.httpdnsmogo } else { implementation project(':foudations:mogo-commons') implementation project(':foudations:mogo-base-websocket-sdk') @@ -501,6 +502,7 @@ dependencies { implementation project(':modules:mogo-module-extensions') implementation project(':modules:mogo-module-map') implementation project(':modules:mogo-module-smp') + implementation project(':foudations:httpdns-mogo') } apply from: "./functions/basedmap.gradle" @@ -513,7 +515,7 @@ dependencies { apply from: "./functions/crashreport.gradle" apply from: "./functions/widgets.gradle" apply from: "./functions/tts.gradle" - apply from: "./functions/httpdns.gradle" +// apply from: "./functions/httpdns.gradle" apply from: "./functions/backwidget.gradle" apply from: "./functions/mediaui.gradle" apply from: "./functions/bizguide.gradle" diff --git a/app/functions/httpdns.gradle b/app/functions/httpdns.gradle index 9edbf9b3f7..c8522af9bb 100644 --- a/app/functions/httpdns.gradle +++ b/app/functions/httpdns.gradle @@ -6,8 +6,8 @@ project.dependencies { demoImplementation rootProject.ext.dependencies.httpdnsnoop onlineImplementation rootProject.ext.dependencies.httpdnsmogo } else { - qaImplementation project(':foudations:httpdns-noop') - demoImplementation project(':foudations:httpdns-noop') + qaImplementation project(':foudations:httpdns-mogo') + demoImplementation project(':foudations:httpdns-mogo') onlineImplementation project(':foudations:httpdns-mogo') } } \ No newline at end of file diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 6f3d9a6bf8..bb7349607c 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.7' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.8' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 47aa3a4410..f1396902f1 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -25,6 +25,7 @@ import com.mogo.utils.network.HttpDns; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -49,6 +50,12 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { + Logger.d("MogoHttpDns", "host: " + host + " type: " + type); + Logger.d("MogoHttpDns","all host: "); + Map map = httpDnsHelper.getAllAddress(); + for (String key : map.keySet()) { + Logger.d("MogoHttpDns","key: "+key+" value: "+map.get(key)); + } if (useCache) { String address = httpDnsHelper.getHttpDnsCachedAddress(type, host); if (address != null) { @@ -61,17 +68,20 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe } } - private final Map ttlCallbackMap = new ArrayMap<>(); + private final Map> ttlCallbackMap = new ArrayMap<>(); @Override public void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback) { - ttlCallbackMap.put(type + "-" + host, callback); - + if (ttlCallbackMap.get(type + "-" + host) == null) { + ttlCallbackMap.put(type + "-" + host, new ArrayList()); + } + ttlCallbackMap.get(type + "-" + host).add(callback); } @Override public void removeHttpDnsTtlCallback(String host, int type) { - ttlCallbackMap.remove(type + "-" + host); + // 先不实现 +// ttlCallbackMap.remove(type + "-" + host); } @Override @@ -94,6 +104,15 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe public List lookup(String hostname) throws UnknownHostException { String cacheIp = httpDnsHelper.getHttpDnsCachedAddress(HTTP_DNS_ADDRESS_TYPE_HTTP, hostname); if (cacheIp == null || TextUtils.isEmpty(cacheIp)) { + cacheIp = httpDnsHelper.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP, hostname); + if(!TextUtils.isEmpty(cacheIp)){ + String[] info = cacheIp.split(":"); + if (info.length > 1) { + return Arrays.asList(InetAddress.getAllByName(info[0])); + } else { + return Arrays.asList(InetAddress.getAllByName(cacheIp)); + } + } return Collections.emptyList(); } String[] info = cacheIp.split(":"); @@ -108,10 +127,11 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe public void onAddressChanged(@org.jetbrains.annotations.Nullable Map map) { if (map != null) { for (String key : map.keySet()) { - IHttpDnsTtlCallback callback = ttlCallbackMap.get(key); - Logger.d("MogoHttpDns", "onAddressChanged key: " + key); - if (callback != null) { - callback.onTtl(); + if (ttlCallbackMap.get(key) != null) { + Logger.d("MogoHttpDns", "onAddressChanged key: " + key); + for(IHttpDnsTtlCallback callback : ttlCallbackMap.get(key)){ + callback.onTtl(); + } }else{ Logger.d("MogoHttpDns", "callback is null: " + key); } diff --git a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java index a7f94f87b9..8a46cb0ba2 100644 --- a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java +++ b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java @@ -3,6 +3,7 @@ package com.mogo.base.websocket; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.httpdns.HttpDnsConst; import com.mogo.httpdns.IMogoHttpDns; +import com.mogo.httpdns.MogoHttpDnsHandler; import com.mogo.utils.ThreadPoolService; import com.mogo.utils.logger.Logger; diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/network/OkHttpFactory.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/OkHttpFactory.java index b9e7162248..d7c18ac352 100644 --- a/foudations/mogo-utils/src/main/java/com/mogo/utils/network/OkHttpFactory.java +++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/OkHttpFactory.java @@ -1,5 +1,7 @@ package com.mogo.utils.network; +import com.mogo.utils.logger.Logger; + import java.net.InetAddress; import java.util.List; import java.util.Set; @@ -54,8 +56,10 @@ public final class OkHttpFactory { builder.dns( hostname -> { List< InetAddress > addresses = httpDns.lookup( hostname ); if ( addresses != null && !addresses.isEmpty() ) { + Logger.d("OkHttpFactory","look up hostname: "+hostname+" address: "+addresses.get(0).getHostAddress()); return addresses; } + Logger.d("OkHttpFactory","hostname: "+hostname+" no address"); return Dns.SYSTEM.lookup( hostname ); } ); } diff --git a/gradle.properties b/gradle.properties index 47537e0156..e9e80bff90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -134,7 +134,7 @@ MOGO_MODULES_SMALL_MAP=1.0.0 # httpdns HTTPDNS_TENCENT_VERSION = 2.0.12 HTTPDNS_MOGO_VERSION=2.0.12 -HTTPDNS_BASE_VERSION = 2.0.12 +HTTPDNS_BASE_VERSION = 2.0.13 HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 From 081fdba8b7c46928c1bb91abc7a36dc8b9c14f15 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Dec 2020 15:04:11 +0800 Subject: [PATCH 05/28] update callchat to add httpDNS --- .idea/gradle.xml | 1 - app/src/main/java/com/mogo/launcher/MogoApplication.java | 2 +- gradle.properties | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 8efbfa420e..426ff6b360 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,7 +85,6 @@ diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index dd82afcdb8..b21ec92c05 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -75,7 +75,7 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS ) ); if ( DebugConfig.isMapBased() ) { -// MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) ); + MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) ); } MogoModulePaths.addBaseModule( new MogoModule( ShareConstants.TAG, ShareConstants.MODEL_NAME ) ); diff --git a/gradle.properties b/gradle.properties index e9e80bff90..d18a688099 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.41 +CARCHATTING_VERSION=2.2.43 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From ee9aa3d0c0c84b384531def9d75e45b25410f76a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Dec 2020 15:37:22 +0800 Subject: [PATCH 06/28] add log --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d18a688099..3e76abec2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.43 +CARCHATTING_VERSION=2.2.44 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From 94073f79591959a7539dea60a53836c4ade231e6 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 29 Dec 2020 16:05:24 +0800 Subject: [PATCH 07/28] opt --- .../zhidao/roadcondition/net/HttpClient.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt index 8727504fff..81d6b3bac9 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt @@ -1,8 +1,11 @@ package com.zhidao.roadcondition.net +import android.util.Log import com.mogo.commons.AbsMogoApplication +import com.mogo.utils.network.NetConfig import com.zhidao.roadcondition.constant.HttpConstants import okhttp3.Cache +import okhttp3.Dns import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit @@ -67,11 +70,25 @@ class HttpClient private constructor(baseUrl: String) { } private fun getOkHttpClient(): OkHttpClient { + val builder = OkHttpClient.Builder() val httpLoggingInterceptor = HttpLoggingInterceptor() httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY val cacheFile = File(AbsMogoApplication.getApp().applicationContext.cacheDir, "cache") val cache = Cache(cacheFile, 1024 * 1024 * 50) - return OkHttpClient.Builder() + + val httpDns = NetConfig.instance().httpDns + if (httpDns != null) { + builder.dns(Dns { hostname: String? -> + val addresses = httpDns.lookup(hostname) +// Log.d("liyz", "addresses 1 = $addresses") + if (addresses != null && !addresses.isEmpty()) { + return@Dns addresses + } + Dns.SYSTEM.lookup(hostname) + }) + } + + return builder .addInterceptor(httpLoggingInterceptor) .cache(cache) .connectTimeout(DEFAULT_CONNECT_TIME, TimeUnit.SECONDS) From 4abcb8af96c6ae2adf08503b99caf6fde4044b5a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Dec 2020 16:27:50 +0800 Subject: [PATCH 08/28] add log --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3e76abec2d..1d4c2ce340 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.44 +CARCHATTING_VERSION=2.2.45 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From 59af90ee3405d0a4415f013e3f579021bf1ab606 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 29 Dec 2020 17:39:44 +0800 Subject: [PATCH 09/28] add log --- .idea/gradle.xml | 1 + foudations/httpdns-mogo/build.gradle | 2 +- .../src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 426ff6b360..8efbfa420e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,6 +85,7 @@ diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index bb7349607c..b54a1f2a00 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.8' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.11' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index f1396902f1..d556f51cc1 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -51,10 +51,12 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { Logger.d("MogoHttpDns", "host: " + host + " type: " + type); - Logger.d("MogoHttpDns","all host: "); Map map = httpDnsHelper.getAllAddress(); - for (String key : map.keySet()) { - Logger.d("MogoHttpDns","key: "+key+" value: "+map.get(key)); + if(map != null) { + Logger.d("MogoHttpDns", "all host: "); + for (String key : map.keySet()) { + Logger.d("MogoHttpDns", "key: " + key + " value: " + map.get(key)); + } } if (useCache) { String address = httpDnsHelper.getHttpDnsCachedAddress(type, host); From 618cc9a9bf237d18d143f19c458bfb9889ec3cfd Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 29 Dec 2020 19:01:06 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E6=9B=BF=E6=8D=A2zhidaohulian=E4=B8=BAzh?= =?UTF-8?q?idaozhixing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- foudations/httpdns-mogo/build.gradle | 2 +- .../src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index b54a1f2a00..549177f587 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.11' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.13' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index d556f51cc1..375771761f 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -50,6 +50,9 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { + if (host.contains("zhidaohulian")) { + host = host.replace("zhidaohulian", "zhidaozhixing"); + } Logger.d("MogoHttpDns", "host: " + host + " type: " + type); Map map = httpDnsHelper.getAllAddress(); if(map != null) { From 19257eb00cbfb02bc8c1417caa94203c08a317f8 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 29 Dec 2020 19:24:11 +0800 Subject: [PATCH 11/28] opt http dns sdk --- foudations/httpdns-mogo/build.gradle | 2 +- .../src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java | 3 --- gradle.properties | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 549177f587..964b800da1 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.13' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.14' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 375771761f..d556f51cc1 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -50,9 +50,6 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { - if (host.contains("zhidaohulian")) { - host = host.replace("zhidaohulian", "zhidaozhixing"); - } Logger.d("MogoHttpDns", "host: " + host + " type: " + type); Map map = httpDnsHelper.getAllAddress(); if(map != null) { diff --git a/gradle.properties b/gradle.properties index 1d4c2ce340..04aee2cfe7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.45 +CARCHATTING_VERSION=2.2.60 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From 9f0b39aa77311474682125d48907e1cf0841d48b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Dec 2020 19:55:52 +0800 Subject: [PATCH 12/28] update callchat --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1d4c2ce340..4c3c2fc5e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.45 +CARCHATTING_VERSION=2.2.61 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From ad79c5b8de51c75d945acdc95c4710c83d2d547d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Dec 2020 14:23:58 +0800 Subject: [PATCH 13/28] update callchat --- .idea/gradle.xml | 1 - gradle.properties | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 8efbfa420e..426ff6b360 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,7 +85,6 @@ diff --git a/gradle.properties b/gradle.properties index 4c3c2fc5e5..542c574591 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.61 +CARCHATTING_VERSION=2.2.63 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From 053b695f9e9b51e96d68def0478b6c6c703c6308 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Wed, 30 Dec 2020 14:25:17 +0800 Subject: [PATCH 14/28] opt --- foudations/httpdns-mogo/build.gradle | 2 +- .../src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java | 9 ++------- .../java/com/mogo/base/websocket/WebSocketManager.java | 3 +++ gradle.properties | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 964b800da1..6b662cab56 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.14' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.15' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index d556f51cc1..64e4ffe141 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -50,14 +50,8 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { - Logger.d("MogoHttpDns", "host: " + host + " type: " + type); + Logger.d("MogoHttpDns", "getHttpDnsIp host: " + host + " type: " + type); Map map = httpDnsHelper.getAllAddress(); - if(map != null) { - Logger.d("MogoHttpDns", "all host: "); - for (String key : map.keySet()) { - Logger.d("MogoHttpDns", "key: " + key + " value: " + map.get(key)); - } - } if (useCache) { String address = httpDnsHelper.getHttpDnsCachedAddress(type, host); if (address != null) { @@ -74,6 +68,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback) { + Logger.d("MogoHttpDns","addHttpDnsTtlCallback: host: "+host+" type: "+type); if (ttlCallbackMap.get(type + "-" + host) == null) { ttlCallbackMap.put(type + "-" + host, new ArrayList()); } diff --git a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketManager.java b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketManager.java index 5e110bb8ea..1ad96357ef 100644 --- a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketManager.java +++ b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketManager.java @@ -78,6 +78,9 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin @Override public void ttlIp(String url) { Logger.d(TAG,"ttlIp url : " + url); + if(!WebSocketInstanceHolder.getClientProxy().isOpen()){ + return; + } WebSocketInstanceHolder.getClientProxy().stop(); WebSocketInstanceHolder.getClientProxy().disConnect(); Logger.d(TAG,"ready to re initWebSocket : " + url); diff --git a/gradle.properties b/gradle.properties index 04aee2cfe7..542c574591 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.60 +CARCHATTING_VERSION=2.2.63 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From a121f3d2bda723b389884021b3bf93ddd012334f Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 5 Jan 2021 14:02:48 +0800 Subject: [PATCH 15/28] httpdns singleton --- .idea/gradle.xml | 1 + .../com/mogo/launcher/MogoApplication.java | 12 ++++++ .../mogo/httpdns/IHttpDnsLocationChanged.java | 13 +++++++ .../java/com/mogo/httpdns/IMogoHttpDns.java | 10 +++++ foudations/httpdns-mogo/build.gradle | 2 - .../com/mogo/httpdns/mogo/MogoHttpDns.java | 18 +++++---- .../base/websocket/WebSocketDnsManager.java | 2 +- .../com/mogo/commons/AbsMogoApplication.java | 6 +++ .../utils/httpdns/HttpSimpleLocation.java | 37 +++++++++++++++++++ 9 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java create mode 100644 foudations/mogo-utils/src/main/java/com/mogo/utils/httpdns/HttpSimpleLocation.java diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 426ff6b360..8efbfa420e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,6 +85,7 @@ diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index b21ec92c05..02b837e126 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -12,6 +12,7 @@ import com.bytedance.boost_multidex.BoostMultiDex; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.Utils; +import com.mogo.map.location.MogoLocation; import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant; import com.mogo.module.carchatting.card.CallChatConstant; import com.mogo.module.common.MogoApisHandler; @@ -30,6 +31,7 @@ import com.mogo.service.passport.IMogoTicketCallback; import com.mogo.test.crashreport.ITestCrashReportProvider; import com.mogo.utils.ProcessUtils; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.httpdns.HttpSimpleLocation; import com.mogo.utils.logger.LogLevel; import com.mogo.utils.logger.Logger; import com.mogo.utils.storage.SharedPrefsMgr; @@ -157,6 +159,16 @@ public class MogoApplication extends AbsMogoApplication { prepareBaseService( apis, 2_000L ); } + @Override + protected HttpSimpleLocation getCurrentLocation() { + MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(this).getLastKnowLocation(); + if (location == null) { + return null; + }else { + return new HttpSimpleLocation(location.getCityCode(), location.getLatitude(), location.getLongitude()); + } + } + /** * 基础服务:passport、location、socket */ diff --git a/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java b/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java new file mode 100644 index 0000000000..3753ebc90e --- /dev/null +++ b/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java @@ -0,0 +1,13 @@ +package com.mogo.httpdns; + +import android.location.Location; + +import com.mogo.utils.httpdns.HttpSimpleLocation; + +public interface IHttpDnsLocationChanged { + /** + * 获取当前定位 + * @return 当前定位 + */ + HttpSimpleLocation getLocation(); +} diff --git a/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IMogoHttpDns.java b/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IMogoHttpDns.java index 725d63cc72..f07ea004cb 100644 --- a/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IMogoHttpDns.java +++ b/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IMogoHttpDns.java @@ -1,5 +1,7 @@ package com.mogo.httpdns; +import android.content.Context; + import androidx.annotation.Keep; import androidx.annotation.Nullable; @@ -95,4 +97,12 @@ interface IMogoHttpDns extends IProvider { */ @Keep void removeHttpDnsTtlCallback(String host,int type); + + /** + * 初始化 + * + * @param context 上下文 + * @param locationChanged 定位发生变化 + */ + void init(Context context, IHttpDnsLocationChanged locationChanged); } diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 6b662cab56..2c44ea5a06 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -37,11 +37,9 @@ dependencies { if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase implementation rootProject.ext.dependencies.mogocommons - implementation rootProject.ext.dependencies.modulecommon } else { implementation project(':foudations:httpdns-base') implementation project(':foudations:mogo-commons') - implementation project(':modules:mogo-module-common') } } diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 64e4ffe141..a39e7c59a1 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -1,7 +1,6 @@ package com.mogo.httpdns.mogo; import android.content.Context; -import android.os.Debug; import android.text.TextUtils; import android.util.ArrayMap; @@ -12,14 +11,14 @@ import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.Utils; import com.mogo.httpdns.HttpDnsConst; import com.mogo.httpdns.IHttpDnsCallback; +import com.mogo.httpdns.IHttpDnsLocationChanged; import com.mogo.httpdns.IHttpDnsTtlCallback; import com.mogo.httpdns.IMogoHttpDns; import com.mogo.httpdnshelper.sdk.HttpDnsHelper; import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation; import com.mogo.httpdnshelper.sdk.listener.IHttpDnsCurrentLocation; import com.mogo.httpdnshelper.sdk.listener.OnAddressChangedListener; -import com.mogo.map.location.MogoLocation; -import com.mogo.module.common.MogoApisHandler; +import com.mogo.utils.httpdns.HttpSimpleLocation; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.HttpDns; @@ -83,13 +82,18 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void init(final Context context) { + + } + + @Override + public void init(Context context, final IHttpDnsLocationChanged locationChanged) { httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { @org.jetbrains.annotations.Nullable @Override public HttpDnsSimpleLocation getCurrentLocation() { - MogoLocation last = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation(); - if (last != null) { - return new HttpDnsSimpleLocation(last.getCityCode(), last.getLatitude(), last.getLongitude()); + HttpSimpleLocation simpleLocation = locationChanged.getLocation(); + if (simpleLocation != null) { + return new HttpDnsSimpleLocation("0734", simpleLocation.getLat(), simpleLocation.getLon()); } return null; } @@ -121,7 +125,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe } @Override - public void onAddressChanged(@org.jetbrains.annotations.Nullable Map map) { + public void onAddressChanged(Map map) { if (map != null) { for (String key : map.keySet()) { if (ttlCallbackMap.get(key) != null) { diff --git a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java index 8a46cb0ba2..4605e4b9ec 100644 --- a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java +++ b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java @@ -28,7 +28,7 @@ public class WebSocketDnsManager { public void getHttpDnsIp(WebSocketDns webSocketDns) { this.webSocketDns = webSocketDns; - IMogoHttpDns mogoHttpDns = ARouter.getInstance().navigation(IMogoHttpDns.class); + IMogoHttpDns mogoHttpDns = MogoHttpDnsHandler.getHttpDnsApi(); ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS,false, ip -> { Logger.d(TAG, "getHttpDnsIp ip : " + ip + " , 得到Dns IP,准备回调 初始化webSocket"); this.cacheIp = ip; diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java index 636cf85304..3cf6518c85 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java @@ -24,6 +24,7 @@ import com.mogo.httpdns.MogoHttpDnsHandler; import com.mogo.utils.ThreadPoolService; import com.mogo.utils.TipDrawable; import com.mogo.utils.TipToast; +import com.mogo.utils.httpdns.HttpSimpleLocation; import com.mogo.utils.network.NetConfig; import java.security.SecureRandom; @@ -87,6 +88,7 @@ public abstract class AbsMogoApplication extends Application { } private void syncInit() { + MogoHttpDnsHandler.getHttpDnsApi().init(this, this::getCurrentLocation); TipToast.init( this, ( ( context, message, tipDrawable ) -> { if ( TextUtils.isEmpty( message ) ) { return null; @@ -100,6 +102,10 @@ public abstract class AbsMogoApplication extends Application { } ) ); } + protected HttpSimpleLocation getCurrentLocation(){ + return null; + } + private View generateToastView( Context context, String message, TipDrawable tipDrawable){ View contentView; if(tipDrawable==null) { diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/httpdns/HttpSimpleLocation.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/httpdns/HttpSimpleLocation.java new file mode 100644 index 0000000000..f8589f8f18 --- /dev/null +++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/httpdns/HttpSimpleLocation.java @@ -0,0 +1,37 @@ +package com.mogo.utils.httpdns; + +public class HttpSimpleLocation { + private String cityCode; + private double lat; + private double lon; + + public HttpSimpleLocation(String cityCode, double lat, double lon) { + this.cityCode = cityCode; + this.lat = lat; + this.lon = lon; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } +} From aa95ab8f875adc82697fc979ee89c617120d5545 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 5 Jan 2021 17:58:30 +0800 Subject: [PATCH 16/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=B0=E8=B7=AF=E7=94=B1=E8=A1=A8=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8Bhttpdns=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- foudations/httpdns-mogo/build.gradle | 2 +- .../src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java | 4 ++-- gradle.properties | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 2c44ea5a06..8fc6202121 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.15' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.16' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index a39e7c59a1..7bdc28045f 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -87,13 +87,13 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void init(Context context, final IHttpDnsLocationChanged locationChanged) { - httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { + httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setDefaultUrl("dzt.zhidaozhixing.com").setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { @org.jetbrains.annotations.Nullable @Override public HttpDnsSimpleLocation getCurrentLocation() { HttpSimpleLocation simpleLocation = locationChanged.getLocation(); if (simpleLocation != null) { - return new HttpDnsSimpleLocation("0734", simpleLocation.getLat(), simpleLocation.getLon()); + return new HttpDnsSimpleLocation(simpleLocation.getCityCode(), simpleLocation.getLat(), simpleLocation.getLon()); } return null; } diff --git a/gradle.properties b/gradle.properties index 542c574591..b363eb76e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.63 +CARCHATTING_VERSION=2.2.65 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.8 # websocket From b1fdb1fd31a4e7a09c8b25950c1865d7b1864477 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Wed, 6 Jan 2021 11:55:52 +0800 Subject: [PATCH 17/28] =?UTF-8?q?=E6=B7=BB=E5=8A=A0host=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/httpdns/mogo/MogoHttpDns.java | 2 +- .../module/common/constants/HostConst.java | 19 ++++++++ modules/mogo-module-share/consumer-rules.pro | 5 +- modules/mogo-module-share/proguard-rules.pro | 5 +- .../com/mogo/module/share/ShareControl.java | 7 +-- .../module/share/constant/HttpConstant.kt | 4 ++ .../module/share/manager/SeekHelpManager.kt | 7 +-- .../mogo/module/share/net/ShareApiService.kt | 47 ------------------- .../module/share/net/ShareDevaApiService.java | 32 +++++++++++++ .../module/share/net/ShareLsApiService.java | 25 ++++++++++ .../module/share/net/ShareRtlApiService.java | 19 ++++++++ .../share/strategyreceiver/BlockStrategy.kt | 11 ----- 12 files changed, 116 insertions(+), 67 deletions(-) create mode 100644 modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java delete mode 100644 modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareApiService.kt create mode 100644 modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java create mode 100644 modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareLsApiService.java create mode 100644 modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 7bdc28045f..5134c3e77c 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -93,7 +93,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe public HttpDnsSimpleLocation getCurrentLocation() { HttpSimpleLocation simpleLocation = locationChanged.getLocation(); if (simpleLocation != null) { - return new HttpDnsSimpleLocation(simpleLocation.getCityCode(), simpleLocation.getLat(), simpleLocation.getLon()); + return new HttpDnsSimpleLocation("0734", simpleLocation.getLat(), simpleLocation.getLon()); } return null; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java new file mode 100644 index 0000000000..6a188c5115 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java @@ -0,0 +1,19 @@ +package com.mogo.module.common.constants; + +/** + * 通用接口请求host + * + * @author tong + */ +public class HostConst { + public static final String DEVA_HOST = "http://dzt-deva.zhidaozhixing.com"; + public static final String IM_HOST = "http://dzt-im.zhidaozhixing.com"; + public static final String LAUNCHER_SNAPSHOT_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com"; + public static final String CHANNEL_MANAGER_HOST = "http://dzt-channelManager.zhidaozhixing.com"; + public static final String DATA_SERVICE_HOST = "http://dzt-dataService.zhidaozhixing.com"; + public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com"; + public static final String INSTANT_HOST = "http://dzt-Instant.zhidaozhixing.com"; + + public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com"; + public static final String WEBSOCKET_DOMAIN = "dzt-city.zhidaozhixing.com"; +} diff --git a/modules/mogo-module-share/consumer-rules.pro b/modules/mogo-module-share/consumer-rules.pro index 3cae82b2c2..5c4b2cc0e8 100644 --- a/modules/mogo-module-share/consumer-rules.pro +++ b/modules/mogo-module-share/consumer-rules.pro @@ -2,4 +2,7 @@ -keep class com.mogo.module.share.bean.**{*;} -keep class com.mogo.module.share.constant.**{*;} -keep class com.mogo.module.share.manager.ISeekHelpListener --keep class com.mogo.module.share.net.ShareApiService +-keep class com.mogo.module.share.net.ShareDevaApiService +-keep class com.mogo.module.share.net.ShareLsApiService +-keep class com.mogo.module.share.net.ShareRtlApiService +#-keep class com.mogo.module.share.net.ShareApiService diff --git a/modules/mogo-module-share/proguard-rules.pro b/modules/mogo-module-share/proguard-rules.pro index b436d973dd..08a8bde62e 100644 --- a/modules/mogo-module-share/proguard-rules.pro +++ b/modules/mogo-module-share/proguard-rules.pro @@ -24,4 +24,7 @@ -keep class com.mogo.module.share.bean.**{*;} -keep class com.mogo.module.share.constant.**{*;} -keep class com.mogo.module.share.manager.ISeekHelpListener --keep class com.mogo.module.share.net.ShareApiService \ No newline at end of file +-keep class com.mogo.module.share.net.ShareDevaApiService +-keep class com.mogo.module.share.net.ShareLsApiService +-keep class com.mogo.module.share.net.ShareRtlApiService +#-keep class com.mogo.module.share.net.ShareApiService \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java index 25ff93e4f4..07a102a9cc 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java @@ -16,6 +16,7 @@ import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant; import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant; import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener; import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.common.dialog.BaseFloatDialog; import com.mogo.module.common.utils.CloudPoiManager; import com.mogo.module.share.bean.FixableButton; @@ -27,7 +28,7 @@ import com.mogo.module.share.constant.ShareConstants; import com.mogo.module.share.dialog.GridFixableShareDialog; import com.mogo.module.share.manager.ServiceApisManager; import com.mogo.module.share.manager.UploadHelper; -import com.mogo.module.share.net.ShareApiService; +import com.mogo.module.share.net.ShareDevaApiService; import com.mogo.service.MogoServicePaths; import com.mogo.service.share.IMogoShareManager; import com.mogo.service.share.IMogoTanluProvider; @@ -454,8 +455,8 @@ public class ShareControl implements IMogoShareManager, Handler.Callback { ShareConfigRequest request = new ShareConfigRequest(Utils.getSn(), location.getAdCode()); params.put("data", request.toJson()); - ServiceApisManager.serviceApis.getNetworkApi().create(ShareApiService.class, - HttpConstant.Companion.getNetHost()).queryShareButtonConfig(params).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + ServiceApisManager.serviceApis.getNetworkApi().create(ShareDevaApiService.class, + HostConst.DEVA_HOST).queryShareButtonConfig(params).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { @Override public void onSuccess(ShareButtonConfigResponse o) { super.onSuccess(o); diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt index 497a1dd160..18f146150e 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt @@ -10,6 +10,10 @@ class HttpConstant { const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com" const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com" + const val DEVA_HOST = "http://dzt-deva.zhidaozhixing.com" + const val RTL_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com" + const val LS_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com" + @JvmStatic fun getNetHost(): String { diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt index d1b6bf781b..16e8bd8e59 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt @@ -10,11 +10,12 @@ import com.mogo.commons.network.SubscribeImpl import com.mogo.commons.network.Utils import com.mogo.commons.voice.AIAssist import com.mogo.commons.voice.IMogoVoiceCmdCallBack +import com.mogo.module.common.constants.HostConst import com.mogo.module.share.bean.SeekRecord import com.mogo.module.share.bean.SeekRequest import com.mogo.module.share.bean.getJson import com.mogo.module.share.constant.HttpConstant -import com.mogo.module.share.net.ShareApiService +import com.mogo.module.share.net.ShareRtlApiService import com.mogo.utils.TipToast import com.mogo.utils.logger.Logger import com.mogo.utils.network.RequestOptions @@ -164,7 +165,7 @@ object SeekHelpManager { properties["from"] = from AnalyticsUtils.track("v2x_share_type", properties) - ServiceApisManager.serviceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl(RequestOptions.create(context)) { + ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl(RequestOptions.create(context)) { override fun onSuccess(o: BaseData?) { super.onSuccess(o) // 接口请求成功,内部同步v2x状态,通知adas,改变自车图标 @@ -222,7 +223,7 @@ object SeekHelpManager { fun debugCancelSeek() { val seekRequest = SeekRequest(Utils.getSn(), 0) val param = mutableMapOf("data" to seekRequest.getJson()) - ServiceApisManager.serviceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl(RequestOptions.create(context)) { + ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl(RequestOptions.create(context)) { override fun onSuccess(o: BaseData?) { super.onSuccess(o) // 接口请求成功,内部同步v2x状态,通知adas,改变自车图标 diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareApiService.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareApiService.kt deleted file mode 100644 index 347ff0de3d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareApiService.kt +++ /dev/null @@ -1,47 +0,0 @@ -package com.mogo.module.share.net - -import com.mogo.commons.data.BaseData -import com.mogo.module.share.bean.AverateSpeedResponse -import com.mogo.module.share.bean.BaseDataCompat -import com.mogo.module.share.bean.RoadInfos -import com.mogo.module.share.bean.ShareButtonConfigResponse -import io.reactivex.Observable -import okhttp3.RequestBody -import retrofit2.http.* - -/** - * 分享用到的api接口 - */ -interface ShareApiService { - /** - * 发起求助接口 - */ - @FormUrlEncoded - @POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1") - fun sendHelpSignal(@FieldMap param: Map): Observable - - /** - * 拥堵策略,上报平均速度 - */ - @Headers("Content-type:application/json;charset=UTF-8") - @POST("/deva/car/path/no/poiStrategyCheck/v1") - fun sendAverageSpeedForBlockStrategy(@Body request: RequestBody, @Query("sn") sn: String): Observable - - /** - * 获取分享框服务端配置 - */ - @FormUrlEncoded - @POST("/deva/car/poiType/no/poiTypeList") - fun queryShareButtonConfig(@FieldMap param: Map): Observable - - /** - * 查询(搜索)道路事件信息 - * 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842 - * 文档中有些参数暂时没有用到,包括radius,limit - * @return - */ - @FormUrlEncoded - @POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync") - fun queryRoadInfos(@FieldMap params: Map): Observable> - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java new file mode 100644 index 0000000000..d4adcb6e0a --- /dev/null +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java @@ -0,0 +1,32 @@ +package com.mogo.module.share.net; + +import com.mogo.module.share.bean.AverateSpeedResponse; +import com.mogo.module.share.bean.ShareButtonConfigResponse; + +import java.util.Map; + +import io.reactivex.Observable; +import okhttp3.RequestBody; +import retrofit2.http.Body; +import retrofit2.http.FieldMap; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.Query; + +public interface ShareDevaApiService { + /** + * 拥堵策略,上报平均速度 + */ + @Headers("Content-type:application/json;charset=UTF-8") + @POST("/deva/car/path/no/poiStrategyCheck/v1") + Observable sendAverageSpeedForBlockStrategy(@Body RequestBody request, @Query("sn")String sn); + + /** + * 获取分享框服务端配置 + */ + @FormUrlEncoded + @POST("/deva/car/poiType/no/poiTypeList") + Observable queryShareButtonConfig(@FieldMap Map param); + +} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareLsApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareLsApiService.java new file mode 100644 index 0000000000..2de41196a1 --- /dev/null +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareLsApiService.java @@ -0,0 +1,25 @@ +package com.mogo.module.share.net; + +import com.mogo.module.share.bean.BaseDataCompat; +import com.mogo.module.share.bean.RoadInfos; + +import java.util.Map; + +import io.reactivex.Observable; +import retrofit2.http.FieldMap; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.POST; + +public interface ShareLsApiService { + /** + * 查询(搜索)道路事件信息 + * 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842 + * 文档中有些参数暂时没有用到,包括radius,limit + * + * @return + */ + @FormUrlEncoded + @POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync") + Observable> queryRoadInfos(@FieldMap Map params); + +} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java new file mode 100644 index 0000000000..bf43b3f1ea --- /dev/null +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java @@ -0,0 +1,19 @@ +package com.mogo.module.share.net; + +import com.mogo.commons.data.BaseData; + +import java.util.Map; + +import io.reactivex.Observable; +import retrofit2.http.FieldMap; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.POST; + +public interface ShareRtlApiService { + /** + * 发起求助接口 + */ + @FormUrlEncoded + @POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1") + Observable sendHelpSignal(@FieldMap Map param ); +} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt index 75936e070a..369c528f10 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt @@ -3,24 +3,13 @@ package com.mogo.module.share.strategyreceiver import android.content.Context import android.os.Handler import android.os.SystemClock -import android.util.ArrayMap -import com.mogo.commons.network.SubscribeImpl -import com.mogo.commons.network.Utils import com.mogo.map.MogoLatLng -import com.mogo.module.share.bean.AverateSpeedResponse -import com.mogo.module.share.constant.HttpConstant import com.mogo.module.share.manager.ServiceApisManager -import com.mogo.module.share.net.ShareApiService import com.mogo.service.IMogoServiceApis import com.mogo.service.share.IMogoTanluProvider import com.mogo.service.share.TanluUploadParams import com.mogo.utils.logger.Logger -import com.mogo.utils.network.RequestOptions -import com.mogo.utils.network.utils.GsonUtil import com.mogo.utils.storage.SharedPrefsMgr -import io.reactivex.schedulers.Schedulers -import okhttp3.MediaType -import okhttp3.RequestBody import java.util.* import kotlin.collections.ArrayList From 0727bac8d0f771d1f88a7313067b5670a4c59edf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Jan 2021 14:18:21 +0800 Subject: [PATCH 18/28] update callchat --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 542c574591..bd44ade223 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,9 +139,9 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.63 +CARCHATTING_VERSION=2.2.68 # 车聊聊接口 -CARCHATTINGPROVIDER_VERSION=1.1.8 +CARCHATTINGPROVIDER_VERSION=1.1.9 # websocket WEBSOCKET_VERSION=1.1.7 # loglib From b3b445c9ec2f3b0506d6c8ab1fe740f9ce04c57c Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 6 Jan 2021 16:51:23 +0800 Subject: [PATCH 19/28] modify host --- .../com/zhidao/roadcondition/constant/HttpConstants.kt | 9 --------- .../zhidao/roadcondition/model/StrategyServiceModel.kt | 5 +++-- .../main/java/com/zhidao/roadcondition/net/HttpApi.kt | 4 ---- .../java/com/mogo/module/common/constants/HostConst.java | 5 ++++- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt index 9778b0b1c2..3d71a35b3e 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt @@ -19,15 +19,6 @@ class HttpConstants { } } -// fun getBaseUrl1(): String { -// return when (BuildConfig.BUILD_TYPE) { -// "debug" -> DEV_BASE_URL_OWNER -// "qa" -> DEV_BASE_URL_OWNER -// "release" -> RELEASE_BASE_URL_OWNER -// "show" -> SHOW_BASE_URL_OWNER -// else -> RELEASE_BASE_URL_OWNER -// } -// } } } \ No newline at end of file diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/model/StrategyServiceModel.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/model/StrategyServiceModel.kt index e35b593acd..fc90eb6102 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/model/StrategyServiceModel.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/model/StrategyServiceModel.kt @@ -3,6 +3,7 @@ package com.zhidao.roadcondition.model import android.util.Log import com.google.gson.Gson import com.mogo.commons.network.Utils +import com.mogo.module.common.constants.HostConst import com.zhidao.roadcondition.base.BaseRepository import com.zhidao.roadcondition.net.HttpClient import com.zhidao.roadcondition.util.LocationUtil @@ -21,7 +22,7 @@ class StrategyServiceModel : BaseRepository() { locInfo.cityCode ) ) - HttpClient.getInstance().getHttpApi().getCityStrategy(map) + HttpClient.getInstance(HostConst.GEOFENCE_HOST).getHttpApi().getCityStrategy(map) } } @@ -29,7 +30,7 @@ class StrategyServiceModel : BaseRepository() { return apiCall { val informationBodyStr = Gson().toJson(informationBody) Log.d("MainServiceController", "uploadInformation informationBody = $informationBodyStr") - HttpClient.getInstance().getHttpApi() + HttpClient.getInstance(HostConst.DEVA_HOST).getHttpApi() .uploadInformation(mapOf("sn" to Utils.getSn(), "data" to informationBodyStr)) } } diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpApi.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpApi.kt index bc79a453c2..750a66afd6 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpApi.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpApi.kt @@ -22,8 +22,4 @@ interface HttpApi { @POST("/deva/car/path/no/addInfomation/v2") suspend fun uploadInformation(@FieldMap information: Map): BaseResponse - //获取所有配置 - @GET("dataService/car/customConfig/no/getAll/v1") - suspend fun getAllCommonConfig(@QueryMap commonConfigBody: Map):BaseResponse - } \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java index 6a188c5115..0ff36731da 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java @@ -13,7 +13,10 @@ public class HostConst { public static final String DATA_SERVICE_HOST = "http://dzt-dataService.zhidaozhixing.com"; public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com"; public static final String INSTANT_HOST = "http://dzt-Instant.zhidaozhixing.com"; - + public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com"; + public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com"; public static final String WEBSOCKET_DOMAIN = "dzt-city.zhidaozhixing.com"; + + } From b45118e8aa24439457020721241822666f91521b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Jan 2021 16:56:59 +0800 Subject: [PATCH 20/28] update callchat --- .idea/gradle.xml | 1 - gradle.properties | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 8efbfa420e..426ff6b360 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,7 +85,6 @@ diff --git a/gradle.properties b/gradle.properties index bd44ade223..5c1c30ee53 100644 --- a/gradle.properties +++ b/gradle.properties @@ -139,9 +139,9 @@ HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.68 +CARCHATTING_VERSION=2.2.70 # 车聊聊接口 -CARCHATTINGPROVIDER_VERSION=1.1.9 +CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket WEBSOCKET_VERSION=1.1.7 # loglib From 01133958a6797e01c8697fd7462234574780c5da Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Wed, 6 Jan 2021 18:13:42 +0800 Subject: [PATCH 21/28] =?UTF-8?q?=E4=BF=AE=E6=94=B9websocket=20Host?= =?UTF-8?q?=E5=92=8Centrance=20host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + .../base/websocket/WebSocketConstant.java | 19 ------------- .../base/websocket/WebSocketDnsManager.java | 8 +++--- .../module/common/constants/HostConst.java | 2 +- .../entrance/EntrancePresenter.java | 11 ++------ .../extensions/net/DztHttpConstant.java | 28 ------------------- 6 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/DztHttpConstant.java diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 426ff6b360..8efbfa420e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,6 +85,7 @@ diff --git a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java index f0e5ec13b7..7835571391 100644 --- a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java +++ b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java @@ -21,12 +21,6 @@ public class WebSocketConstant { @Keep public static final String PROTOCOL = "ws://"; - private static final String DOMAIN_DEV = "dzt-city.zhidaozhixing.com"; - private static final String DOMAIN_QA = "dzt-city.zhidaozhixing.com"; - private static final String DOMAIN_DEMO = "dzt-city.zhidaozhixing.com"; - @Keep - private static final String DOMAIN_RELEASE = "dzt-city.zhidaozhixing.com"; - public static String getSocketServer() { switch (DebugConfig.getNetMode()) { case DebugConfig.NET_MODE_DEV: @@ -41,19 +35,6 @@ public class WebSocketConstant { } } - public static String getDomain(){ - switch (DebugConfig.getNetMode()) { - case DebugConfig.NET_MODE_DEV: - return DOMAIN_DEV; - case DebugConfig.NET_MODE_QA: - return DOMAIN_QA; - case DebugConfig.NET_MODE_DEMO: - return DOMAIN_DEMO; - case DebugConfig.NET_MODE_RELEASE: - default: - return DOMAIN_RELEASE; - } - } // public static String getSocketPort() { // return PORT; diff --git a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java index 4605e4b9ec..5537fc342f 100644 --- a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java +++ b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketDnsManager.java @@ -1,9 +1,9 @@ package com.mogo.base.websocket; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.httpdns.HttpDnsConst; import com.mogo.httpdns.IMogoHttpDns; import com.mogo.httpdns.MogoHttpDnsHandler; +import com.mogo.module.common.constants.HostConst; import com.mogo.utils.ThreadPoolService; import com.mogo.utils.logger.Logger; @@ -29,16 +29,16 @@ public class WebSocketDnsManager { public void getHttpDnsIp(WebSocketDns webSocketDns) { this.webSocketDns = webSocketDns; IMogoHttpDns mogoHttpDns = MogoHttpDnsHandler.getHttpDnsApi(); - ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS,false, ip -> { + ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(HostConst.WEBSOCKET_DOMAIN, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, false, ip -> { Logger.d(TAG, "getHttpDnsIp ip : " + ip + " , 得到Dns IP,准备回调 初始化webSocket"); this.cacheIp = ip; this.webSocketDns.getDnsIp((cacheIp != null ? WebSocketConstant.PROTOCOL + ip + WebSocketConstant.PATH : WebSocketConstant.getSocketServer() + WebSocketConstant.PORT)); })); - mogoHttpDns.addHttpDnsTtlCallback(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, () -> { + mogoHttpDns.addHttpDnsTtlCallback(HostConst.WEBSOCKET_DOMAIN, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, () -> { Logger.d(TAG, "ttl callBack ,ready to getCache Dns IP"); - String dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(WebSocketConstant.getDomain(),HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS); + String dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(HostConst.WEBSOCKET_DOMAIN, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS); if (dnsCacheIp == null) { return; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java index 0ff36731da..39bd139850 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java @@ -16,7 +16,7 @@ public class HostConst { public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com"; public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com"; - public static final String WEBSOCKET_DOMAIN = "dzt-city.zhidaozhixing.com"; + public static final String WEBSOCKET_DOMAIN = "dzt-Instant.zhidaozhixing.com"; } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java index 78aa40001d..a740de1184 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java @@ -9,16 +9,14 @@ import androidx.lifecycle.LifecycleOwner; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.mvp.Presenter; -import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.extensions.R; import com.mogo.module.extensions.bean.CommonConfig; import com.mogo.module.extensions.bean.CommonConfigResponse; -import com.mogo.module.extensions.net.DztHttpConstant; import com.mogo.module.extensions.net.GetConfigApiServices; import com.mogo.module.extensions.net.UserInfoNetApiServices; -import com.mogo.module.extensions.userinfo.CarModelListResponse; import com.mogo.module.extensions.userinfo.UserInfo; import com.mogo.module.extensions.userinfo.UserInfoConstant; import com.mogo.module.extensions.userinfo.UserInfoResponse; @@ -26,19 +24,14 @@ import com.mogo.module.extensions.weather.Phenomena; import com.mogo.module.extensions.weather.WeatherCallback; import com.mogo.module.extensions.weather.WeatherInfo; import com.mogo.module.extensions.weather.WeatherModel; -import com.mogo.module.share.constant.HttpConstant; import com.mogo.service.MogoServicePaths; import com.mogo.service.network.IMogoNetwork; import com.mogo.service.statusmanager.IMogoMsgCenter; import com.mogo.service.statusmanager.IMogoMsgCenterListener; -import com.mogo.utils.DeviceIdUtils; import com.mogo.utils.digest.DigestUtils; import com.mogo.utils.logger.Logger; -import com.mogo.utils.network.RequestOptions; -import com.mogo.utils.network.utils.GsonUtil; import com.mogo.utils.storage.SharedPrefsMgr; -import java.util.HashMap; import java.util.Map; import io.reactivex.SingleObserver; @@ -143,7 +136,7 @@ public class EntrancePresenter extends Presenter implements Weathe public void getCommonConfig() { Map params = new ArrayMap<>(); params.put("sn", Utils.getSn()); - mNetWork.create(GetConfigApiServices.class, UserInfoConstant.getUserInfoBaseUrl()) + mNetWork.create(GetConfigApiServices.class, HostConst.DATA_SERVICE_HOST) .getConfig(params) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/DztHttpConstant.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/DztHttpConstant.java deleted file mode 100644 index b79998817e..0000000000 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/DztHttpConstant.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mogo.module.extensions.net; - -import com.mogo.commons.debug.DebugConfig; - -/** - * dzt base url - * - * @author tongchenfei - */ -public class DztHttpConstant { - public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com"; - public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com"; - public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com"; - public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com"; - - public static String getBaseUrl(){ - switch ( DebugConfig.getNetMode() ) { - case DebugConfig.NET_MODE_DEV: - return HOST_DEV; - case DebugConfig.NET_MODE_QA: - return HOST_TEST; - case DebugConfig.NET_MODE_DEMO: - return HOST_DEMO; - default: - return HOST_PRODUCT; - } - } -} From f74432453ad4339692a18ab6c471ab6e2e998662 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Wed, 6 Jan 2021 20:56:51 +0800 Subject: [PATCH 22/28] opt host lower case --- foudations/httpdns-mogo/build.gradle | 2 +- .../java/com/mogo/httpdns/mogo/MogoHttpDns.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 8fc6202121..513fac77a9 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation rootProject.ext.dependencies.arouter annotationProcessor rootProject.ext.dependencies.aroutercompiler - implementation 'com.mogo.httpdns:httpdns-helper:1.0.16' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.17' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 5134c3e77c..7a2e81152a 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -50,7 +50,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { Logger.d("MogoHttpDns", "getHttpDnsIp host: " + host + " type: " + type); - Map map = httpDnsHelper.getAllAddress(); + Map map = httpDnsHelper.getAllAddress(); if (useCache) { String address = httpDnsHelper.getHttpDnsCachedAddress(type, host); if (address != null) { @@ -67,7 +67,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback) { - Logger.d("MogoHttpDns","addHttpDnsTtlCallback: host: "+host+" type: "+type); + Logger.d("MogoHttpDns", "addHttpDnsTtlCallback: host: " + host + " type: " + type); if (ttlCallbackMap.get(type + "-" + host) == null) { ttlCallbackMap.put(type + "-" + host, new ArrayList()); } @@ -93,7 +93,7 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe public HttpDnsSimpleLocation getCurrentLocation() { HttpSimpleLocation simpleLocation = locationChanged.getLocation(); if (simpleLocation != null) { - return new HttpDnsSimpleLocation("0734", simpleLocation.getLat(), simpleLocation.getLon()); + return new HttpDnsSimpleLocation(simpleLocation.getCityCode(), simpleLocation.getLat(), simpleLocation.getLon()); } return null; } @@ -104,9 +104,11 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public List lookup(String hostname) throws UnknownHostException { String cacheIp = httpDnsHelper.getHttpDnsCachedAddress(HTTP_DNS_ADDRESS_TYPE_HTTP, hostname); + Logger.d("MogoHttpDnsLook", "lookup host: " + hostname + " cacheIp: " + cacheIp); if (cacheIp == null || TextUtils.isEmpty(cacheIp)) { cacheIp = httpDnsHelper.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP, hostname); - if(!TextUtils.isEmpty(cacheIp)){ + Logger.d("MogoHttpDnsLook", "==== lookup host: " + hostname + " cacheIp: " + cacheIp); + if (!TextUtils.isEmpty(cacheIp)) { String[] info = cacheIp.split(":"); if (info.length > 1) { return Arrays.asList(InetAddress.getAllByName(info[0])); @@ -130,10 +132,10 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe for (String key : map.keySet()) { if (ttlCallbackMap.get(key) != null) { Logger.d("MogoHttpDns", "onAddressChanged key: " + key); - for(IHttpDnsTtlCallback callback : ttlCallbackMap.get(key)){ + for (IHttpDnsTtlCallback callback : ttlCallbackMap.get(key)) { callback.onTtl(); } - }else{ + } else { Logger.d("MogoHttpDns", "callback is null: " + key); } } From 057d0e2eb2bfad84fe4b10737a56cf614a6169fb Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Thu, 7 Jan 2021 10:46:44 +0800 Subject: [PATCH 23/28] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/common/constants/HostConst.java | 3 +++ .../module/service/network/RefreshModel.java | 25 +++---------------- .../service/network/ZhidaoRefreshModel.java | 2 +- .../service/ttsConfig/TtsConfigModleData.java | 5 ++-- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java index 39bd139850..9be418c423 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java @@ -14,6 +14,9 @@ public class HostConst { public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com"; public static final String INSTANT_HOST = "http://dzt-Instant.zhidaozhixing.com"; public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com"; + public static final String CARLIFE_HOST = "http://dzt-carlife.zhidaozhixing.com"; + public static final String STRATEGY_PUSH_HOST = "http://dzt-strategyPush.zhidaozhixing.com"; + public static final String TRAVEL_CONDITION_HOST = "http://dzt-travelCondition.zhidaozhixing.com"; public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com"; public static final String WEBSOCKET_DOMAIN = "dzt-Instant.zhidaozhixing.com"; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java index 0d5ef1a795..338aa314cf 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java @@ -9,6 +9,8 @@ import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; import com.mogo.map.MogoLatLng; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.common.entity.MarkerResponse; import com.mogo.module.service.ServiceConst; import com.mogo.service.MogoServicePaths; @@ -34,37 +36,18 @@ public class RefreshModel { private static final String TAG = "RefreshModel"; - public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com"; - public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com"; - public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com"; - public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com"; - private final Context mContext; - private RefreshApiService mRefreshApiService; + private final RefreshApiService mRefreshApiService; public RefreshModel( Context context ) { this.mContext = context; - IMogoNetwork network = ( IMogoNetwork ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_NETWORK ).navigation( context ); - this.mRefreshApiService = network.create( RefreshApiService.class, getNetHost() ); + this.mRefreshApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( RefreshApiService.class, HostConst.LAUNCHER_SNAPSHOT_HOST); } public RefreshApiService getRefreshApiService() { return mRefreshApiService; } - public static String getNetHost() { - switch ( DebugConfig.getNetMode() ) { - case DebugConfig.NET_MODE_DEV: - return HOST_DEV; - case DebugConfig.NET_MODE_QA: - return HOST_TEST; - case DebugConfig.NET_MODE_DEMO: - return HOST_DEMO; - default: - return HOST_PRODUCT; - } - } - public void refreshExplorerWayData( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) { if ( mRefreshApiService != null ) { final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build(); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java index 599e2883bb..549f2a1f4d 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java @@ -39,7 +39,7 @@ public class ZhidaoRefreshModel { public static final String HOST_PRODUCT = "https://api.zhidaohulian.com"; private final Context mContext; - private ZhidaoApiService mRefreshApiService; + private final ZhidaoApiService mRefreshApiService; public ZhidaoRefreshModel( Context context ) { this.mContext = context; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ttsConfig/TtsConfigModleData.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ttsConfig/TtsConfigModleData.java index f8c20811d4..963fd69866 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ttsConfig/TtsConfigModleData.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ttsConfig/TtsConfigModleData.java @@ -7,6 +7,8 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.voice.AIAssist; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.service.network.RefreshModel; import com.mogo.module.service.network.bean.TtsConfigEntity; import com.mogo.service.MogoServicePaths; @@ -29,8 +31,7 @@ public class TtsConfigModleData { public TtsConfigModleData() { - IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext()); - mTtsConfigApiService = network.create(TtsConfigApiService.class, RefreshModel.getNetHost()); + mTtsConfigApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(TtsConfigApiService.class, HostConst.DATA_SERVICE_HOST); } /** From 80689307b2ad6095819f895b8dfd301f2bda45a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 7 Jan 2021 11:26:36 +0800 Subject: [PATCH 24/28] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86V2XApiServiceF?= =?UTF-8?q?actory.java=20=E8=A7=A3=E5=86=B3HttpDns=E7=9A=84=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E4=B8=8D=E5=90=8C=E9=97=AE=E9=A2=98=20V2XApiServiceFa?= =?UTF-8?q?ctory=E5=8F=AF=E4=BB=A5=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E5=9F=9F=E5=90=8D=E5=AF=B9=E5=BA=94=E7=9A=84API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/network/V2XApiServiceFactory.java | 97 +++++++++++++++++++ .../v2x/network/V2XShareNetworkModel.java | 24 ++--- 2 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java new file mode 100644 index 0000000000..21dfa42287 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java @@ -0,0 +1,97 @@ +package com.mogo.module.v2x.network; + +import android.content.Context; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.module.common.constants.HostConst; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.network.IMogoNetwork; + +/** + * 应对不同接口对应不同服务域名的工厂累 + */ +public class V2XApiServiceFactory { + + private static V2XApiService mDevaApiService; + private static V2XApiService mDataApiService; + private static V2XApiService mLauncherSnapshotApiService; + private static V2XApiService mGeoFenceCarServiceApiService; + private static V2XApiService mRealtimeLocationApiService; + private static V2XApiService mDataServiceApiService; + + /** + * 获取指定域名下的 API 服务 + */ + public static V2XApiService getApiService(Context context, String netHost) { + IMogoNetwork network = (IMogoNetwork) ARouter.getInstance() + .build(MogoServicePaths.PATH_SERVICES_NETWORK) + .navigation(context); + return network.create(V2XApiService.class, netHost); + } + + public static V2XApiService getDevaApiService(Context context) { + if (mDevaApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mDevaApiService == null) { + mDevaApiService = getApiService(context, HostConst.DEVA_HOST); + } + } + } + return mDevaApiService; + } + + public static V2XApiService getDataApiService(Context context) { + if (mDataApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mDataApiService == null) { + mDataApiService = getApiService(context, HostConst.DATA_SERVICE_HOST); + } + } + } + return mDataApiService; + } + + public static V2XApiService getLauncherSnapshotApiService(Context context) { + if (mLauncherSnapshotApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mLauncherSnapshotApiService == null) { + mLauncherSnapshotApiService = getApiService(context, HostConst.LAUNCHER_SNAPSHOT_HOST); + } + } + } + return mLauncherSnapshotApiService; + } + + public static V2XApiService getGeoFenceCarServiceApiService(Context context) { + if (mGeoFenceCarServiceApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mGeoFenceCarServiceApiService == null) { + mGeoFenceCarServiceApiService = getApiService(context, HostConst.GEOFENCE_HOST); + } + } + } + return mGeoFenceCarServiceApiService; + } + + public static V2XApiService getRealtimeLocationApiService(Context context) { + if (mRealtimeLocationApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mRealtimeLocationApiService == null) { + mRealtimeLocationApiService = getApiService(context, HostConst.REALTIME_LOCATION_HOST); + } + } + } + return mRealtimeLocationApiService; + } + + public static V2XApiService getDataServiceApiService(Context context) { + if (mDataServiceApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mDataServiceApiService == null) { + mDataServiceApiService = getApiService(context, HostConst.DATA_SERVICE_HOST); + } + } + } + return mDataServiceApiService; + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java index 8d6bb0e529..e941fcb19e 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java @@ -2,13 +2,10 @@ package com.mogo.module.v2x.network; import android.content.Context; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.data.BaseData; import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; -import com.mogo.service.MogoServicePaths; -import com.mogo.service.network.IMogoNetwork; import com.mogo.utils.network.RequestOptions; import com.mogo.utils.network.utils.GsonUtil; @@ -26,21 +23,18 @@ import io.reactivex.functions.Function; import io.reactivex.schedulers.Schedulers; public class V2XShareNetworkModel { - private final Context mContext; - private V2XApiService mRefreshApiService; private static final String TAG = "V2XShareNetworkModel"; + private final Context mContext; public V2XShareNetworkModel(Context context) { this.mContext = context; - IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context); - this.mRefreshApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost()); } - /* + /** * 两个任务串行 * 1.分享次数,热心指数 * 2.分享列表 - * */ + */ public void getShareEventResponse(int page, int size, V2XRefreshCallback callback) { Observable indexObservable = Observable.create(new ObservableOnSubscribe() { @@ -99,9 +93,9 @@ public class V2XShareNetworkModel { }); } - /* + /** * 热心指数 - * */ + */ public void getShareIndex(V2XRefreshCallback callback) { final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext); HashMap hashMap = new HashMap<>(); @@ -109,7 +103,7 @@ public class V2XShareNetworkModel { builder.append("data", GsonUtil.jsonFromObject(hashMap)); Map parameters = builder.build(); //热心指数 - mRefreshApiService.getEnthusiasmIndex(parameters) + V2XApiServiceFactory.getDevaApiService(mContext).getEnthusiasmIndex(parameters) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SubscribeImpl(RequestOptions.create((mContext))) { @@ -140,9 +134,9 @@ public class V2XShareNetworkModel { } - /* + /** * 分享列表 - * */ + */ public void getShareEventList(int page, int size, V2XRefreshCallback callback) { final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext); @@ -153,7 +147,7 @@ public class V2XShareNetworkModel { builder.append("data", GsonUtil.jsonFromObject(hashMap)); Map parameters = builder.build(); - mRefreshApiService.getShareEventList(parameters) + V2XApiServiceFactory.getDevaApiService(mContext).getShareEventList(parameters) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { From 5a8d67d96b74ebe8ddf200be4f54de899f96ad08 Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 7 Jan 2021 14:02:26 +0800 Subject: [PATCH 25/28] v2x-dns --- .../v2x/network/V2XApiServiceFactory.java | 10 + .../module/v2x/network/V2XRefreshModel.java | 780 +++++++++--------- 2 files changed, 383 insertions(+), 407 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java index 21dfa42287..9d33972c9f 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java @@ -94,4 +94,14 @@ public class V2XApiServiceFactory { } return mDataServiceApiService; } + public static V2XApiService getStrategyPushApiService(Context context) { + if (mDataServiceApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mDataServiceApiService == null) { + mDataServiceApiService = getApiService(context, HostConst.STRATEGY_PUSH_HOST); + } + } + } + return mDataServiceApiService; + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java index f5cbfc54e0..22eb981c46 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java @@ -66,74 +66,70 @@ public class V2XRefreshModel { private void init(Context context) { this.mContext = context; - IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context); - this.mV2XApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost()); +// IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context); +// this.mV2XApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost()); } /** * 刷新地图点数据,同步获取 */ public void querySnapshotAsync(MogoLatLng latLng, int radius, int limit) { - if (mV2XApiService != null) { - final Map query = new ParamsProvider.Builder(mContext).build(); - final RefreshBody refreshBody = new RefreshBody(); - refreshBody.limit = limit; - refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon); - refreshBody.radius = radius; - refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION); - refreshBody.viewPush = true; - query.put("data", GsonUtil.jsonFromObject(refreshBody)); - mV2XApiService.querySnapshotAsync(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - } + final Map query = new ParamsProvider.Builder(mContext).build(); + final RefreshBody refreshBody = new RefreshBody(); + refreshBody.limit = limit; + refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon); + refreshBody.radius = radius; + refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION); + refreshBody.viewPush = true; + query.put("data", GsonUtil.jsonFromObject(refreshBody)); + V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).querySnapshotAsync(query) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - } - }); - } + @Override + public void onError(String message, int code) { + super.onError(message, code); + } + }); } /** * 刷新地图点数据,同步获取 */ public void querySnapshotSync(MogoLatLng latLng, int radius, int limit, final V2XRefreshCallback callback) { - if (mV2XApiService != null) { - final Map query = new ParamsProvider.Builder(mContext).build(); - final RefreshBody refreshBody = new RefreshBody(); - refreshBody.limit = limit; - refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon); - refreshBody.radius = radius; - refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION); - refreshBody.viewPush = true; - query.put("data", GsonUtil.jsonFromObject(refreshBody)); - mV2XApiService.querySnapshotSync(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(MarkerResponse o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map query = new ParamsProvider.Builder(mContext).build(); + final RefreshBody refreshBody = new RefreshBody(); + refreshBody.limit = limit; + refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon); + refreshBody.radius = radius; + refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION); + refreshBody.viewPush = true; + query.put("data", GsonUtil.jsonFromObject(refreshBody)); + V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).querySnapshotSync(query) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(MarkerResponse o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - callback.onFail(message); - } + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + callback.onFail(message); } - }); - } + } + }); } /** @@ -144,34 +140,32 @@ public class V2XRefreshModel { * @param callback 回调 */ public void refreshHeartBeat(String sn, String videoChannel, final V2XRefreshCallback callback) { - if (mV2XApiService != null) { - final Map liveBroadcast = new ParamsProvider.Builder(mContext).build(); - liveBroadcast.put("sn", sn); - liveBroadcast.put("data", GsonUtil.getGson().toJson(new V2XLiveCarBroadcastReq(sn, videoChannel))); - mV2XApiService.refreshHeartBeat(liveBroadcast) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map liveBroadcast = new ParamsProvider.Builder(mContext).build(); + liveBroadcast.put("sn", sn); + liveBroadcast.put("data", GsonUtil.getGson().toJson(new V2XLiveCarBroadcastReq(sn, videoChannel))); + V2XApiServiceFactory.getDataApiService(mContext).refreshHeartBeat(liveBroadcast) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } @@ -181,34 +175,32 @@ public class V2XRefreshModel { * @param callback 回调 */ public void giveLikeLiveVideo(final V2XRefreshCallback callback, String snStr) { - if (mV2XApiService != null) { - Logger.d(V2XConst.MODULE_NAME, "点赞车机:" + snStr); - final Map query = new ParamsProvider.Builder(mContext).build(); - query.put("data", "{\"sn\":" + snStr + "}"); - mV2XApiService.giveLikeLiveVideo(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + Logger.d(V2XConst.MODULE_NAME, "点赞车机:" + snStr); + final Map query = new ParamsProvider.Builder(mContext).build(); + query.put("data", "{\"sn\":" + snStr + "}"); + V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).giveLikeLiveVideo(query) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** @@ -217,35 +209,33 @@ public class V2XRefreshModel { * @param sn 目标车机SN */ public void queryUserInfoBySn(String sn, final V2XRefreshCallback callback) { - if (mV2XApiService != null) { - RequestBody body = RequestBody.create( - okhttp3.MediaType.parse("application/json; charset=utf-8"), - "{\"sn\":\"" + sn + "\"}"); + RequestBody body = RequestBody.create( + okhttp3.MediaType.parse("application/json; charset=utf-8"), + "{\"sn\":\"" + sn + "\"}"); - mV2XApiService.queryUserInfoBySn(body) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XUserInfoRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryUserInfoBySn(body) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XUserInfoRes o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** @@ -255,49 +245,47 @@ public class V2XRefreshModel { */ public void queryNearbyVehicleLiveByLocation( V2XRefreshCallback callback, double lon, double lat) { - if (mV2XApiService != null) { - final Map query = new ParamsProvider.Builder(mContext).build(); + final Map query = new ParamsProvider.Builder(mContext).build(); - StringBuffer dataStr = new StringBuffer(); - dataStr.append("{"); - dataStr.append("\"lon\":"); - dataStr.append(lon); - dataStr.append(","); - dataStr.append("\"lat\":"); - dataStr.append(lat); - dataStr.append(","); - dataStr.append("\"radius\":"); - dataStr.append(0.5); - dataStr.append(","); - dataStr.append("\"size\":"); - dataStr.append(5); - dataStr.append("}"); + StringBuffer dataStr = new StringBuffer(); + dataStr.append("{"); + dataStr.append("\"lon\":"); + dataStr.append(lon); + dataStr.append(","); + dataStr.append("\"lat\":"); + dataStr.append(lat); + dataStr.append(","); + dataStr.append("\"radius\":"); + dataStr.append(0.5); + dataStr.append(","); + dataStr.append("\"size\":"); + dataStr.append(5); + dataStr.append("}"); - query.put("data", dataStr.toString()); - mV2XApiService.queryNearbyVehicleLiveByLocation(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XLiveCarRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + query.put("data", dataStr.toString()); + V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryNearbyVehicleLiveByLocation(query) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XLiveCarRes o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** @@ -306,38 +294,36 @@ public class V2XRefreshModel { * @param callback 回调 */ public void livePush(V2XRefreshCallback callback, String sn, int playType) { - if (mV2XApiService != null) { - final Map query = new ParamsProvider.Builder(mContext).build(); - query.put("data", "{" + - "\"eventId\": \"yycp\"," + - "\"sn\": \"" + sn + "\"," + - "\"type\": \"" + playType + "\"," + - "\"videoChannel\": \"C_1\"" + - "}"); - mV2XApiService.livePush(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XLivePushVoRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map query = new ParamsProvider.Builder(mContext).build(); + query.put("data", "{" + + "\"eventId\": \"yycp\"," + + "\"sn\": \"" + sn + "\"," + + "\"type\": \"" + playType + "\"," + + "\"videoChannel\": \"C_1\"" + + "}"); + V2XApiServiceFactory.getDataApiService(mContext).livePush(query) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XLivePushVoRes o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** @@ -346,40 +332,37 @@ public class V2XRefreshModel { * @param callback */ public void cancelHelpSignal(V2XRefreshCallback callback) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = new StringBuilder() - .append("{") - .append("\"sn\":").append(Utils.getSn()) - .append(",") - .append("\"vehicleType\":") - .append(0) - .append("}").toString(); - map.put("data", json); - mV2XApiService.sendHelpSignal(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map map = new ParamsProvider.Builder(mContext).build(); + String json = new StringBuilder() + .append("{") + .append("\"sn\":").append(Utils.getSn()) + .append(",") + .append("\"vehicleType\":") + .append(0) + .append("}").toString(); + map.put("data", json); + V2XApiServiceFactory.getRealtimeLocationApiService(mContext).sendHelpSignal(map).subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - - } + } + }); } /** @@ -388,33 +371,30 @@ public class V2XRefreshModel { * @param callback */ public void getHelpSignal(V2XRefreshCallback callback) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - map.put("sn", Utils.getSn()); - mV2XApiService.queryHelpSignal(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XSeekHelpRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map map = new ParamsProvider.Builder(mContext).build(); + map.put("sn", Utils.getSn()); + V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryHelpSignal(map).subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XSeekHelpRes o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - - } + } + }); } /** @@ -423,94 +403,88 @@ public class V2XRefreshModel { * @param callback */ public void getMockUserInfos(V2XRefreshCallback callback) { - if (mV2XApiService != null) { - mV2XApiService.getMockUserInfos().subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XDemoUserInfoRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).getMockUserInfos().subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XDemoUserInfoRes o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** * 根据名称获取策略详情 */ public void getStrategyPush(V2XRefreshCallback callback) { - if (mV2XApiService != null) { - mV2XApiService.getStrategyPush().subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XStrategyPushRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + V2XApiServiceFactory.getStrategyPushApiService(mContext).getStrategyPush().subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XStrategyPushRes o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** * 违章地段查询接口 */ public void queryIllegalPark(V2XRefreshCallback callback, double lon, double lat) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = "{\"location\":{\"lat\":" + lat + ",\"lon\":" + lon + "},\"radius\":50}"; + final Map map = new ParamsProvider.Builder(mContext).build(); + String json = "{\"location\":{\"lat\":" + lat + ",\"lon\":" + lon + "},\"radius\":50}"; // String json = "{\"location\":{\"lat\":39.968139,\"lon\":116.380476},\"radius\":1000}"; - map.put("data", json); - mV2XApiService.queryIllegalPark(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(MarkerResponse o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + map.put("data", json); + V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).queryIllegalPark(map).subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(MarkerResponse o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** @@ -520,42 +494,40 @@ public class V2XRefreshModel { String infoId, String poiType, int likeOrDislike) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = new StringBuilder() - .append("{") - .append("\"infoId\":").append(infoId) - .append(",") - .append("\"poiType\":").append(poiType) - .append(",") - .append("\"likeOrdislike\":").append(likeOrDislike) - .append(",") - .append("\"sn\":").append(Utils.getSn()) - .append("}").toString(); - map.put("data", json); - mV2XApiService.addPoiInfoFabulous(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map map = new ParamsProvider.Builder(mContext).build(); + String json = new StringBuilder() + .append("{") + .append("\"infoId\":").append(infoId) + .append(",") + .append("\"poiType\":").append(poiType) + .append(",") + .append("\"likeOrdislike\":").append(likeOrDislike) + .append(",") + .append("\"sn\":").append(Utils.getSn()) + .append("}").toString(); + map.put("data", json); + V2XApiServiceFactory.getDevaApiService(mContext).addPoiInfoFabulous(map).subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } /** @@ -564,29 +536,27 @@ public class V2XRefreshModel { * "enthusiasticSn":"testSn02",响应求助SN */ public void respondingToHelp(String seekHelpSn) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = new StringBuilder() - .append("{") - .append("\"seekHelpSn\":").append(seekHelpSn) - .append(",") - .append("\"enthusiasticSn\":").append(Utils.getSn()) - .append("}").toString(); - map.put("data", json); - mV2XApiService.respondingToHelp(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - } + final Map map = new ParamsProvider.Builder(mContext).build(); + String json = new StringBuilder() + .append("{") + .append("\"seekHelpSn\":").append(seekHelpSn) + .append(",") + .append("\"enthusiasticSn\":").append(Utils.getSn()) + .append("}").toString(); + map.put("data", json); + V2XApiServiceFactory.getDevaApiService(mContext).respondingToHelp(map).subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - } - }); - } + @Override + public void onError(String message, int code) { + super.onError(message, code); + } + }); } /** @@ -598,61 +568,57 @@ public class V2XRefreshModel { public void manualMarkingTrafficJam(String id, int status, String helpId) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = "{" + "\"id\":\"" + id + "\"," + "\"sn\":\"" + Utils.getSn() + "\"," + "\"status\":" + status + "," + "\"helpId\":\"" + helpId + "\"}"; - map.put("data", json); - mV2XApiService.manualMarkingTrafficJam(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - } + final Map map = new ParamsProvider.Builder(mContext).build(); + String json = "{" + "\"id\":\"" + id + "\"," + "\"sn\":\"" + Utils.getSn() + "\"," + "\"status\":" + status + "," + "\"helpId\":\"" + helpId + "\"}"; + map.put("data", json); + V2XApiServiceFactory.getDevaApiService(mContext).manualMarkingTrafficJam(map).subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - } - }); - } + @Override + public void onError(String message, int code) { + super.onError(message, code); + } + }); } public void queryCrossRoadsLive(V2XRefreshCallback callback) { - if (mV2XApiService != null) { - final Map map = new ParamsProvider.Builder(mContext).build(); - MogoLocation lastKnowLocation = V2XServiceManager.getMapService().getSingletonLocationClient(AbsMogoApplication.getApp()).getLastKnowLocation(); - double lat = lastKnowLocation.getLatitude(); - double lon = lastKnowLocation.getLongitude(); - String tmpLat = String.valueOf(lat); - String tmpLon = String.valueOf(lon); - float bearing = lastKnowLocation.getBearing(); - String json = "{\"lat\":" + tmpLat + ",\"lon\":" + tmpLon + ",\"direction\":" + bearing + "}"; - map.put("sn", Utils.getSn()); - map.put("data", json); - mV2XApiService.queryCrossRoadsLive(map) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XLiveCrossRoad o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } + final Map map = new ParamsProvider.Builder(mContext).build(); + MogoLocation lastKnowLocation = V2XServiceManager.getMapService().getSingletonLocationClient(AbsMogoApplication.getApp()).getLastKnowLocation(); + double lat = lastKnowLocation.getLatitude(); + double lon = lastKnowLocation.getLongitude(); + String tmpLat = String.valueOf(lat); + String tmpLon = String.valueOf(lon); + float bearing = lastKnowLocation.getBearing(); + String json = "{\"lat\":" + tmpLat + ",\"lon\":" + tmpLon + ",\"direction\":" + bearing + "}"; + map.put("sn", Utils.getSn()); + map.put("data", json); + V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).queryCrossRoadsLive(map) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { + @Override + public void onSuccess(V2XLiveCrossRoad o) { + super.onSuccess(o); + if (callback != null) { + callback.onSuccess(o); } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); + @Override + public void onError(String message, int code) { + super.onError(message, code); + if (callback != null) { + if (TextUtils.isEmpty(message)) { + message = "网络错误,请稍后重试"; } + callback.onFail(message); } - }); - } + } + }); } } From 8d4048f7ff4311bb33356177cde0840a2fd9367d Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 7 Jan 2021 14:43:56 +0800 Subject: [PATCH 26/28] =?UTF-8?q?[del]=20V2X-DNS=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/module/v2x/network/HttpConstant.kt | 23 ------------------- .../presenter/SurroundingEventPresenter.java | 7 ++---- 2 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/HttpConstant.kt diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/HttpConstant.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/HttpConstant.kt deleted file mode 100644 index ae8d8350b1..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/HttpConstant.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.mogo.module.v2x.network - -import com.mogo.commons.debug.DebugConfig - -class HttpConstant { - - companion object { - const val HOST_DEV = "http://dzt-test.zhidaozhixing.com" - const val HOST_TEST = "http://dzt-test.zhidaozhixing.com" - const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com" - const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com" - - fun getNetHost(): String { - return when (DebugConfig.getNetMode()) { - DebugConfig.NET_MODE_DEV -> HOST_DEV - DebugConfig.NET_MODE_QA -> HOST_TEST - DebugConfig.NET_MODE_DEMO -> HOST_DEMO - else -> HOST_PRODUCT - } - } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java index fdc2662b15..0682dea19c 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java @@ -15,8 +15,7 @@ import com.mogo.map.location.MogoLocation; import com.mogo.module.v2x.entity.panel.Center; import com.mogo.module.v2x.entity.panel.SurroundingRequest; import com.mogo.module.v2x.entity.panel.SurroundingResponse; -import com.mogo.module.v2x.network.HttpConstant; -import com.mogo.module.v2x.network.V2XApiService; +import com.mogo.module.v2x.network.V2XApiServiceFactory; import com.mogo.module.v2x.view.SurroundingEventView; import com.mogo.service.IMogoServiceApis; import com.mogo.service.MogoServicePaths; @@ -38,7 +37,6 @@ public class SurroundingEventPresenter extends Presenter { private Context mContext; private IMogoNetwork mNetWork; private IMogoServiceApis mApis; - private V2XApiService eventApiService; private static final String TAG = "V2XSurroundingFragment"; @@ -48,7 +46,6 @@ public class SurroundingEventPresenter extends Presenter { mNetWork = ((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi(); mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext()); - this.eventApiService = mNetWork.create(V2XApiService.class, HttpConstant.Companion.getNetHost()); } @Override @@ -65,7 +62,7 @@ public class SurroundingEventPresenter extends Presenter { String[] poiTypes = {"10002", "10003", "10006", "10007", "10008", "10010", "10011", "10013", "10015"}; SurroundingRequest request = new SurroundingRequest(center, poiTypes, 5, 300); - eventApiService.getSurroundingEventList(Utils.getSn(), convert(GsonUtil.jsonFromObject(request))) + V2XApiServiceFactory.getDevaApiService(mContext).getSurroundingEventList(Utils.getSn(), convert(GsonUtil.jsonFromObject(request))) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { From 241830b9b8667cdbb170197e63a65ed9131692ce Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 7 Jan 2021 15:03:50 +0800 Subject: [PATCH 27/28] merge --- .../main/java/com/mogo/module/common/constants/HostConst.java | 3 ++- .../main/java/com/mogo/module/share/net/TanluModelData.java | 3 ++- .../main/java/com/mogo/module/share/net/TrafficModelData.java | 3 ++- .../mogo/module/v2x/presenter/SurroundingEventPresenter.java | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java index 9be418c423..c18758f3c9 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/HostConst.java @@ -17,7 +17,8 @@ public class HostConst { public static final String CARLIFE_HOST = "http://dzt-carlife.zhidaozhixing.com"; public static final String STRATEGY_PUSH_HOST = "http://dzt-strategyPush.zhidaozhixing.com"; public static final String TRAVEL_CONDITION_HOST = "http://dzt-travelCondition.zhidaozhixing.com"; - + public static final String TMC_HOST = "http://dzt-tmcServer.zhidaozhixing.com"; + public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com"; public static final String WEBSOCKET_DOMAIN = "dzt-Instant.zhidaozhixing.com"; diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java index 71a6442627..8c113d45fd 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java @@ -11,6 +11,7 @@ import com.mogo.map.search.geo.MogoPoiItem; import com.mogo.map.search.poisearch.IMogoPoiSearch; import com.mogo.map.search.poisearch.MogoPoiResult; import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.share.TanluServiceManager; import com.mogo.module.share.bean.BaseDataCompat; import com.mogo.module.share.bean.Location; @@ -54,7 +55,7 @@ public class TanluModelData { public TanluModelData(Context context) { this.mContext = context; IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context); - mShareApiService = network.create(TanluApiService.class, getBaseUrl()); + mShareApiService = network.create(TanluApiService.class, HostConst.LAUNCHER_SNAPSHOT_HOST); } private String getBaseUrl() { diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java index aab4efa8d0..56d690c607 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java @@ -6,6 +6,7 @@ import com.mogo.commons.data.BaseData; import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.common.entity.RoadTrafficStatus; import com.mogo.module.common.entity.UploadTrafficEntity; import com.mogo.module.share.constant.HttpConstant; @@ -29,7 +30,7 @@ public class TrafficModelData { public TrafficModelData() { IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext()); - mTrafficApiService = network.create(TrafficApiService.class, HttpConstant.getNetHost()); + mTrafficApiService = network.create(TrafficApiService.class, HostConst.TMC_HOST); } /** diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java index 0682dea19c..aa6c8c80cb 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java @@ -12,6 +12,7 @@ import com.mogo.commons.mvp.Presenter; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; import com.mogo.map.location.MogoLocation; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.v2x.entity.panel.Center; import com.mogo.module.v2x.entity.panel.SurroundingRequest; import com.mogo.module.v2x.entity.panel.SurroundingResponse; From a4b693062a5c5827b0debae4d80786a50ea73af7 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Thu, 7 Jan 2021 19:27:44 +0800 Subject: [PATCH 28/28] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/httpdns/mogo/MogoHttpDns.java | 5 ++-- .../module/authorize/model/BaseRepository.kt | 3 ++- .../extensions/entrance/EntranceFragment.java | 2 +- .../entrance/EntrancePresenter.java | 3 +-- .../extensions/userinfo/UserInfoConstant.java | 25 ------------------- .../service/handler/MainLooperHandler.java | 5 +++- .../service/network/ZhidaoRefreshModel.java | 23 ++--------------- 7 files changed, 13 insertions(+), 53 deletions(-) delete mode 100644 modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/UserInfoConstant.java diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 7a2e81152a..a7b02328e2 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -87,13 +87,14 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe @Override public void init(Context context, final IHttpDnsLocationChanged locationChanged) { - httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setDefaultUrl("dzt.zhidaozhixing.com").setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { + // .setDefaultUrl("dzt.zhidaozhixing.com") + httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() { @org.jetbrains.annotations.Nullable @Override public HttpDnsSimpleLocation getCurrentLocation() { HttpSimpleLocation simpleLocation = locationChanged.getLocation(); if (simpleLocation != null) { - return new HttpDnsSimpleLocation(simpleLocation.getCityCode(), simpleLocation.getLat(), simpleLocation.getLon()); + return new HttpDnsSimpleLocation("0734", simpleLocation.getLat(), simpleLocation.getLon()); } return null; } diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/BaseRepository.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/BaseRepository.kt index 2e82101711..6b99ab09f0 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/BaseRepository.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/BaseRepository.kt @@ -3,6 +3,7 @@ package com.mogo.module.authorize.model import com.alibaba.android.arouter.launcher.ARouter import com.mogo.module.authorize.constant.HttpConstant import com.mogo.module.authorize.net.AuthorizeApi +import com.mogo.module.common.constants.HostConst import com.mogo.service.IMogoServiceApis import com.mogo.service.MogoServicePaths @@ -18,6 +19,6 @@ open class BaseRepository { if (mogoService is IMogoServiceApis) { serviceApi = mogoService } - return serviceApi!!.networkApi.createNoCallAdapter(AuthorizeApi::class.java, HttpConstant.getNetHost()) + return serviceApi!!.networkApi.createNoCallAdapter(AuthorizeApi::class.java, HostConst.CHANNEL_MANAGER_HOST) } } \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 850cef0236..63500218e2 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -1046,7 +1046,7 @@ public class EntranceFragment extends MvpFragment { seekHelpGroup.setVisibility(View.VISIBLE); diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java index a740de1184..39e7ea91a1 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java @@ -18,7 +18,6 @@ import com.mogo.module.extensions.bean.CommonConfigResponse; import com.mogo.module.extensions.net.GetConfigApiServices; import com.mogo.module.extensions.net.UserInfoNetApiServices; import com.mogo.module.extensions.userinfo.UserInfo; -import com.mogo.module.extensions.userinfo.UserInfoConstant; import com.mogo.module.extensions.userinfo.UserInfoResponse; import com.mogo.module.extensions.weather.Phenomena; import com.mogo.module.extensions.weather.WeatherCallback; @@ -189,7 +188,7 @@ public class EntrancePresenter extends Presenter implements Weathe params.put("source", "2"); String sign = createSign(params, "JGqZw9"); params.put("sig", sign); - mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver() { + mNetWork.create(UserInfoNetApiServices.class, HostConst.CARLIFE_HOST).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver() { @Override public void onSubscribe(Disposable d) { } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/UserInfoConstant.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/UserInfoConstant.java deleted file mode 100644 index 27f9df7ea8..0000000000 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/UserInfoConstant.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mogo.module.extensions.userinfo; - -import com.mogo.commons.debug.DebugConfig; - -/** - * 个人信息相关常量 - * - * @author tongchenfei - */ -public class UserInfoConstant { - private static final String DEV_BASE_URL = "http://carlife-dev.zhidaohulian.com/"; - private static final String QA_BASE_URL = "http://carlife-test.zhidaohulian.com/"; - private static final String NORMAL_BASE_URL = "http://api.zhidaohulian.com/"; - - public static String getUserInfoBaseUrl(){ - switch (DebugConfig.getNetMode()) { - case DebugConfig.NET_MODE_DEV: - return DEV_BASE_URL; - case DebugConfig.NET_MODE_RELEASE: - return NORMAL_BASE_URL; - default: - return QA_BASE_URL; - } - } -} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java index b506241386..e8a126db0c 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java @@ -9,8 +9,11 @@ import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.storage.SpStorage; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.service.MogoServices; import com.mogo.module.service.ServiceConst; +import com.mogo.module.service.network.RefreshApiService; import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData; import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse; import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo; @@ -86,7 +89,7 @@ abstract class MainLooperHandler extends Handler { final Map< String, Object > query = new ParamsProvider.Builder( AbsMogoApplication.getApp() ).build(); query.put( "data", GsonUtil.jsonFromObject( data ) ); - MogoServices.getInstance().getRefreshModel().getRefreshApiService().calculationNotHomeCompanyDistanceForPush( query ) + MogoApisHandler.getInstance().getApis().getNetworkApi().create(RefreshApiService.class, HostConst.TRAVEL_CONDITION_HOST).calculationNotHomeCompanyDistanceForPush( query ) .subscribeOn( Schedulers.io() ) .observeOn( AndroidSchedulers.mainThread() ) .subscribe( new SubscribeImpl< HomeCompanyDistanceForPushResponse >( RequestOptions.create( AbsMogoApplication.getApp() ) ) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java index 549f2a1f4d..32dec206c1 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/ZhidaoRefreshModel.java @@ -9,6 +9,7 @@ import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; import com.mogo.map.MogoLatLng; +import com.mogo.module.common.constants.HostConst; import com.mogo.module.common.entity.MarkerResponse; import com.mogo.module.service.ServiceConst; import com.mogo.service.MogoServicePaths; @@ -33,34 +34,14 @@ public class ZhidaoRefreshModel { private static final String TAG = "RefreshModel"; - public static final String HOST_DEV = "http://carlife-test.zhidaohulian.com"; - public static final String HOST_TEST = "http://carlife-test.zhidaohulian.com"; - public static final String HOST_DEMO = "http://carlife-test.zhidaohulian.com"; - public static final String HOST_PRODUCT = "https://api.zhidaohulian.com"; - - private final Context mContext; private final ZhidaoApiService mRefreshApiService; public ZhidaoRefreshModel( Context context ) { - this.mContext = context; IMogoNetwork network = ( IMogoNetwork ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_NETWORK ).navigation( context ); - this.mRefreshApiService = network.create( ZhidaoApiService.class, getNetHost() ); + this.mRefreshApiService = network.create( ZhidaoApiService.class, HostConst.CARLIFE_HOST); } public ZhidaoApiService getRefreshApiService() { return mRefreshApiService; } - - public static String getNetHost() { - switch ( DebugConfig.getNetMode() ) { - case DebugConfig.NET_MODE_DEV: - return HOST_DEV; - case DebugConfig.NET_MODE_QA: - return HOST_TEST; - case DebugConfig.NET_MODE_DEMO: - return HOST_DEMO; - default: - return HOST_PRODUCT; - } - } }