Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
# Conflicts: # app/src/main/java/com/mogo/launcher/MogoApplication.java
This commit is contained in:
@@ -22,6 +22,6 @@ public interface RefreshApiService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData( @QueryMap Map< String, Object > params,
|
||||
Observable< BaseData > refreshData(
|
||||
@FieldMap Map< String, Object > parameters );
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
*/
|
||||
public class RefreshBody {
|
||||
|
||||
public List< String > dataType = new ArrayList<>();
|
||||
// public List< String > dataType = new ArrayList<>();
|
||||
public int limit = 50;// 请求数量
|
||||
public int radius = 2_000; // 地理围栏半径(米)
|
||||
public LatLon location;
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
@@ -28,13 +29,28 @@ import io.reactivex.schedulers.Schedulers;
|
||||
*/
|
||||
public class RefreshModel {
|
||||
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
|
||||
private final Context mContext;
|
||||
private 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, "http://www.baidu.com/" );
|
||||
this.mRefreshApiService = network.create( RefreshApiService.class, getNetHost() );
|
||||
}
|
||||
|
||||
private String getNetHost() {
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return HOST_TEST;
|
||||
default:
|
||||
return HOST_PRODUCT;
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshData( MogoLatLng latLng, int radius, final RefreshCallback callback ) {
|
||||
@@ -47,7 +63,7 @@ public class RefreshModel {
|
||||
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
|
||||
refreshBody.radius = radius;
|
||||
field.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
|
||||
mRefreshApiService.refreshData( query, field )
|
||||
mRefreshApiService.refreshData( field )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
|
||||
|
||||
Reference in New Issue
Block a user