添加IRootDirectory 接口,可通过注入IRootDirectory接口实现根据业务场景改变文件存储的位置

This commit is contained in:
Jackson.Bruce
2021-07-20 15:53:42 +08:00
parent 6e0cd7e085
commit c2fd88f9ac
19 changed files with 103 additions and 50 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Qiniu.Http;
@@ -20,7 +21,7 @@ namespace Qiniu
private readonly ILogger<ResumableService> logger;
private readonly HttpManager _httpManager;
public ResumableService(IResumableInfoService resumableInfoService,ILogger<ResumableService> logger, IOptions<FileServiceOptions> options) : base(options)
public ResumableService(IResumableInfoService resumableInfoService,ILogger<ResumableService> logger, IOptions<FileServiceOptions> options, IHttpContextAccessor contextAccessor) : base(options, contextAccessor)
{
this.resumableInfoService = resumableInfoService;
this.logger = logger;
@@ -129,7 +130,7 @@ namespace Qiniu
}
private async Task<bool> MakeFile(ResumableInfo info)
{
string key = Utils.GetSaveKey(options.BasePath, info.StoreName);
string key = await contextAccessor.GetSaveKey(options.BasePath, info.StoreName);
string fileName = key;
long size = info.FileSize;
string upToken = info.UploadToken;