Browse Source

😂调整头像和签名上传

zuohuaijun 2 years ago
parent
commit
18cfed9311
1 changed files with 2 additions and 6 deletions
  1. 2 6
      Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs

+ 2 - 6
Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs

@@ -355,9 +355,7 @@ public class SysFileService : IDynamicApiController, ITransient
         }
 
         var res = await UploadFile(file, "Upload/Avatar");
-        var url = $"{res.FilePath}/{res.Name}";
-        if (_OSSProviderOptions.IsEnable)
-            url = res.Url;
+        var url = _OSSProviderOptions.IsEnable ? res.Url : $"{res.FilePath}/{res.Name}";
         await sysUserRep.UpdateAsync(u => new SysUser() { Avatar = url }, u => u.Id == user.Id);
         return res;
     }
@@ -380,9 +378,7 @@ public class SysFileService : IDynamicApiController, ITransient
         }
 
         var res = await UploadFile(file, "Upload/Signature");
-        var url = $"{res.FilePath}/{res.Name}";
-        if (_OSSProviderOptions.IsEnable)
-            url = res.Url;
+        var url = _OSSProviderOptions.IsEnable ? res.Url : $"{res.FilePath}/{res.Name}";
         await sysUserRep.UpdateAsync(u => new SysUser() { Signature = url }, u => u.Id == user.Id);
         return res;
     }