修改升级接口
This commit is contained in:
@@ -11,7 +11,7 @@ import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 绑定车辆
|
||||
* @description 升级
|
||||
* @since: 6/20/22
|
||||
*/
|
||||
public interface UpgradeApiService {
|
||||
@@ -21,7 +21,8 @@ public interface UpgradeApiService {
|
||||
* @return {@link UpgradeAppInfo}
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("unify/selectResources")
|
||||
Observable<UpgradeAppInfo> getUpgradeInfo(@Query("resources") String res, @Body RequestBody requestBody);
|
||||
@POST("/eagleEye-mis/config/versionInfo")
|
||||
// Observable<UpgradeAppInfo> getUpgradeInfo(@Query("resources") String res, @Body RequestBody requestBody);
|
||||
Observable<UpgradeAppInfo> getUpgradeInfo(@Body RequestBody requestBody);
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import okhttp3.RequestBody;
|
||||
public class UpgradeAppNetWorkManager {
|
||||
private static volatile UpgradeAppNetWorkManager requestNoticeManager;
|
||||
private final UpgradeApiService mUpgradeApiService;
|
||||
private static final String TAG = "UpgradeAppNetWorkManager";
|
||||
private static final String TAG = "Upgrade";
|
||||
|
||||
|
||||
private UpgradeAppNetWorkManager() {
|
||||
@@ -58,18 +58,16 @@ public class UpgradeAppNetWorkManager {
|
||||
/**
|
||||
* 获取app升级信息
|
||||
*/
|
||||
public void getAppUpgradeInfo(Context context, String screenType, String carType) {
|
||||
public void getAppUpgradeInfo(Context context, String mac, String screenType) {
|
||||
String sn = "X20202203105S688HZ";
|
||||
// int versionCode = 2070000;
|
||||
// String versionName = "2.7.0";
|
||||
|
||||
// String mac = "48:b0:2d:3a:bc:78";
|
||||
// String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
int versionCode = AppUtils.getAppVersionCode();
|
||||
String versionName = AppUtils.getAppVersionName();
|
||||
|
||||
UpgradeAppRequest request = new UpgradeAppRequest(sn, versionCode, versionName, screenType, carType);
|
||||
//TODO 不能写死
|
||||
UpgradeAppRequest request = new UpgradeAppRequest(sn, mac, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mUpgradeApiService.getUpgradeInfo("apps_control", requestBody)
|
||||
mUpgradeApiService.getUpgradeInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UpgradeAppInfo>() {
|
||||
@@ -79,18 +77,20 @@ public class UpgradeAppNetWorkManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull UpgradeAppInfo info) {
|
||||
if (info != null && info.getData() != null && info.getData().size() > 0) {
|
||||
CallerLogger.INSTANCE.d(TAG, "UpgradeAppInfo url = " + info.getData().get(0).getApp_url() + "----code = " + info.getData().get(0).getVersion_code());
|
||||
// if (info.getData().get(0).getVersion_code() > versionCode) {
|
||||
|
||||
CallerHmiManager.INSTANCE.showUpgradeDialog(info.getData().get(0).getApp_url().substring(info.getData().get(0).getApp_url().lastIndexOf("/")+1), info.getData().get(0).getApp_url());
|
||||
// }
|
||||
if (info != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "UpgradeAppInfo url = " + info.result.getAppUrl() + "----code = " + info.result.getVersionCode());
|
||||
Log.d(TAG, "UpgradeAppInfo url = " + info.result.getAppUrl() + "----code = " + info.result.getVersionCode() + "--versionCode =" + versionCode + "--info.result = " + info.result);
|
||||
if (info.result.getVersionCode() > versionCode) {
|
||||
CallerHmiManager.INSTANCE.showUpgradeDialog(info.result.getAppUrl().substring(info.result.getAppUrl().lastIndexOf("/")+1), info.result.getAppUrl());
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "onNext info == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "UpgradeAppInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,18 +6,15 @@ package com.mogo.eagle.core.function.appupgrade.network;
|
||||
* @since: 11/15/21
|
||||
*/
|
||||
public class UpgradeAppRequest {
|
||||
private String mac;
|
||||
private String sn;
|
||||
private int version_code;
|
||||
private String version_name;
|
||||
private String screen_type;
|
||||
private String car_type;
|
||||
private String screenType;
|
||||
|
||||
public UpgradeAppRequest( String sn, int versionCode, String versionName, String type, String carType) {
|
||||
|
||||
public UpgradeAppRequest( String sn, String mac, String screenType) {
|
||||
this.sn = sn;
|
||||
this.version_code = versionCode;
|
||||
this.version_name = versionName;
|
||||
this.screen_type = type;
|
||||
this.car_type = carType;
|
||||
this.mac = mac;
|
||||
this.screenType = screenType;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
@@ -28,46 +25,20 @@ public class UpgradeAppRequest {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getVersion_code() {
|
||||
return version_code;
|
||||
public String getMac() {
|
||||
return mac;
|
||||
}
|
||||
|
||||
public void setVersion_code(int version_code) {
|
||||
this.version_code = version_code;
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getVersion_name() {
|
||||
return version_name;
|
||||
public String getScreenType() {
|
||||
return screenType;
|
||||
}
|
||||
|
||||
public void setVersion_name(String version_name) {
|
||||
this.version_name = version_name;
|
||||
public void setScreenType(String screenType) {
|
||||
this.screenType = screenType;
|
||||
}
|
||||
|
||||
public String getScreen_type() {
|
||||
return screen_type;
|
||||
}
|
||||
|
||||
public void setScreen_type(String screen_type) {
|
||||
this.screen_type = screen_type;
|
||||
}
|
||||
|
||||
public String getCar_type() {
|
||||
return car_type;
|
||||
}
|
||||
|
||||
public void setCar_type(String car_type) {
|
||||
this.car_type = car_type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UpgradeAppRequest{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", version_code=" + version_code +
|
||||
", version_name='" + version_name + '\'' +
|
||||
", screen_type='" + screen_type + '\'' +
|
||||
", car_type='" + car_type + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,10 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 以后可能废弃
|
||||
* @return
|
||||
*/
|
||||
private int getScreenType() {
|
||||
int screenType = -1;
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
@@ -142,12 +146,34 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
|
||||
}
|
||||
|
||||
private String getCarScreenType() {
|
||||
String screenType = "";
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "1"; //taxi乘客端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "2"; //taxi司机端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "3"; //bus 乘客端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "4"; //bus 司机端
|
||||
}
|
||||
|
||||
return screenType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询app是否需要升级
|
||||
*/
|
||||
@Override
|
||||
public void queryAppUpgrade() {
|
||||
UpgradeAppNetWorkManager.getInstance().getAppUpgradeInfo(mContext, String.valueOf(getScreenType()), String.valueOf(getCarType()));
|
||||
Log.d("Upgrade", "mac = " + mAddress + "---type = " + getCarScreenType() );
|
||||
UpgradeAppNetWorkManager.getInstance().getAppUpgradeInfo(mContext, mAddress, getCarScreenType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,140 +8,100 @@ import java.io.Serializable;
|
||||
* @since 6/21/22
|
||||
*/
|
||||
public class AppInfo implements Serializable {
|
||||
private IdInfo _id;
|
||||
private int bk_inst_id;
|
||||
private String bk_inst_name;
|
||||
private String bk_supplier_account;
|
||||
private String screen_type; //1,司机屏,2乘客屏
|
||||
private String sn;
|
||||
private String last_time;
|
||||
private String app_url;
|
||||
private String bk_obj_id;
|
||||
private int version_code;
|
||||
private String version_name;
|
||||
private String create_time;
|
||||
private String car_type;
|
||||
private String appUrl;
|
||||
private int versionCode;
|
||||
private String versionName;
|
||||
private String screenType;
|
||||
private String installTitle;
|
||||
private String installContent;
|
||||
private String installType;
|
||||
private String beginTime;
|
||||
private String endTime;
|
||||
|
||||
public IdInfo get_id() {
|
||||
return _id;
|
||||
public String getAppUrl() {
|
||||
return appUrl;
|
||||
}
|
||||
|
||||
public void set_id(IdInfo _id) {
|
||||
this._id = _id;
|
||||
public void setAppUrl(String appUrl) {
|
||||
this.appUrl = appUrl;
|
||||
}
|
||||
|
||||
public int getBk_inst_id() {
|
||||
return bk_inst_id;
|
||||
public int getVersionCode() {
|
||||
return versionCode;
|
||||
}
|
||||
|
||||
public void setBk_inst_id(int bk_inst_id) {
|
||||
this.bk_inst_id = bk_inst_id;
|
||||
public void setVersionCode(int versionCode) {
|
||||
this.versionCode = versionCode;
|
||||
}
|
||||
|
||||
public String getBk_inst_name() {
|
||||
return bk_inst_name;
|
||||
public String getVersionName() {
|
||||
return versionName;
|
||||
}
|
||||
|
||||
public void setBk_inst_name(String bk_inst_name) {
|
||||
this.bk_inst_name = bk_inst_name;
|
||||
public void setVersionName(String versionName) {
|
||||
this.versionName = versionName;
|
||||
}
|
||||
|
||||
public String getBk_supplier_account() {
|
||||
return bk_supplier_account;
|
||||
public String getScreenType() {
|
||||
return screenType;
|
||||
}
|
||||
|
||||
public void setBk_supplier_account(String bk_supplier_account) {
|
||||
this.bk_supplier_account = bk_supplier_account;
|
||||
public void setScreenType(String screenType) {
|
||||
this.screenType = screenType;
|
||||
}
|
||||
|
||||
public String getScreen_type() {
|
||||
return screen_type;
|
||||
public String getInstallTitle() {
|
||||
return installTitle;
|
||||
}
|
||||
|
||||
public void setScreen_type(String screen_type) {
|
||||
this.screen_type = screen_type;
|
||||
public void setInstallTitle(String installTitle) {
|
||||
this.installTitle = installTitle;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
public String getInstallContent() {
|
||||
return installContent;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
public void setInstallContent(String installContent) {
|
||||
this.installContent = installContent;
|
||||
}
|
||||
|
||||
public String getApp_url() {
|
||||
return app_url;
|
||||
public String getInstallType() {
|
||||
return installType;
|
||||
}
|
||||
|
||||
public void setApp_url(String app_url) {
|
||||
this.app_url = app_url;
|
||||
public void setInstallType(String installType) {
|
||||
this.installType = installType;
|
||||
}
|
||||
|
||||
public String getBk_obj_id() {
|
||||
return bk_obj_id;
|
||||
public String getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBk_obj_id(String bk_obj_id) {
|
||||
this.bk_obj_id = bk_obj_id;
|
||||
public void setBeginTime(String beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public int getVersion_code() {
|
||||
return version_code;
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setVersion_code(int version_code) {
|
||||
this.version_code = version_code;
|
||||
}
|
||||
|
||||
public String getVersion_name() {
|
||||
return version_name;
|
||||
}
|
||||
|
||||
public void setVersion_name(String version_name) {
|
||||
this.version_name = version_name;
|
||||
}
|
||||
|
||||
public String getLast_time() {
|
||||
return last_time;
|
||||
}
|
||||
|
||||
public void setLast_time(String last_time) {
|
||||
this.last_time = last_time;
|
||||
}
|
||||
|
||||
public String getCreate_time() {
|
||||
return create_time;
|
||||
}
|
||||
|
||||
public void setCreate_time(String create_time) {
|
||||
this.create_time = create_time;
|
||||
}
|
||||
|
||||
public String getCar_type() {
|
||||
return car_type;
|
||||
}
|
||||
|
||||
public void setCar_type(String car_type) {
|
||||
this.car_type = car_type;
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AppInfo{" +
|
||||
"_id=" + _id +
|
||||
", bk_inst_id=" + bk_inst_id +
|
||||
", bk_inst_name='" + bk_inst_name + '\'' +
|
||||
", bk_supplier_account='" + bk_supplier_account + '\'' +
|
||||
", screen_type='" + screen_type + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", last_time='" + last_time + '\'' +
|
||||
", app_url='" + app_url + '\'' +
|
||||
", bk_obj_id='" + bk_obj_id + '\'' +
|
||||
", version_code=" + version_code +
|
||||
", version_name='" + version_name + '\'' +
|
||||
", create_time='" + create_time + '\'' +
|
||||
", car_type='" + car_type + '\'' +
|
||||
"appUrl='" + appUrl + '\'' +
|
||||
", versionCode=" + versionCode +
|
||||
", versionName='" + versionName + '\'' +
|
||||
", screenType='" + screenType + '\'' +
|
||||
", installTitle='" + installTitle + '\'' +
|
||||
", installContent='" + installContent + '\'' +
|
||||
", installType='" + installType + '\'' +
|
||||
", beginTime='" + beginTime + '\'' +
|
||||
", endTime='" + endTime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,20 +10,26 @@ import java.util.ArrayList;
|
||||
* @since: 6/21/22
|
||||
*/
|
||||
public class UpgradeAppInfo extends BaseData {
|
||||
public ArrayList<AppInfo> data;
|
||||
// public ArrayList<AppInfo> data;
|
||||
//
|
||||
// public ArrayList<AppInfo> getData() {
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// public void setData(ArrayList<AppInfo> data) {
|
||||
// this.data = data;
|
||||
// }
|
||||
|
||||
public ArrayList<AppInfo> getData() {
|
||||
return data;
|
||||
}
|
||||
public AppInfo result;
|
||||
|
||||
public void setData(ArrayList<AppInfo> data) {
|
||||
this.data = data;
|
||||
public void setResult(AppInfo data) {
|
||||
this.result = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UpgradeAppInfo{" +
|
||||
"data=" + data +
|
||||
"result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public class HostConst {
|
||||
public static final String BINDING_SN_HOST = "https://mygateway.zhidaozhixing.com/cmdbapi/"; //中台提供的接口服务
|
||||
public static final String BINDING_SN_HOST_TEST = "https://mygateway.zhidaozhixing.com/cmdbapitest/"; //中台提供的接口服务测试
|
||||
|
||||
public static final String UPGRADE_APP_HOST = "http://10.0.200.12:32423?/";
|
||||
// public static final String UPGRADE_APP_HOST = "http://10.0.200.12:32423?/";
|
||||
public static final String UPGRADE_APP_HOST = "https://eagle-qa.zhidaozhixing.com/";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user