Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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 + "}");
        }
Ejemplo n.º 3
0
        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 + "]");
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 5
0
        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);
                }
            }
        }
Ejemplo n.º 6
0
        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下载页面");
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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);
            }
        }