Ejemplo n.º 1
0
        public object GetAppVersion()
        {
            string appNum = AppNum;

            if (string.IsNullOrWhiteSpace(appNum))
            {
                return(APIResult.GetErrorResult("获取更新版本失败!"));
            }

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx("")))
            {
                var result = proxy.GetAppVersion(appNum);

                if (result.Flag == EResultFlag.Failure)
                {
                    return(APIResult.GetErrorResult(result.Exception));
                }

                if (result.Data == null)
                {
                    return(APIResult.GetSuccessNoData());
                }

                var data = new
                {
                    appNum      = result.Data.AppNum,      //包名
                    versionCode = result.Data.VersionCode, //版本号
                    version     = result.Data.VersionSn,   //版本名称
                    url         = result.Data.Url,         //版本下载路径
                    isForced    = result.Data.IsForced,    //是否强更:1-强制更新、2-普通更新
                    log         = result.Data.UpdateLog    //版本更新说明
                };

                return(APIResult.GetSuccessResult(data));
            }
        }