public ResultInfo <AppDownloadInfo> SelectPackageInformation(RequestParam <RequestVersion> reqst) { ResultInfo <AppDownloadInfo> result = new ResultInfo <AppDownloadInfo>("99999"); using (B_AppUpdatePackage bll = new B_AppUpdatePackage()) { var model = bll.GetLastModel(reqst.body.Platform, reqst.body.Channel, reqst.body.DeviceVersion.Trim()); if (model != null) { //if (model.Version.Trim() == reqst.body.DeviceVersion.Trim()) if (!Utils.IsNewAppVersion(reqst.body.DeviceVersion.Trim(), model.Version.Trim())) { result.code = "0"; result.message = "你已是最新版本,无需更新!"; result.body = null; return(result); } result.code = "1"; result.body = new AppDownloadInfo(); result.body.Channel = model.Channel; result.body.Code = model.Code; result.body.UpdateLevel = model.UpdateLevel; result.body.Description = model.Description; result.body.FileName = model.Code + ".apk"; result.body.CreateTime = model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"); result.body.IsEnable = Convert.ToBoolean(model.IsEnable); result.body.ValideCode = model.ValideCode; result.body.Version = model.Version; } } return(result); }
public ActionResult GetAndroidAPP() { B_AppUpdatePackage bll = new B_AppUpdatePackage(); var cModel = bll.GetLastModel("Android", "CLT", "0.1"); var model = bll.GetDownloadModel(cModel.Code); string androidUrl = string.Empty; if (model != null) { try { string filePath = Settings.Instance.GetWebsitePhysicalRootPath + "\\" + model.VirtualPath.Replace("/", "\\"); FileStream fs = new FileStream(filePath, FileMode.Open); return(File(fs, "application/octet-stream", model.Code + ".apk")); } catch (Exception ex) { LogInfo.WriteLog("Android 服务器下载失败,未找到文件路径: " + ex.Message); return(Content("Android 最新版本还没有发布!")); } } return(View()); }
public ActionResult Download(string code = "") { HttpResponseMessage result = null; if (string.IsNullOrWhiteSpace(code)) { return(View()); } using (B_AppUpdatePackage bll = new B_AppUpdatePackage()) { var model = bll.GetDownloadModel(code); if (model != null) { string filePath = Settings.Instance.GetWebsitePhysicalRootPath + "\\" + model.VirtualPath.Replace("/", "\\"); return(File(filePath, "application/octet-stream", model.Code + ".apk")); } else { return(View()); } } return(View()); }