😎1、文件上传增加指定存储路径(仅限后台) 2、升级依赖
This commit is contained in:
parent
f30903d33b
commit
cdb58a28ab
@ -28,9 +28,9 @@
|
|||||||
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.1" Aliases="BouncyCastleV2" />
|
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.1" Aliases="BouncyCastleV2" />
|
||||||
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.6" />
|
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.6" />
|
||||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.82" />
|
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.83" />
|
||||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.82" />
|
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.83" />
|
||||||
<PackageReference Include="Furion.Pure" Version="4.9.7.82" />
|
<PackageReference Include="Furion.Pure" Version="4.9.7.83" />
|
||||||
<PackageReference Include="Hardware.Info" Version="101.0.1.1" />
|
<PackageReference Include="Hardware.Info" Version="101.0.1.1" />
|
||||||
<PackageReference Include="Hashids.net" Version="1.7.0" />
|
<PackageReference Include="Hashids.net" Version="1.7.0" />
|
||||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
|
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
|
||||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.10.0" />
|
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.10.0" />
|
||||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.12.0" />
|
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.12.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.195" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.196" />
|
||||||
<PackageReference Include="SSH.NET" Version="2025.0.0" />
|
<PackageReference Include="SSH.NET" Version="2025.0.0" />
|
||||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.5" />
|
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.5" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
using Aliyun.OSS.Util;
|
using Aliyun.OSS.Util;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
namespace Admin.NET.Core.Service;
|
namespace Admin.NET.Core.Service;
|
||||||
|
|
||||||
@ -234,9 +235,10 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// 上传文件 🔖
|
/// 上传文件 🔖
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
|
/// <param name="targetPath">存储目标路径</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DisplayName("上传文件")]
|
[DisplayName("上传文件")]
|
||||||
public async Task<SysFile> UploadFile([FromForm] UploadFileInput input)
|
public async Task<SysFile> UploadFile([FromForm] UploadFileInput input, [BindNever] string targetPath = "")
|
||||||
{
|
{
|
||||||
if (input.File == null || input.File.Length <= 0) throw Oops.Oh(ErrorCodeEnum.D8000);
|
if (input.File == null || input.File.Length <= 0) throw Oops.Oh(ErrorCodeEnum.D8000);
|
||||||
|
|
||||||
@ -282,7 +284,8 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
//if (!VerifyFileExtensionName.IsSameType(file.OpenReadStream(), suffix)) throw Oops.Oh(ErrorCodeEnum.D8001);
|
//if (!VerifyFileExtensionName.IsSameType(file.OpenReadStream(), suffix)) throw Oops.Oh(ErrorCodeEnum.D8001);
|
||||||
|
|
||||||
// 文件存储位置
|
// 文件存储位置
|
||||||
var path = _uploadOptions.Path.ParseToDateTimeForRep();
|
var path = string.IsNullOrWhiteSpace(targetPath) ? _uploadOptions.Path : targetPath;
|
||||||
|
path = path.ParseToDateTimeForRep();
|
||||||
|
|
||||||
var newFile = input.Adapt<SysFile>();
|
var newFile = input.Adapt<SysFile>();
|
||||||
newFile.Id = YitIdHelper.NextId();
|
newFile.Id = YitIdHelper.NextId();
|
||||||
@ -309,7 +312,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("上传头像")]
|
[DisplayName("上传头像")]
|
||||||
public async Task<SysFile> UploadAvatar([Required] IFormFile file)
|
public async Task<SysFile> UploadAvatar([Required] IFormFile file)
|
||||||
{
|
{
|
||||||
var sysFile = await UploadFile(new UploadFileInput { File = file, AllowSuffix = _imageType });
|
var sysFile = await UploadFile(new UploadFileInput { File = file, AllowSuffix = _imageType }, "upload/avatar");
|
||||||
|
|
||||||
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
||||||
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
||||||
@ -331,7 +334,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("上传电子签名")]
|
[DisplayName("上传电子签名")]
|
||||||
public async Task<SysFile> UploadSignature([Required] IFormFile file)
|
public async Task<SysFile> UploadSignature([Required] IFormFile file)
|
||||||
{
|
{
|
||||||
var sysFile = await UploadFile(new UploadFileInput { File = file, AllowSuffix = _imageType });
|
var sysFile = await UploadFile(new UploadFileInput { File = file, AllowSuffix = _imageType }, "upload/signature");
|
||||||
|
|
||||||
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
||||||
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "admin.net.pro",
|
"name": "admin.net.pro",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.4.33",
|
"version": "2.4.33",
|
||||||
"lastBuildTime": "2025.06.09",
|
"lastBuildTime": "2025.06.10",
|
||||||
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
|
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
|
||||||
"author": "zuohuaijun",
|
"author": "zuohuaijun",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -18,14 +18,14 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"@logicflow/core": "^2.0.14",
|
"@logicflow/core": "^2.0.15",
|
||||||
"@logicflow/extension": "^2.0.19",
|
"@logicflow/extension": "^2.0.20",
|
||||||
"@microsoft/signalr": "^8.0.7",
|
"@microsoft/signalr": "^8.0.7",
|
||||||
"@vue-office/docx": "^1.6.2",
|
"@vue-office/docx": "^1.6.2",
|
||||||
"@vue-office/excel": "^1.7.14",
|
"@vue-office/excel": "^1.7.14",
|
||||||
"@vue-office/pdf": "^2.0.9",
|
"@vue-office/pdf": "^2.0.9",
|
||||||
"@vueuse/core": "^13.3.0",
|
"@vueuse/core": "^13.3.0",
|
||||||
"@vxe-ui/plugin-export-xlsx": "^4.2.1",
|
"@vxe-ui/plugin-export-xlsx": "^4.2.2",
|
||||||
"@vxe-ui/plugin-render-element": "^4.0.11",
|
"@vxe-ui/plugin-render-element": "^4.0.11",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||||
@ -78,8 +78,8 @@
|
|||||||
"vue-router": "^4.5.1",
|
"vue-router": "^4.5.1",
|
||||||
"vue-signature-pad": "^3.0.2",
|
"vue-signature-pad": "^3.0.2",
|
||||||
"vue3-tree-org": "^4.2.2",
|
"vue3-tree-org": "^4.2.2",
|
||||||
"vxe-pc-ui": "^4.6.17",
|
"vxe-pc-ui": "^4.6.19",
|
||||||
"vxe-table": "^4.13.36",
|
"vxe-table": "^4.13.37",
|
||||||
"xe-utils": "^3.7.5",
|
"xe-utils": "^3.7.5",
|
||||||
"xlsx-js-style": "^1.2.0"
|
"xlsx-js-style": "^1.2.0"
|
||||||
},
|
},
|
||||||
@ -90,8 +90,8 @@
|
|||||||
"@types/node": "^22.15.30",
|
"@types/node": "^22.15.30",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/sortablejs": "^1.15.8",
|
"@types/sortablejs": "^1.15.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.33.1",
|
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
||||||
"@typescript-eslint/parser": "^8.33.1",
|
"@typescript-eslint/parser": "^8.34.0",
|
||||||
"@vitejs/plugin-vue": "^5.2.4",
|
"@vitejs/plugin-vue": "^5.2.4",
|
||||||
"@vitejs/plugin-vue-jsx": "^4.2.0",
|
"@vitejs/plugin-vue-jsx": "^4.2.0",
|
||||||
"@vue/compiler-sfc": "^3.5.16",
|
"@vue/compiler-sfc": "^3.5.16",
|
||||||
@ -102,8 +102,8 @@
|
|||||||
"less": "^4.3.0",
|
"less": "^4.3.0",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"rollup-plugin-visualizer": "^6.0.3",
|
"rollup-plugin-visualizer": "^6.0.3",
|
||||||
"sass": "^1.89.1",
|
"sass": "^1.89.2",
|
||||||
"terser": "^5.41.0",
|
"terser": "^5.42.0",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vite-plugin-cdn-import": "^1.0.1",
|
"vite-plugin-cdn-import": "^1.0.1",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user