package com.xw.yunwei.model import com.google.gson.annotations.SerializedName import org.json.JSONObject /** * 应用版本更新信息数据类 */ data class AppVersionModel( /** * 安卓软件包下载地址 */ @SerializedName("androidFile") val androidFile: String? = null, /** * iOS软件包下载地址 */ @SerializedName("iosFile") val iosFile: String? = null, /** * 版本更新说明 */ @SerializedName("updateDescription") val updateDescription: String? = null, /** * 软件版本号 */ @SerializedName("version") val version: String? = null, /** * 版本号 判断是否需要升级 */ @SerializedName("versionCode") val versionCode: Int? = null, /** * 是否强制更新 0-否 1-是 */ @SerializedName("forceUpdateFlag") val forceUpdateFlag: Int? = null, ) { //获取下载路径 fun getDownloadUrl(): String? { return try { JSONObject(androidFile ?: "").optString("url") } catch (e: Exception) { e.printStackTrace() null } } }