示例#1
0
        public override ResxUploadResponseBody ExecuteCore()
        {
            string      partialPath = CustomerEnumDesc.GetResxTypePath(request.ResxType, request.UserId);
            ResxHandler resx        = new ResxHandler
            {
                SaveLocalDirectory = string.Format("{0}{1}", AppConfigManager.UploadDirectory, partialPath),
                AccessUrl          = string.Format("{0}{1}", ResxConfigManager.FileAccessUrl, partialPath)
            };
            ResxResult result = resx.Upload(request.Files.FirstOrDefault());

            return(new ResxUploadResponseBody()
            {
                ResxResult = result
            });
        }
示例#2
0
        public ActionResult Deploy(AppExt model)
        {
            string error;
            var    file = Request.Form.Files.FirstOrDefault();

            if (file != null)
            {
                ResxHandler resx = new ResxHandler();
                resx.ResxTypes = new List <string>()
                {
                    ".apk"
                };
                resx.SaveLocalDirectory = string.Format("{0}/apkversion", AppConfigManager.UploadDirectory);
                resx.AccessUrl          = string.Format("{0}/apkversion", ResxConfigManager.FileAccessUrl);
                ResxResult result = resx.Upload(file);
                if (result.Success)
                {
                    model.Size        = result.ResxSize;
                    model.DownloadUrl = result.ResxAccessUrl;
                }
                else
                {
                    error = result.Message;
                    return(Json(new { state = -1, error = result.Message }));
                }
            }

            int ret = appService.AppVersionAction(model, out error);

            if (ret > 0)
            {
                return(Json(new { state = 1 }));
            }
            else
            {
                return(Json(new { state = -1, error }));
            }
        }