httpdns change

This commit is contained in:
zhongchao
2022-08-17 14:29:10 +08:00
parent e7637c9540
commit 617b342910
3 changed files with 35 additions and 21 deletions

View File

@@ -132,10 +132,8 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
// todo 使用旧链路
// clientConfig.setUseOriginSocket(true);
clientConfig.iHttpDnsCurrentLocation = object : IHttpDnsCurrentLocation {
override fun getCurrentLocation(): HttpDnsSimpleLocation? {
override fun getCurrentLocation(): HttpDnsSimpleLocation {
val envConfig = EnvChangeManager.getEnvConfig()
if (envConfig != null) {
return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
@@ -147,13 +145,20 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
mogoLocation = locationClient.lastKnowLocation
}
val httpDnsSimpleLocation =
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0
) {
HttpDnsSimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) {
if(mogoLocation.cityCode.isNullOrEmpty() && !GDLocationClient.getInstance(context).lastCityCode.isNullOrEmpty()){
HttpDnsSimpleLocation(
GDLocationClient.getInstance(context).lastCityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
}else{
HttpDnsSimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
}
} else {
val ciyCode =
SharedPrefsMgr.getInstance(
@@ -178,7 +183,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// e.printStackTrace();
HttpDnsSimpleLocation("010", 1.0, 1.0)
}
//CallerLogger.INSTANCE.d(M_HMI + TAG, "使用缓存GPS信息" + httpDnsSimpleLocation);
}
return httpDnsSimpleLocation
}