示例#1
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());
        }