コード例 #1
0
        public async Task <ActionResult> DownloadZip(string version)
        {
            var condition = new TemplateCondition
            {
                AppId   = AppId,
                EnvId   = EnvId,
                Type    = (int)ConfigType.File,
                Version = version
            };
            await _templateService.BatchCreateFile(condition);

            var fileName = DateTime.Now.ToString("yyMMddHHmmssff");

            string[] files = Directory.GetFiles(AppSettingHelper.Get <string>("FilePath")); //返回指定目录下的文件名
            Zip(files, fileName);
            return(File(AppSettingHelper.Get <string>("ZipPath") + fileName + ".zip", "application/zip", fileName + ".zip"));
        }