| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上传文件(word) |
| | | /// 上传文件模板(doc、docx) |
| | | /// </summary> |
| | | /// <param name="code">租户唯一标识code</param> |
| | | /// <param name="formFile">文件</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> UploadDocument(IFormFile formFile) |
| | | public async Task<IActionResult> UploadDocTemplate([FromForm]string code,IFormFile formFile) |
| | | { |
| | | ReturnMsg msg = new ReturnMsg(); |
| | | if(formFile.Length>0) |
| | | { |
| | | msg = await this._uploadService.HandleUploadWordFile(formFile); |
| | | msg = await this._uploadService.HandleUploadTemplateFile(formFile,code); |
| | | } |
| | | else |
| | | { |
| | | msg.error = "请上传文件"; |
| | | } |
| | | |
| | | return new JsonResult(msg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上传文件(doc、docx) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> UploadDocInstance([FromForm] string code, IFormFile formFile) |
| | | { |
| | | ReturnMsg msg = new ReturnMsg(); |
| | | if (formFile.Length > 0) |
| | | { |
| | | msg = await this._uploadService.HandleUploadWordFile(formFile, code); |
| | | } |
| | | else |
| | | { |
| | | msg.error = "请上传文件"; |
| | | } |
| | | |
| | | return new JsonResult(msg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上传图片(jpg、jpeg、png) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> UploadPhoto([FromForm] string code, IFormFile formFile) |
| | | { |
| | | ReturnMsg msg = new ReturnMsg(); |
| | | if (formFile.Length > 0) |
| | | { |
| | | msg = await this._uploadService.HandleUploadImageFile(formFile, code); |
| | | } |
| | | else |
| | | { |
| | |
| | | /// <param name="url"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult Download([FromBody] string url) |
| | | public IActionResult Download([FromForm] string url) |
| | | { |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(url)) |
| | | { |
| | | var _webRootPath = AppDomain.CurrentDomain.BaseDirectory; |
| | | |
| | | return new FileStreamResult(new FileStream(_webRootPath + url, FileMode.Open), "application/octet-stream");// { FileDownloadName = FileName }; |
| | | var path = _webRootPath + url; |
| | | if (System.IO.File.Exists(path)) |
| | | { |
| | | return new FileStreamResult(new FileStream(path, FileMode.Open), "application/octet-stream");// { FileDownloadName = FileName }; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |