Просмотр исходного кода

修改附件上传人Id可为空

luocaiyang 3 лет назад
Родитель
Сommit
0c27ee9fb4

+ 2 - 0
wispro.sp.api/Controllers/AppealController.cs

@@ -74,6 +74,7 @@ namespace wispro.sp.api.Controllers
                 {
                     var temFile = Context.AttachFiles.Where<AttachFile>(f => f.Id == file.Id).FirstOrDefault();
                     temFile.AppealRecordId = appealRecord.Id;
+                    temFile.UploadUserId = appealRecord.CreaterId;
                 }
 
                 Context.SaveChanges();
@@ -120,6 +121,7 @@ namespace wispro.sp.api.Controllers
                         {
                             var temFile = Context.AttachFiles.Where<AttachFile>(f => f.Id == file.Id).FirstOrDefault();
                             temFile.AppealRecordId = appealRecord.Id;
+                            temFile.UploadUserId = appealRecord.ReviewerId;
                         }
                     }
 

+ 1 - 1
wispro.sp.api/Controllers/AttachFilesController.cs

@@ -17,7 +17,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
-    [Authorize]
+    //[Authorize]
     public class AttachFilesController : ControllerBase
     {
         private readonly IWebHostEnvironment env;

+ 3 - 3
wispro.sp.web/Components/CreateAppeal.razor.cs

@@ -25,7 +25,7 @@ namespace wispro.sp.web.Components
 
 
         [Inject] 
-        protected HttpClient _httpClient{get;set;}
+        protected IHttpService _httpClient{get;set;}
 
         #region 文件上传控件设定
         //List<UploadFileItem> fileList = new List<UploadFileItem>();
@@ -44,7 +44,7 @@ namespace wispro.sp.web.Components
                 _Model.FileList.Where(file => file.State == UploadState.Success && !string.IsNullOrWhiteSpace(file.Response)).ForEach(file =>
                 {
                     var result = file.GetResponse<List<AttachFile>>();
-                    file.Url = $"http://localhost:39476/api/AttachFiles/Download?id={result[0].Id}";
+                    file.Url = $"AttachFiles/Download?id={result[0].Id}";
                 });
             }
             catch { }
@@ -55,7 +55,7 @@ namespace wispro.sp.web.Components
             try
             {
                 var result = fileinfo.GetResponse<List<AttachFile>>();
-                return await _httpClient.GetFromJsonAsync<bool>($"http://localhost:39476/api/AttachFiles/Delete?id={result[0].Id}");
+                return await _httpClient.Get<bool>($"http://localhost:39476/api/AttachFiles/Delete?id={result[0].Id}");
             }
             catch {
                 return false;

+ 1 - 1
wospro.sp.entity/AttachFile.cs

@@ -16,7 +16,7 @@ namespace wispro.sp.entity
 
         public Staff UploadUser { get; set; }
 
-        public int UploadUserId { get; set; }
+        public int? UploadUserId { get; set; }
 
         public AppealRecord AppealRecord { get; set; }