From f99c1becb0bbde82796e15d27e11ac4965c56468 Mon Sep 17 00:00:00 2001
From: qwj <qwjzorro@163.com>
Date: 星期一, 28 八月 2023 09:28:39 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/DocumentService
---
DocumentFile.Service/Controllers/DocumentController.cs | 76 ++++++++++++++++++++++++++++++++-----
1 files changed, 65 insertions(+), 11 deletions(-)
diff --git a/DocumentFile.Service/Controllers/DocumentController.cs b/DocumentFile.Service/Controllers/DocumentController.cs
index 1046bff..ad042ab 100644
--- a/DocumentFile.Service/Controllers/DocumentController.cs
+++ b/DocumentFile.Service/Controllers/DocumentController.cs
@@ -1,6 +1,4 @@
-锘縰sing Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using System.ComponentModel.DataAnnotations;
+锘縰sing Microsoft.AspNetCore.Mvc;
namespace DocumentFile.Service.Controllers
{
@@ -19,19 +17,40 @@
_uploadService = uploadService;
}
+ ///// <summary>
+ ///// 涓婁紶鏂囦欢妯℃澘锛坉oc銆乨ocx锛�
+ ///// </summary>
+ ///// <param name="code">绉熸埛鍞竴鏍囪瘑code</param>
+ ///// <param name="formFile">鏂囦欢</param>
+ ///// <returns></returns>
+ //[HttpPost]
+ //public async Task<IActionResult> UploadDocTemplate([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>
- /// 涓婁紶鏂囦欢妯℃澘锛坉oc銆乨ocx锛�
+ /// 涓婁紶鏂囦欢锛坉oc銆乨ocx锛�
+ /// 鏈湴鎸囧畾璺緞
/// </summary>
- /// <param name="code">绉熸埛鍞竴鏍囪瘑code</param>
- /// <param name="formFile">鏂囦欢</param>
/// <returns></returns>
[HttpPost]
- public async Task<IActionResult> UploadDocTemplate([FromForm]string code,IFormFile formFile)
+ public async Task<IActionResult> UploadDocWithPath([FromForm]string code, [FromForm] string path, IFormFile formFile)
{
ReturnMsg msg = new ReturnMsg();
- if(formFile.Length>0)
+ if (formFile.Length > 0)
{
- msg = await this._uploadService.HandleUploadWordFile(formFile,code,"");
+ msg = await this._uploadService.HandleUploadWordFile(formFile,code,path);
}
else
{
@@ -46,12 +65,12 @@
/// </summary>
/// <returns></returns>
[HttpPost]
- public async Task<IActionResult> UploadDocInstance([FromForm] string code, [FromForm] string path, IFormFile formFile)
+ 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,path);
+ msg = await this._uploadService.HandleUploadWordFile(formFile, code, "");
}
else
{
@@ -82,6 +101,41 @@
}
/// <summary>
+ /// 鍒犻櫎鏂囦欢
+ /// </summary>
+ /// <param name="delurl"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public IActionResult DeleteFile([FromForm] string[] delurl)
+ {
+ ReturnMsg msg = new ReturnMsg();
+ try
+ {
+ if(delurl!=null && delurl.Length > 0)
+ {
+ var dir = AppDomain.CurrentDomain.BaseDirectory;
+ foreach (var item in delurl)
+ {
+ if (!string.IsNullOrEmpty(item))
+ {
+ var path = dir + item;
+ if (System.IO.File.Exists(path))
+ {
+ System.IO.File.Delete(path);
+ }
+ }
+ }
+ msg.code = 1;
+ }
+ }
+ catch (Exception ex)
+ {
+ NLogProvider.GetInstance().Error(ex);
+ }
+ return new JsonResult(msg);
+ }
+
+ /// <summary>
/// 涓嬭浇鏂囦欢
/// </summary>
/// <param name="url"></param>
--
Gitblit v1.9.1