|
|
|
@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.DeviceSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.ManageDeviceSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.device.support.DeviceRegister;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
@ -109,5 +110,35 @@ public class ManageAppServiceImp implements ManageAppService {
|
|
|
|
|
return manageDeviceTokenMapper.findByDevId(dev_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getNewVersion(JSONObject device) {
|
|
|
|
|
String version = device.getString("version");
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
manageDeviceSupport.findRegister(clientType);
|
|
|
|
|
String newAppVersion = PlatformEnvironment.getEnv().getNewVersion(clientType);
|
|
|
|
|
Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType);
|
|
|
|
|
String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType);
|
|
|
|
|
int update_type = 0;// 0:不更新 1:更新 2:强制更新
|
|
|
|
|
String[] oldVersion = version.split("\\.");
|
|
|
|
|
String[] newVersion = newAppVersion.split("\\.");
|
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
res.put("update_content", updateContent);
|
|
|
|
|
for (int i = 0; i < newVersion.length; i++) {
|
|
|
|
|
if (Integer.valueOf(newVersion[i]) > Integer.valueOf(oldVersion[i])) {
|
|
|
|
|
update_type = 1;
|
|
|
|
|
if (isUpdate) {
|
|
|
|
|
update_type = 2;
|
|
|
|
|
}
|
|
|
|
|
res.put("update_type", update_type);
|
|
|
|
|
return res;
|
|
|
|
|
} else if (Integer.valueOf(newVersion[i]) < Integer.valueOf(oldVersion[i])) {
|
|
|
|
|
res.put("update_type", update_type);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
res.put("update_type", update_type);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|