public string ConvertPayJson(string appId, string PartnerId, PayRequestInfo req) { SiteSettings siteSettings = HiContext.Current.SiteSettings; AppVersionRecordInfo latestAppVersionRecord = APPHelper.GetLatestAppVersionRecord("android"); string text = ""; if (latestAppVersionRecord == null || latestAppVersionRecord.Version.ToDecimal_MoreDot(0) > 3.3m) { text = "{"; text = text + "\"appid\":\"" + appId + "\","; text = text + "\"noncestr\":\"" + req.nonceStr + "\","; text += "\"package\":\"Sign=WXPay\","; text = text + "\"partnerid\":\"" + PartnerId + "\","; text = text + "\"prepayid\":\"" + req.prepayid + "\","; text = text + "\"timestamp\":" + req.timeStamp + ","; text = text + "\"sign\":\"" + req.paySign + "\""; return(text + "}"); } text = "{"; text = text + "\"partnerId\":\"" + PartnerId + "\","; text = text + "\"prepayId\":\"" + req.prepayid + "\","; text = text + "\"nonceStr\":\"" + req.nonceStr + "\","; text = text + "\"timeStamp\":\"" + req.timeStamp + "\","; text = text + "\"sign\":\"" + req.paySign + "\""; return(text + "}"); }
private void btnUpoad_Click(object sender, System.EventArgs e) { if (!this.fileUpload.HasFile) { this.ShowMsg("请先选择一个数据包文件", false); return; } if (this.fileUpload.PostedFile.ContentLength == 0 || (this.fileUpload.PostedFile.ContentType != "application/x-zip-compressed" && this.fileUpload.PostedFile.ContentType != "application/zip" && this.fileUpload.PostedFile.ContentType != "application/octet-stream")) { this.ShowMsg("请上传正确的数据包文件", false); return; } string savedPath = this.Page.Request.MapPath("~/storage/data/app/android"); string fileName = System.IO.Path.GetFileName(this.fileUpload.PostedFile.FileName); string fullFileName = System.IO.Path.Combine(savedPath, fileName); this.fileUpload.PostedFile.SaveAs(fullFileName); System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(savedPath); using (ZipFile zipFile = ZipFile.Read(System.IO.Path.Combine(directoryInfo.FullName, fileName))) { foreach (ZipEntry current in zipFile) { current.Extract(directoryInfo.FullName, ExtractExistingFileAction.OverwriteSilently); } } System.IO.File.Delete(fullFileName); this.LoadVersion(); AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetLatestAppVersionRecord("android"); if (appVersionRecordInfo == null) { appVersionRecordInfo = new AppVersionRecordInfo(); appVersionRecordInfo.Device = "android"; appVersionRecordInfo.Version = 0.00m; } decimal num = 1.00m; decimal.TryParse(this.litVersion.Text, out num); if (num > appVersionRecordInfo.Version) { bool isForcibleUpgrade = false; bool.TryParse(this.hidIsForcibleUpgrade.Value, out isForcibleUpgrade); appVersionRecordInfo.AppName = this.litAppName.Text; appVersionRecordInfo.AppPackageName = this.litApkName.Text; appVersionRecordInfo.VersionName = this.litVersionName.Text; appVersionRecordInfo.Version = num; appVersionRecordInfo.IsForcibleUpgrade = isForcibleUpgrade; appVersionRecordInfo.Description = this.litDescription.Text; appVersionRecordInfo.UpgradeUrl = this.litUpgradeUrl.Text; appVersionRecordInfo.UpgradeInfoUrl = this.litUpgradeInfoUrl.Text; APPHelper.AddAppVersionRecord(appVersionRecordInfo); } this.ShowMsg("上传成功!", true); }
public IHttpActionResult UpgradeIos(string accessToken, int channel, int platform, string ver) { Logger.WriterLogger("Common.UpgradeIos, Params: " + string.Format("accessToken={0}&channel={1}&platform={2}&ver={3}", accessToken, channel, platform, ver), LoggerType.Info); decimal resultver = Util.ConvertVer(ver) * 1.00m / 100; AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetLatestAppVersionRecordOrderById("ios"); if (appVersionRecordInfo != null) { IosVersionResult result = new IosVersionResult(); result.VerName = appVersionRecordInfo.Version.ToString("0.00").Replace(".", ""); result.Descript = appVersionRecordInfo.Description; //result.IsForceUpgrade = appVersionRecordInfo.IsForcibleUpgrade; result.IsForceUpgrade = APPHelper.IsForcibleUpgradeByPreviousVersion(resultver, "ios"); return(base.JsonActionResult(new StandardResult <IosVersionResult>() { code = 0, msg = "", data = result })); } else { return(base.JsonActionResult(new StandardResult <string>() { code = 1, msg = "未获取到ios版本信息", data = null })); } }
public string GetGoodsListJson(DbQueryResult GoodsTable, int ClientType) { AppVersionRecordInfo latestAppVersionRecord = APPHelper.GetLatestAppVersionRecord("android"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("\"list\":["); DataTable data = GoodsTable.Data; for (int i = 0; i < data.Rows.Count; i++) { stringBuilder.Append("{"); stringBuilder.Append("\"item_id\":\"" + data.Rows[i]["ProductId"] + "\","); stringBuilder.Append("\"title\":\"" + data.Rows[i]["ProductName"] + "\","); stringBuilder.Append("\"price\":\"" + data.Rows[i]["SalePrice"].ToDecimal(0).F2ToString("f2") + "\","); stringBuilder.Append("\"original_price\":\"" + data.Rows[i]["MarketPrice"].ToDecimal(0).F2ToString("f2") + "\","); stringBuilder.Append("\"create_time\":\"" + Convert.ToDateTime(data.Rows[i]["AddedDate"]).ToString("yyyy-MM-dd HH:mm:ss") + "\","); switch (ClientType) { case 2: if (latestAppVersionRecord == null || latestAppVersionRecord.Version.ToDecimal_MoreDot(0) > 3.3m) { stringBuilder.Append("\"link\":\"" + HiContext.Current.HostPath + "/productdetail.html?id=" + data.Rows[i]["ProductId"] + "\","); } else { stringBuilder.Append("\"link\":\"hishop://webShowProduct/null/" + data.Rows[i]["ProductId"] + "\","); } break; case 1: stringBuilder.Append("\"link\":\"/ProductDetails?productId=" + data.Rows[i]["ProductId"] + "\","); break; case 4: stringBuilder.Append("\"link\":\"../productdetail/productdetail?id=" + data.Rows[i]["ProductId"] + "\","); break; default: stringBuilder.Append("\"link\":\"javascript:showProductDetail(" + data.Rows[i]["ProductId"] + ")\","); break; } string empty = string.Empty; empty = ((!string.IsNullOrEmpty(data.Rows[i]["ThumbnailUrl310"].ToString())) ? data.Rows[i]["ThumbnailUrl310"].ToString() : SettingsManager.GetMasterSettings().DefaultProductImage); if ((empty.IndexOf("http") < 0 || empty.IndexOf("https") < 0) && ClientType == 4) { empty = Globals.FullPath(empty); } stringBuilder.Append("\"pic\":\"" + empty + "\","); stringBuilder.Append("\"is_compress\":0"); stringBuilder.Append("},"); } string str = stringBuilder.ToString().TrimEnd(','); return(str + "]"); }
private void LoadVersion() { AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetAppVersionById(this.Id); if (appVersionRecordInfo != null) { this.txtVersion.Text = appVersionRecordInfo.Version.ToString("0.00"); this.txtDescription.Text = appVersionRecordInfo.Description; this.txtUpgradeUrl.Text = appVersionRecordInfo.UpgradeUrl; this.ChkisForceUpgrade.Checked = appVersionRecordInfo.IsForcibleUpgrade; } }
public AppVersionRecordInfo GetLatestAppVersionRecordOrderById(string device) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT TOP 1 * FROM Ecshop_AppVersionRecords WHERE Device = @Device ORDER BY Id DESC"); this.database.AddInParameter(sqlStringCommand, "Device", DbType.String, device); AppVersionRecordInfo result = null; using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToModel <AppVersionRecordInfo>(dataReader); } return(result); }
public AppVersionRecordInfo GetAppVersionById(int id) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT TOP 1 * FROM Ecshop_AppVersionRecords WHERE Id = @Id "); this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, id); AppVersionRecordInfo result = null; using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToModel <AppVersionRecordInfo>(dataReader); } return(result); }
public AppVersionRecordInfo GetLatestAppVersionRecord(string device) { DbCommand sqlStringCommand = base.database.GetSqlStringCommand("SELECT TOP 1 * FROM Hishop_AppVersionRecords WHERE Device = @Device ORDER BY Version DESC"); base.database.AddInParameter(sqlStringCommand, "Device", DbType.String, device); AppVersionRecordInfo result = null; using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand)) { result = DataHelper.ReaderToModel <AppVersionRecordInfo>(objReader); } return(result); }
public bool AddAppVersionRecord(AppVersionRecordInfo appVersionRecord) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Ecshop_AppVersionRecords(Device,Version, Description, IsForcibleUpgrade, UpgradeUrl, VersionName, UpgradeInfoUrl, AppName, AppPackageName) VALUES(@Device,@Version, @Description, @IsForcibleUpgrade, @UpgradeUrl, @VersionName, @UpgradeInfoUrl, @AppName, @AppPackageName)"); this.database.AddInParameter(sqlStringCommand, "Device", DbType.String, appVersionRecord.Device); this.database.AddInParameter(sqlStringCommand, "Version", DbType.Decimal, appVersionRecord.Version); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, appVersionRecord.Description); this.database.AddInParameter(sqlStringCommand, "IsForcibleUpgrade", DbType.Boolean, appVersionRecord.IsForcibleUpgrade); this.database.AddInParameter(sqlStringCommand, "UpgradeUrl", DbType.String, appVersionRecord.UpgradeUrl); this.database.AddInParameter(sqlStringCommand, "VersionName", DbType.String, appVersionRecord.VersionName); this.database.AddInParameter(sqlStringCommand, "UpgradeInfoUrl", DbType.String, appVersionRecord.UpgradeInfoUrl); this.database.AddInParameter(sqlStringCommand, "AppName", DbType.String, appVersionRecord.AppName); this.database.AddInParameter(sqlStringCommand, "AppPackageName", DbType.String, appVersionRecord.AppPackageName); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
private AppAndroidVersionResult GetAndroidLatestVersion() { AppAndroidVersionResult result = new AppAndroidVersionResult(); AppVersionRecordInfo appVersion = APPHelper.GetLatestAppVersionRecordOrderById("android"); if (appVersion != null) { result = new AppAndroidVersionResult(); result.appname = appVersion.AppName; result.apkname = appVersion.AppPackageName; result.verName = appVersion.VersionName; result.verCode = (int)appVersion.Version; result.url = Util.AppendImageHost(appVersion.UpgradeUrl); result.infoUrl = Util.AppendImageHost(appVersion.UpgradeInfoUrl); // 打开文件 ///Storage/data/app/android/haimylife_v10.1.txt result.info = ""; result.IsForcibleUpgrade = appVersion.IsForcibleUpgrade; result.info = appVersion.Description; //string upgradeInfoPath = HostingEnvironment.MapPath(appVersion.UpgradeInfoUrl); //if (File.Exists(upgradeInfoPath)) //{ // try // { // using (var fs = new FileStream(upgradeInfoPath, FileMode.Open, FileAccess.Read)) // { // int len = (int)fs.Length; // byte[] bytes = new byte[len]; // int r = fs.Read(bytes, 0, bytes.Length); // result.info = System.Text.Encoding.UTF8.GetString(bytes); // } // } // catch(Exception ex) // { // Logger.WriterLogger(ex.Message); // } //} } return(result); }
public bool UpdateAppVersionRecord(AppVersionRecordInfo appVersionRecord) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("Update Ecshop_AppVersionRecords set Device=@Device,Version=@Version,Description=@Description, IsForcibleUpgrade=@IsForcibleUpgrade, UpgradeUrl=@UpgradeUrl, VersionName=@VersionName, UpgradeInfoUrl=@UpgradeInfoUrl, AppName=@AppName, AppPackageName=@AppPackageName where Id=@Id "); this.database.AddInParameter(sqlStringCommand, "Device", DbType.String, appVersionRecord.Device); this.database.AddInParameter(sqlStringCommand, "Version", DbType.Decimal, appVersionRecord.Version); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, appVersionRecord.Description); this.database.AddInParameter(sqlStringCommand, "IsForcibleUpgrade", DbType.Boolean, appVersionRecord.IsForcibleUpgrade); this.database.AddInParameter(sqlStringCommand, "UpgradeUrl", DbType.String, appVersionRecord.UpgradeUrl); this.database.AddInParameter(sqlStringCommand, "VersionName", DbType.String, appVersionRecord.VersionName); this.database.AddInParameter(sqlStringCommand, "UpgradeInfoUrl", DbType.String, appVersionRecord.UpgradeInfoUrl); this.database.AddInParameter(sqlStringCommand, "AppName", DbType.String, appVersionRecord.AppName); this.database.AddInParameter(sqlStringCommand, "AppPackageName", DbType.String, appVersionRecord.AppPackageName); this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, appVersionRecord.Id); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
private void ProcessAppInit(System.Web.HttpContext context) { string text = context.Request["VID"]; string text2 = context.Request["device"]; string text3 = context.Request["version"]; string text4 = context.Request["isFirst"]; if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2) || string.IsNullOrEmpty(text3) || string.IsNullOrEmpty(text4)) { context.Response.Write(this.GetErrorJosn(101, "缺少必填参数")); return; } decimal num; if (!decimal.TryParse(text3, out num)) { context.Response.Write(this.GetErrorJosn(102, "数字类型转换错误")); return; } if (text4.ToLower() == "true") { APPHelper.AddAppInstallRecord(new AppInstallRecordInfo { VID = text, Device = text2 }); } AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetLatestAppVersionRecord(text2); if (appVersionRecordInfo == null) { appVersionRecordInfo = new AppVersionRecordInfo(); appVersionRecordInfo.Version = num; } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{\"result\":{"); stringBuilder.AppendFormat("\"version\":\"{0}\",", appVersionRecordInfo.Version); stringBuilder.AppendFormat("\"existNew\":\"{0}\",", (appVersionRecordInfo.Version > num).ToString().ToLower()); stringBuilder.AppendFormat("\"forcible\":\"{0}\",", APPHelper.IsForcibleUpgrade(text2, num).ToString().ToLower()); stringBuilder.AppendFormat("\"description\":\"{0}\",", appVersionRecordInfo.Description); stringBuilder.AppendFormat("\"upgradeUrl\":\"{0}\"", appVersionRecordInfo.UpgradeUrl); stringBuilder.Append("}}"); context.Response.Write(stringBuilder.ToString()); }
protected override void OnLoad(System.EventArgs e) { if (!this.Page.IsPostBack) { string userAgent = HttpContext.Current.Request.QueryString["t"] != null ? HttpContext.Current.Request.QueryString["t"].ToLower() : ""; if (string.IsNullOrEmpty(userAgent)) { userAgent = HttpContext.Current.Request.UserAgent.ToLower(); } string url = ""; if (userAgent.IndexOf("ios") != -1) { AppVersionRecordInfo appVersion = APPHelper.GetLatestAppVersionRecord("ios"); if (appVersion != null) { url = appVersion.UpgradeUrl; } } else if (userAgent.IndexOf("android") != -1) { AppVersionRecordInfo appVersion = APPHelper.GetLatestAppVersionRecord("android"); if (appVersion != null) { url = appVersion.UpgradeUrl; } } else { AppVersionRecordInfo appVersion = APPHelper.GetLatestAppVersionRecord("android"); if (appVersion != null) { url = appVersion.UpgradeUrl; } } if (!string.IsNullOrEmpty(url)) { HttpContext.Current.Response.Redirect(url); } } }
public static bool AddAppVersionRecord(AppVersionRecordInfo appVersionRecord) { return(new AppVersionRecordDao().AddAppVersionRecord(appVersionRecord)); }
private void btnUpoad_Click(object sender, EventArgs e) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (this.fileUpload.FileContent.Length > 0 && this.fileUpload.PostedFile.ContentType != "application/x-zip-compressed" && this.fileUpload.PostedFile.ContentType != "application/zip" && this.fileUpload.PostedFile.ContentType != "application/octet-stream") { this.ShowMsg("请上传正确的数据包文件", false); } else { string text2 = masterSettings.AppAndroidDownLoadUrl = Globals.StripAllTags(this.txtAndroidDownloadUrl.InnerText); if (this.fileUpload.FileContent.Length > 0) { string text3 = this.Page.Request.MapPath("~/App_Data/data/app/android"); string str = this.Page.Request.MapPath("~/storage/data/app/android"); string fileName = Path.GetFileName(this.fileUpload.PostedFile.FileName); string text4 = Path.Combine(text3, fileName); this.ClearDirectory(text3); this.fileUpload.PostedFile.SaveAs(text4); DirectoryInfo directoryInfo = new DirectoryInfo(text3); using (ZipFile zipFile = ZipFile.Read(Path.Combine(directoryInfo.FullName, fileName))) { foreach (ZipEntry item in zipFile) { item.Extract(directoryInfo.FullName, ExtractExistingFileAction.OverwriteSilently); } } if (!File.Exists(text3 + "/AndroidUpgrade.xml")) { this.ShowMsg("压缩包中不包含版本信息的xml文件,请重新打包。", false); return; } File.Copy(text3 + "/AndroidUpgrade.xml", str + "/AndroidUpgrade.xml", true); File.Delete(text3 + "/AndroidUpgrade.xml"); string[] files = Directory.GetFiles(text3, "*.apk"); if (files.Length != 0) { string[] array = files; foreach (string text5 in array) { FileInfo fileInfo = new FileInfo(text5); File.Copy(text5, str + "/" + fileInfo.Name, true); } } File.Delete(text4); this.LoadVersion(); AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetLatestAppVersionRecord("android"); if (appVersionRecordInfo == null) { appVersionRecordInfo = new AppVersionRecordInfo(); appVersionRecordInfo.Device = "android"; appVersionRecordInfo.Version = "0.00"; } string text6 = this.litVersion.Text; if (APPHelper.IsExistNewVersion(text6, appVersionRecordInfo.Version)) { bool isForcibleUpgrade = false; bool.TryParse(this.hidIsForcibleUpgrade.Value, out isForcibleUpgrade); appVersionRecordInfo.Version = text6; appVersionRecordInfo.IsForcibleUpgrade = isForcibleUpgrade; appVersionRecordInfo.Description = this.litDescription.Text; appVersionRecordInfo.UpgradeUrl = this.txtAndroidDownloadUrl.InnerText; APPHelper.AddAppVersionRecord(appVersionRecordInfo); } } masterSettings.EnableAppDownload = this.ooOpen.SelectedValue; masterSettings.AppAuditAPIUrl = this.txtAppAuditAPIUrl.Text.ToNullString(); string text8 = masterSettings.AppIOSDownLoadUrl = Globals.StripAllTags(this.txtIosDownloadUrl.Text); SettingsManager.Save(masterSettings); this.ShowMsg("保存成功!", true); } }
protected override void AttachChildControls() { string text = ""; this.AndroidQrCode = (Image)this.FindControl("AndroidQrCode"); this.IosQrCode = (Image)this.FindControl("IosQrCode"); this.androidLink = (HtmlAnchor)this.FindControl("androidlink"); this.iosLink = (HtmlAnchor)this.FindControl("ioslink"); string text2 = ""; string text3 = ""; string text4 = ""; string str = ""; string text5 = ""; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.XmlResolver = null; AppVersionRecordInfo latestAppVersionRecord = APPHelper.GetLatestAppVersionRecord("android"); if (latestAppVersionRecord != null) { text4 = latestAppVersionRecord.Version.ToString(); text2 = latestAppVersionRecord.UpgradeUrl; } if (string.IsNullOrEmpty(text2)) { text2 = "http://" + Globals.DomainName + text + this.appBaseDir + "android/MEC1.4_android1.0.0.apk"; } if (text2.ToLower().IndexOf("http://") == -1) { text2 = "http://" + Globals.DomainName + text + text2; } text5 = this.baseDir + "AndroidDownload_" + text4 + ".png"; if (Directory.Exists(this.Page.Request.MapPath(text5))) { this.AndroidQrCode.ImageUrl = "http://" + this.baseDir + "AndroidDownload_" + text4 + ".png"; } else { this.AndroidQrCode.ImageUrl = Globals.CreateQRCode(text2, text5, false, ImageFormats.Png); } AppVersionRecordInfo latestAppVersionRecord2 = APPHelper.GetLatestAppVersionRecord("ios"); if (latestAppVersionRecord2 != null) { str = latestAppVersionRecord2.Version.ToString(); } text3 = HiContext.Current.SiteSettings.AppIOSDownLoadUrl; if (string.IsNullOrEmpty(text3)) { text3 = "https://itunes.apple.com/us/app/yi-dong-yun-shang-cheng/id880544709?mt=8"; } text5 = this.baseDir + "IosDownload_" + str + ".png"; if (Directory.Exists(this.Page.Request.MapPath(text5))) { this.IosQrCode.ImageUrl = this.baseDir + "IosDownload_" + str + ".png"; } else { this.IosQrCode.ImageUrl = Globals.CreateQRCode(text3, text5, false, ImageFormats.Png); } this.iosLink.HRef = text3; this.androidLink.HRef = text2; }
protected override void AttachChildControls() { string text = ""; this.loadPanel = (HtmlGenericControl)this.FindControl("loadPanel"); this.sharePanel = (HtmlGenericControl)this.FindControl("sharePanel"); this.androidLink = (HtmlAnchor)this.FindControl("androidlink"); this.iosLink = (HtmlAnchor)this.FindControl("ioslink"); string text2 = HttpContext.Current.Request.UserAgent; if (string.IsNullOrEmpty(text2)) { text2 = ""; } if (text2.ToLower().IndexOf("micromessenger") > -1) { this.loadPanel.Visible = false; this.sharePanel.Visible = true; } else { this.loadPanel.Visible = true; this.sharePanel.Visible = false; } string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.XmlResolver = null; AppVersionRecordInfo latestAppVersionRecord = APPHelper.GetLatestAppVersionRecord("android"); if (latestAppVersionRecord != null) { text5 = latestAppVersionRecord.Version.ToString(); text3 = latestAppVersionRecord.UpgradeUrl; } if (string.IsNullOrEmpty(text3)) { text3 = "http://" + Globals.DomainName + text + this.appBaseDir + "android/MEC1.4_android1.0.0.apk"; } if (text3.ToLower().IndexOf("http://") == -1) { text3 = "http://" + Globals.DomainName + text + text3; } AppVersionRecordInfo latestAppVersionRecord2 = APPHelper.GetLatestAppVersionRecord("ios"); if (latestAppVersionRecord2 != null) { text6 = latestAppVersionRecord2.Version.ToString(); } text4 = HiContext.Current.SiteSettings.AppIOSDownLoadUrl; if (string.IsNullOrEmpty(text4)) { text4 = "https://itunes.apple.com/us/app/yi-dong-yun-shang-cheng/id880544709?mt=8"; } this.iosLink.HRef = text4; this.androidLink.HRef = text3; PageTitle.AddSiteNameTitle("APP下载页面"); }
/// <summary> /// 保存版本信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveVersion_Click(object sender, System.EventArgs e) { AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetLatestAppVersionRecordOrderById("ios"); decimal num = 0.00m; if (!decimal.TryParse(this.txtVersion.Text, out num)) { this.ShowMsg("版本号格式不对,必须为实数", false); return; } //if (appVersionRecordInfo != null) //{ // if (appVersionRecordInfo.Version >= num) // { // this.ShowMsg("版本号必须大于当前版本", false); // return; // } //} if (string.IsNullOrWhiteSpace(this.txtDescription.Text)) { this.ShowMsg("版本描述不能为空", false); return; } if (string.IsNullOrWhiteSpace(this.txtUpgradeUrl.Text)) { this.ShowMsg("链接地址不能为空", false); return; } if (appVersionRecordInfo == null) { AppVersionRecordInfo newappVersionRecordInfo = new AppVersionRecordInfo(); newappVersionRecordInfo.Version = num; newappVersionRecordInfo.IsForcibleUpgrade = this.ChkisForceUpgrade.Checked; newappVersionRecordInfo.Description = this.txtDescription.Text.Trim(); newappVersionRecordInfo.UpgradeUrl = this.txtUpgradeUrl.Text.Trim(); newappVersionRecordInfo.Device = "ios"; if (APPHelper.AddAppVersionRecord(newappVersionRecordInfo)) { this.ShowMsg("保存成功!", true); } else { this.ShowMsg("保存失败!", true); } } else { appVersionRecordInfo.Version = num; appVersionRecordInfo.Description = this.txtDescription.Text.Trim(); appVersionRecordInfo.UpgradeUrl = this.txtUpgradeUrl.Text.Trim(); appVersionRecordInfo.IsForcibleUpgrade = this.ChkisForceUpgrade.Checked; appVersionRecordInfo.Device = "ios"; if (APPHelper.UpdateAppVersionRecord(appVersionRecordInfo)) { this.ShowMsg("保存成功!", true); } else { this.ShowMsg("保存失败!", true); } } }
public static bool UpdateAppVersionRecord(AppVersionRecordInfo appVersionRecord) { return(new AppVersionRecordDao().UpdateAppVersionRecord(appVersionRecord)); }
/// <summary> /// 保存版本信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveVersion_Click(object sender, System.EventArgs e) { if (string.IsNullOrWhiteSpace(this.txtDescription.Text)) { this.ShowMsg("版本描述不能为空", false); return; } if (string.IsNullOrWhiteSpace(this.txtUpgradeUrl.Text)) { this.ShowMsg("链接地址不能为空", false); return; } decimal num = 0.00m; if (!decimal.TryParse(this.txtVersion.Text, out num)) { this.ShowMsg("版本号格式不对,必须为实数", false); return; } if (this.Id > 0) { //修改版本有上传文件才进行数据包存储操作 if (this.fileUpload.HasFile) { if (this.fileUpload.PostedFile.ContentLength == 0 || (this.fileUpload.PostedFile.ContentType != "application/x-zip-compressed" && this.fileUpload.PostedFile.ContentType != "application/zip" && this.fileUpload.PostedFile.ContentType != "application/octet-stream")) { this.ShowMsg("请上传正确的数据包文件", false); return; } string savedPath = this.Page.Request.MapPath("~/storage/data/app/android"); string fileName = System.IO.Path.GetFileName(this.fileUpload.PostedFile.FileName); string fullFileName = System.IO.Path.Combine(savedPath, fileName); this.fileUpload.PostedFile.SaveAs(fullFileName); System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(savedPath); using (ZipFile zipFile = ZipFile.Read(System.IO.Path.Combine(directoryInfo.FullName, fileName))) { foreach (ZipEntry current in zipFile) { current.Extract(directoryInfo.FullName, ExtractExistingFileAction.OverwriteSilently); } } System.IO.File.Delete(fullFileName); } AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetAppVersionById(this.Id); appVersionRecordInfo.Version = num; appVersionRecordInfo.Description = this.txtDescription.Text; appVersionRecordInfo.UpgradeUrl = this.txtUpgradeUrl.Text.Trim(); appVersionRecordInfo.IsForcibleUpgrade = this.ChkisForceUpgrade.Checked; appVersionRecordInfo.Device = "android"; if (APPHelper.UpdateAppVersionRecord(appVersionRecordInfo)) { this.ShowMsg("保存成功!", true); } else { this.ShowMsg("保存失败!", true); } } else { if (!this.fileUpload.HasFile) { this.ShowMsg("请先选择一个数据包文件", false); return; } if (this.fileUpload.PostedFile.ContentLength == 0 || (this.fileUpload.PostedFile.ContentType != "application/x-zip-compressed" && this.fileUpload.PostedFile.ContentType != "application/zip" && this.fileUpload.PostedFile.ContentType != "application/octet-stream")) { this.ShowMsg("请上传正确的数据包文件", false); return; } string savedPath = this.Page.Request.MapPath("~/storage/data/app/android"); string fileName = System.IO.Path.GetFileName(this.fileUpload.PostedFile.FileName); string fullFileName = System.IO.Path.Combine(savedPath, fileName); this.fileUpload.PostedFile.SaveAs(fullFileName); System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(savedPath); using (ZipFile zipFile = ZipFile.Read(System.IO.Path.Combine(directoryInfo.FullName, fileName))) { foreach (ZipEntry current in zipFile) { current.Extract(directoryInfo.FullName, ExtractExistingFileAction.OverwriteSilently); } } System.IO.File.Delete(fullFileName); AppVersionRecordInfo appVersionRecordInfo = APPHelper.GetLatestAppVersionRecordOrderById("android"); if (appVersionRecordInfo != null) { if (appVersionRecordInfo.Version >= num) { this.ShowMsg("版本号必须大于之前的版本", false); return; } } AppVersionRecordInfo newappVersionRecordInfo = new AppVersionRecordInfo(); newappVersionRecordInfo.Version = num; newappVersionRecordInfo.IsForcibleUpgrade = this.ChkisForceUpgrade.Checked; newappVersionRecordInfo.Description = this.txtDescription.Text.Trim(); newappVersionRecordInfo.UpgradeUrl = this.txtUpgradeUrl.Text.Trim(); newappVersionRecordInfo.Device = "android"; if (APPHelper.AddAppVersionRecord(newappVersionRecordInfo)) { this.ShowMsg("保存成功!", true); } else { this.ShowMsg("保存失败!", true); } } }
public abstract bool AddAppVersionRecord(AppVersionRecordInfo appVersionRecord);