コード例 #1
0
        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
                }));
            }
        }
コード例 #2
0
        public IHttpActionResult Upgrade(string accessToken, int channel, int platform, string ver)
        {
            Logger.WriterLogger("Common.Upgrade, Params: " + string.Format("accessToken={0}&channel={1}&platform={2}&ver={3}", accessToken, channel, platform, ver), LoggerType.Info);

            // 保存访问信息
            base.SaveVisitInfo("", channel, platform, ver);

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Common.Upgrade"));
            }

            decimal resultver = Util.ConvertVer(ver) * 1.00m / 100;

            string device = "";

            switch (platform)
            {
            case 3:
                device = "android";
                AppAndroidVersionResult result = GetAndroidLatestVersion();

                result.IsForcibleUpgrade = APPHelper.IsForcibleUpgradeByPreviousVersion(resultver, "android");
                return(base.JsonActionResult(new StandardResult <AppAndroidVersionResult>()
                {
                    code = 0,
                    msg = "",
                    data = result
                }));

            //break;
            case 2:
                device = "ios";
                break;

            default:
                break;
            }

            return(base.JsonActionResult(new StandardResult <object>()
            {
                code = 0,
                msg = "",
                data = null
            }));
        }