fix 代码合并,minio上传文件
This commit is contained in:
@@ -27,7 +27,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys", "Src\Dlhis.Sys\
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{8317C526-3523-4195-9B19-2F17CFD71927}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.User.Api", "Src\Dlhis.User.Api\Dlhis.User.Api.csproj", "{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys.Api", "Src\Dlhis.User.Api\Dlhis.Sys.Api.csproj", "{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Common.Api\Dlhis.Common.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.User.Api\Dlhis.User.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.User.Api\Dlhis.Sys.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://localhost:5001",
|
||||
"UserRequestUrl": "http://localhost:5004"
|
||||
"SysRequestUrl": "http://localhost:5003"
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"AllowedHosts": "*",
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common",
|
||||
"UserRequestUrl": "http://user"
|
||||
"SysRequestUrl": "http://sys"
|
||||
},
|
||||
"FaceUrlOptions": {
|
||||
"Url": "https://yikatong.isawesome.cn/api/basic/gainfos/face?token=",
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="FileOperation\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.2" />
|
||||
<PackageReference Include="Minio" Version="6.0.1" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Reflection;
|
||||
using Dlhis.Common.Response;
|
||||
using Dlhis.Common.FileOperation.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.Core.ConfigurableOptions.Attributes;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Configurations;
|
||||
|
||||
|
||||
[Configuration("MinIO")]
|
||||
public class MinIOOptions
|
||||
{
|
||||
[Required]
|
||||
public string Endpoint { get; set; }
|
||||
|
||||
[Required]
|
||||
public string AccessKey { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SecretKey { get; set; }
|
||||
|
||||
public string DefaultBucket { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using Dlhis.Common.FileOperation.Request;
|
||||
using Dlhis.Common.FileOperation.Response;
|
||||
using Dlhis.Common.FileOperation.Services;
|
||||
using Dlhis.Common.Request;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 文件上传/下载
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ApkFileController : ControllerBase
|
||||
{
|
||||
private IApkFIileService _apkFIileService;
|
||||
|
||||
public ApkFileController(IApkFIileService apkFIileService)
|
||||
{
|
||||
_apkFIileService = apkFIileService;
|
||||
}
|
||||
/// <summary>
|
||||
/// minlo文件上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("minlo")]
|
||||
public async Task<ApkFileResponse> FormSingleFileUpload([FromForm] ApkRequest request)
|
||||
{
|
||||
return await _apkFIileService.FormSingleFileUpload(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// minlo文件下载
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("url")]
|
||||
public async Task<string> RequestDownloadFile(string fileName)
|
||||
{
|
||||
return await _apkFIileService.RequestDownloadFile(fileName);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 本地文件上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("local")]
|
||||
[RequestSizeLimit(100_000_0000)]
|
||||
|
||||
public async Task<ApkFileResponse> FormLocalFileUpload([FromForm] ApkRequest request)
|
||||
{
|
||||
return await _apkFIileService.FormLocalFileUpload(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 本地文件下载
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("local")]
|
||||
public IActionResult FormLocalDownloadFile(string filePath)
|
||||
{
|
||||
return _apkFIileService.FormLocalDownloadFile(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
30
Src/Dlhis.Common/FileOperation/Controllers/FileController.cs
Normal file
30
Src/Dlhis.Common/FileOperation/Controllers/FileController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Dlhis.Common.FileOperation.Request;
|
||||
using Dlhis.Common.FileOperation.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class FileController : ControllerBase
|
||||
{
|
||||
private readonly IMinioService _minioService;
|
||||
|
||||
public FileController(IMinioService minioService)
|
||||
{
|
||||
_minioService = minioService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns>相对路径</returns>
|
||||
[HttpPost("{Bucket}/upload")]
|
||||
public async Task<string> UploadFileAsync([FromForm] UploadFileReuqest request)
|
||||
{
|
||||
return await _minioService.UploadFileAsync(request.Bucket, request.File);
|
||||
}
|
||||
}
|
||||
11
Src/Dlhis.Common/FileOperation/Request/UploadFileReuqest.cs
Normal file
11
Src/Dlhis.Common/FileOperation/Request/UploadFileReuqest.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Request;
|
||||
|
||||
public class UploadFileReuqest
|
||||
{
|
||||
[FromRoute]
|
||||
public string Bucket { get; set; }
|
||||
|
||||
public IFormFile File { get; set; }
|
||||
}
|
||||
27
Src/Dlhis.Common/FileOperation/Response/ApkFileResponse.cs
Normal file
27
Src/Dlhis.Common/FileOperation/Response/ApkFileResponse.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Response
|
||||
{
|
||||
public class ApkFileResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
public int VersionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改信息
|
||||
/// </summary>
|
||||
public string UpdateMessage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Common.Response
|
||||
namespace Dlhis.Common.FileOperation.Response
|
||||
{
|
||||
public class CommonEnumResponse
|
||||
{
|
||||
8
Src/Dlhis.Common/FileOperation/Response/KeyValueDto.cs
Normal file
8
Src/Dlhis.Common/FileOperation/Response/KeyValueDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Dlhis.Common.FileOperation.Response;
|
||||
|
||||
public class KeyValueDto
|
||||
{
|
||||
public string Key { get; set; }
|
||||
|
||||
public object Value { get; set; }
|
||||
}
|
||||
38
Src/Dlhis.Common/FileOperation/Services/IApkFIileService.cs
Normal file
38
Src/Dlhis.Common/FileOperation/Services/IApkFIileService.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Dlhis.Common.FileOperation.Request;
|
||||
using Dlhis.Common.FileOperation.Response;
|
||||
using Dlhis.Common.Request;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Services;
|
||||
|
||||
public interface IApkFIileService : IScopeDependency
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task<ApkFileResponse> FormSingleFileUpload(ApkRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 文件下载
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> RequestDownloadFile(string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// 本地上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task<ApkFileResponse> FormLocalFileUpload(ApkRequest request);
|
||||
/// <summary>
|
||||
/// 本地下载
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
IActionResult FormLocalDownloadFile(string filePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
21
Src/Dlhis.Common/FileOperation/Services/IMinioService.cs
Normal file
21
Src/Dlhis.Common/FileOperation/Services/IMinioService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Dlhis.Common.Request;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Services;
|
||||
|
||||
public interface IMinioService : ISingletonDependency
|
||||
{
|
||||
Task<string> MinloUploadFileAsync(ApkRequest request);
|
||||
|
||||
Task<string> MinloDownloadLinkAsync(string fileName);
|
||||
|
||||
Task MinloRemoveFileAsync(string fileName);
|
||||
|
||||
|
||||
|
||||
Task<bool> ExistsBucketAsync(string bucket);
|
||||
|
||||
Task<bool> ExistsFileAsync(string bucket, string objectName);
|
||||
|
||||
Task<string> UploadFileAsync(string bucket, IFormFile formFile);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using Dlhis.Common.FileOperation.Request;
|
||||
using Dlhis.Common.FileOperation.Response;
|
||||
using Dlhis.Common.FileOperation.Services;
|
||||
using Dlhis.Common.Request;
|
||||
using Dlhis.Entity.Common;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Services.Implements;
|
||||
|
||||
public class ApkFIileService : IApkFIileService
|
||||
{
|
||||
private readonly IMinioService _minioService;
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public ApkFIileService(IMinioService minioService, IDbContext dbContext)
|
||||
{
|
||||
_minioService = minioService;
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApkFileResponse> FormSingleFileUpload(ApkRequest request)
|
||||
{
|
||||
//上传
|
||||
var fileUrl = await _minioService.MinloUploadFileAsync(request);
|
||||
|
||||
string fileName = request.formFile.FileName;
|
||||
|
||||
//更新数据库
|
||||
var entity = await _dbContext.Queryable<ApkFileEntity>().Where(x => x.Name == fileName).FirstAsync();
|
||||
if (entity == null)
|
||||
{
|
||||
var info = new ApkFileEntity
|
||||
{
|
||||
Name = fileName,
|
||||
Url = fileUrl,
|
||||
VersionCode = request.VersionCode,
|
||||
UpdateMessage = request.UpdateMessage,
|
||||
};
|
||||
await _dbContext.InsertAsync(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Url = fileUrl;
|
||||
entity.VersionCode = request.VersionCode;
|
||||
entity.UpdateMessage = request.UpdateMessage;
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
var newEntity = await _dbContext.Queryable<ApkFileEntity>().Where(x => x.Name == fileName).FirstAsync();
|
||||
var res = newEntity.Adapt<ApkFileResponse>();
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件下载
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> RequestDownloadFile(string fileName)
|
||||
{
|
||||
return await _minioService.MinloDownloadLinkAsync(fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 本地文件上传
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApkFileResponse> FormLocalFileUpload(ApkRequest request)
|
||||
{
|
||||
//上传
|
||||
var completeFilePath = FormSingleFileUpload(request.formFile);
|
||||
if (completeFilePath == "No file uploaded" || completeFilePath.IsEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
//更新数据库
|
||||
var fileName = request.formFile.FileName;
|
||||
var entity = await _dbContext.Queryable<ApkFileEntity>().Where(x => x.Name == fileName).FirstAsync();
|
||||
if (entity == null)
|
||||
{
|
||||
var info = new ApkFileEntity
|
||||
{
|
||||
Name = fileName,
|
||||
Url = completeFilePath,
|
||||
VersionCode = request.VersionCode,
|
||||
UpdateMessage = request.UpdateMessage,
|
||||
};
|
||||
await _dbContext.InsertAsync(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Url = completeFilePath;
|
||||
entity.VersionCode = request.VersionCode;
|
||||
entity.UpdateMessage = request.UpdateMessage;
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
var newEntity = await _dbContext.Queryable<ApkFileEntity>().Where(x => x.Name == fileName).FirstAsync();
|
||||
var res = newEntity.Adapt<ApkFileResponse>();
|
||||
return res;
|
||||
|
||||
}
|
||||
public string FormSingleFileUpload(IFormFile formFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
var filePath = "D:\\apk\\";
|
||||
|
||||
// 创建存储文件夹
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
|
||||
if (formFile != null && formFile.Length > 0)
|
||||
{
|
||||
// 保存的文件名称
|
||||
var saveName = Path.GetFileName(formFile.FileName);
|
||||
|
||||
// 文件保存
|
||||
using (var fs = File.Create(Path.Combine(filePath, saveName)))
|
||||
{
|
||||
formFile.CopyTo(fs);
|
||||
fs.Flush();
|
||||
}
|
||||
|
||||
// 完整的文件路径
|
||||
var completeFilePath = Path.Combine(filePath, saveName);
|
||||
return completeFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "No file uploaded";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 本地下载
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult FormLocalDownloadFile(string filePath)
|
||||
{
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
return new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
using Dlhis.Common.FileOperation.Configurations;
|
||||
using Dlhis.Common.FileOperation.Request;
|
||||
using Dlhis.Common.Request;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Minio;
|
||||
using Minio.DataModel.Args;
|
||||
using Minio.Exceptions;
|
||||
|
||||
namespace Dlhis.Common.FileOperation.Services.Implements;
|
||||
|
||||
public class MinioService : IMinioService
|
||||
{
|
||||
private readonly IMinioClient _client;
|
||||
private readonly MinIOOptions _minIOOptions;
|
||||
|
||||
public MinioService(IMinioClient client, IOptions<MinIOOptions> options)
|
||||
{
|
||||
_client = client;
|
||||
_minIOOptions = options.Value;
|
||||
}
|
||||
|
||||
public async Task<bool> ExistsBucketAsync(string bucket)
|
||||
{
|
||||
var args = new BucketExistsArgs().WithBucket(bucket);
|
||||
return await _client.BucketExistsAsync(args);
|
||||
}
|
||||
|
||||
|
||||
public async Task CreateBucketIfNotExistsAsync(string bucket)
|
||||
{
|
||||
if (!await ExistsBucketAsync(bucket))
|
||||
{
|
||||
var policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\"],\"Resource\":[\"arn:aws:s3:::BUCKETNAME\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\"],\"Resource\":[\"arn:aws:s3:::BUCKETNAME/*\"]}]}".Replace("BUCKETNAME", bucket);
|
||||
|
||||
await _client.MakeBucketAsync(new MakeBucketArgs().WithBucket(bucket));
|
||||
await _client.SetPolicyAsync(new SetPolicyArgs().WithBucket(bucket).WithPolicy(policy));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> ExistsFileAsync(string bucket, string objectName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj = new StatObjectArgs().WithBucket(bucket).WithObject(objectName);
|
||||
var objStat = await _client.StatObjectAsync(obj);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<string> UploadFileAsync(string bucket, IFormFile formFile)
|
||||
{
|
||||
await CreateBucketIfNotExistsAsync(bucket);
|
||||
|
||||
var ms = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
||||
var fileName = Path.GetFileNameWithoutExtension(formFile.FileName) + "_" + ms + Path.GetExtension(formFile.FileName);
|
||||
fileName = $"{DateTime.Now.Year}/{DateTime.Now.Month}/{fileName}";
|
||||
|
||||
var response = await _client.PutObjectAsync(new PutObjectArgs().WithBucket(bucket)
|
||||
.WithObject(fileName)
|
||||
.WithObjectSize(formFile.Length)
|
||||
.WithStreamData(formFile.OpenReadStream())
|
||||
.WithContentType(formFile.ContentType)
|
||||
.WithVersionId(bucket)
|
||||
);
|
||||
|
||||
return $"/{bucket}/{response.ObjectName}";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> MinloUploadFileAsync(ApkRequest request)
|
||||
{
|
||||
string fileName = request.formFile.FileName;
|
||||
|
||||
using (MemoryStream filestream = new MemoryStream())
|
||||
{
|
||||
await request.formFile.CopyToAsync(filestream);
|
||||
filestream.Position = 0;
|
||||
|
||||
var res = await _client.PutObjectAsync(new PutObjectArgs()
|
||||
.WithBucket(_minIOOptions.DefaultBucket)
|
||||
.WithObject(fileName)
|
||||
.WithStreamData(filestream)
|
||||
.WithObjectSize(filestream.Length));
|
||||
}
|
||||
var filerl = await MinloDownloadLinkAsync(fileName);
|
||||
return filerl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件下载链接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> MinloDownloadLinkAsync(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = await _client.PresignedGetObjectAsync(new PresignedGetObjectArgs()
|
||||
.WithBucket(_minIOOptions.DefaultBucket)
|
||||
.WithObject(fileName)
|
||||
.WithExpiry(60 * 60 * 24 * 7));//链接时效
|
||||
return url;
|
||||
}
|
||||
catch (MinioException e)
|
||||
{
|
||||
Console.Out.WriteLine("Error occurred: " + e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单个删除文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task MinloRemoveFileAsync(string fileName)
|
||||
{
|
||||
await _client.RemoveObjectAsync(new RemoveObjectArgs()
|
||||
.WithBucket(_minIOOptions.DefaultBucket)
|
||||
.WithObject(fileName));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +1,25 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Dlhis.Common.FileOperation.Configurations;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Minio;
|
||||
|
||||
namespace Dlhis.Common.Packs;
|
||||
|
||||
public class MinioPack : BaseAppPack
|
||||
public class MinioPack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
services.AddSingleton(sp =>
|
||||
{
|
||||
//注入minioClient
|
||||
IMinioClient minioClient = (MinioClient)new MinioClient()
|
||||
.WithEndpoint("192.168.199.124:9000")
|
||||
.WithCredentials("Zbjj05OFtR19e5TJopQU", "UMXtNdZhufhAAyYJ3XND4cEgZNUsgOWtbUzksizK")
|
||||
.Build();
|
||||
services.AddSingleton(minioClient);
|
||||
}
|
||||
|
||||
var config = sp.GetService<IOptions<MinIOOptions>>().Value;
|
||||
return new MinioClient().WithEndpoint(new Uri(config.Endpoint))
|
||||
.WithCredentials(config.AccessKey, config.SecretKey)
|
||||
.Build();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Dlhis.Common.Response
|
||||
{
|
||||
public class KeyValueDto
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using Dlhis.Common.Request;
|
||||
|
||||
namespace Dlhis.Common.Services
|
||||
{
|
||||
public interface IMinioService : IScopeDependency
|
||||
{
|
||||
Task<string> MinloUploadFileAsync(ApkRequest request);
|
||||
Task<string> MinloDownloadLinkAsync(string fileName);
|
||||
Task MinloRemoveFileAsync(string fileName);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Common.Request;
|
||||
using Dlhis.Common.FileOperation.Services;
|
||||
using Dlhis.Common.Request;
|
||||
using Dlhis.Common.Response;
|
||||
using Dlhis.Entity.Common;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
using Dlhis.Common.Request;
|
||||
using Minio;
|
||||
using Minio.DataModel.Args;
|
||||
using Minio.Exceptions;
|
||||
|
||||
namespace Dlhis.Common.Services.Implements
|
||||
{
|
||||
public class MinioService : IMinioService
|
||||
{
|
||||
private readonly IMinioClient _client;
|
||||
|
||||
private static string bucketName = "apk";
|
||||
|
||||
public MinioService( IMinioClient client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> MinloUploadFileAsync(ApkRequest request)
|
||||
{
|
||||
string fileName = request.formFile.FileName;
|
||||
|
||||
using (MemoryStream filestream = new MemoryStream())
|
||||
{
|
||||
await request.formFile.CopyToAsync(filestream);
|
||||
filestream.Position = 0;
|
||||
|
||||
var res = await _client.PutObjectAsync(new PutObjectArgs()
|
||||
.WithBucket(bucketName)
|
||||
.WithObject(fileName)
|
||||
.WithStreamData(filestream)
|
||||
.WithObjectSize(filestream.Length));
|
||||
}
|
||||
var filerl = await MinloDownloadLinkAsync(fileName);
|
||||
return filerl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件下载链接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> MinloDownloadLinkAsync(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = await _client.PresignedGetObjectAsync(new PresignedGetObjectArgs()
|
||||
.WithBucket(bucketName)
|
||||
.WithObject(fileName)
|
||||
.WithExpiry(60 * 60 * 24*7));//链接时效
|
||||
return url;
|
||||
}
|
||||
catch (MinioException e)
|
||||
{
|
||||
Console.Out.WriteLine("Error occurred: " + e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单个删除文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task MinloRemoveFileAsync(string fileName)
|
||||
{
|
||||
await _client.RemoveObjectAsync(new RemoveObjectArgs()
|
||||
.WithBucket(bucketName)
|
||||
.WithObject(fileName));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,10 @@
|
||||
//服务器IP
|
||||
"Endpoint": "http://192.168.199.124:9000",
|
||||
//账号
|
||||
"AccessKey": "Zbjj05OFtR19e5TJopQU",
|
||||
"AccessKey": "oQ7tD55EVNElIoO3D43r",
|
||||
//密码
|
||||
"SecretKey": "UMXtNdZhufhAAyYJ3XND4cEgZNUsgOWtbUzksizK",
|
||||
"SecretKey": "3eWLaAFQ9fnFx8pOp5SgJogoF47ecAH6dcCWlyAp",
|
||||
//默认存储桶
|
||||
"Bucket": "apk"
|
||||
"DefaultBucket": "apk"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
//密码
|
||||
"SecretKey": "UMXtNdZhufhAAyYJ3XND4cEgZNUsgOWtbUzksizK",
|
||||
//apk默认存储桶
|
||||
"Bucket": "apk"
|
||||
"DefaultBucket": "apk"
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.26" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.User.Api\Dlhis.User.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.User.Api\Dlhis.Sys.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -8,7 +8,7 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
COPY ["Src/Dlhis.User.Api/Dlhis.User.Api.csproj", "Src/Dlhis.User.Api/"]
|
||||
COPY ["Src/Dlhis.User.Api/Dlhis.Sys.Api.csproj", "Src/Dlhis.User.Api/"]
|
||||
RUN dotnet restore "Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Src/Dlhis.ScheduledTask"
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.User.Api\Dlhis.User.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -8,7 +8,6 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.Sys/Dlhis.Sys.csproj", "Src/Dlhis.Sys/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
COPY ["Src/Dlhis.User.Api/Dlhis.User.Api.csproj", "Src/Dlhis.User.Api/"]
|
||||
RUN dotnet restore "Src/Dlhis.Sys/Dlhis.Sys.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Src/Dlhis.Sys"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Dlhis.User.Identity.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.User.Identity.Controllers;
|
||||
namespace Dlhis.Sys.Identity.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.User.Identity.Services;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.User.Identity.Controllers;
|
||||
namespace Dlhis.Sys.Identity.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.User.Identity.Services;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.User.Identity.Controllers;
|
||||
namespace Dlhis.Sys.Identity.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 用户
|
||||
@@ -44,6 +44,11 @@ public class UsersController : ControllerBase
|
||||
return await _userService.GetUsersAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取用户
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
[HttpGet]
|
||||
public async Task<UserResponse> GetUserByIdAsync(int id)
|
||||
@@ -51,6 +56,11 @@ public class UsersController : ControllerBase
|
||||
return await _userService.GetUserByIdAsync(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传头像
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
[HttpPost("avatar")]
|
||||
public async Task UploadUserAvatarAsync([FromForm] UserAvatarUploadRequest request)
|
||||
10
Src/Dlhis.Sys/Identity/Request/ClientGrantRequest.cs
Normal file
10
Src/Dlhis.Sys/Identity/Request/ClientGrantRequest.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Dlhis.Sys.Identity.Request;
|
||||
|
||||
public class ClientGrantRequest
|
||||
{
|
||||
public string ClientId { get; set; }
|
||||
|
||||
public string ClientSecret { get; set; }
|
||||
|
||||
public string Scope { get; set; } = "yikatong";
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.User.Identity.Request;
|
||||
namespace Dlhis.Sys.Identity.Request;
|
||||
|
||||
public class RolePageRequest : PageDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.User.Identity.Request
|
||||
namespace Dlhis.Sys.Identity.Request
|
||||
{
|
||||
public class TenantPageRequest : PageDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.User.Identity.Request;
|
||||
namespace Dlhis.Sys.Identity.Request;
|
||||
|
||||
public class UserAvatarUploadRequest
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.User.Identity.Request;
|
||||
namespace Dlhis.Sys.Identity.Request;
|
||||
|
||||
public class UserPageRequest : PageDto
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.User.Identity.Response;
|
||||
namespace Dlhis.Sys.Identity.Response;
|
||||
|
||||
public class RoleRespone
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.User.Identity.Response;
|
||||
namespace Dlhis.Sys.Identity.Response;
|
||||
|
||||
public class TenantResponse
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.User.Identity.Response;
|
||||
namespace Dlhis.Sys.Identity.Response;
|
||||
|
||||
public class UserResponse
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.User.Identity.Services;
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.User.Identity.Services;
|
||||
namespace Dlhis.Sys.Identity.Services;
|
||||
|
||||
public interface ITenantService : IScopeDependency
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.User.Identity.Services;
|
||||
namespace Dlhis.Sys.Identity.Services;
|
||||
|
||||
public interface IUserService : IScopeDependency
|
||||
{
|
||||
@@ -1,12 +1,13 @@
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Dlhis.User.Identity.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.User.Identity.Services.Implements;
|
||||
namespace Dlhis.Sys.Identity.Services.Implements;
|
||||
|
||||
public class RoleService : IRoleService
|
||||
{
|
||||
@@ -1,12 +1,12 @@
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.User.Identity.Services.Implements;
|
||||
namespace Dlhis.Sys.Identity.Services.Implements;
|
||||
|
||||
public class TenantService : ITenantService
|
||||
{
|
||||
@@ -1,12 +1,12 @@
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.User.Identity.Request;
|
||||
using Dlhis.User.Identity.Response;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.User.Identity.Services.Implements;
|
||||
namespace Dlhis.Sys.Identity.Services.Implements;
|
||||
|
||||
public class UserService : IUserService
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.Identity.Services;
|
||||
using Dlhis.Sys.Menu.Request;
|
||||
using Dlhis.Sys.Menu.Response;
|
||||
using Dlhis.User.Api;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
@@ -16,13 +16,13 @@ public class MenuService : IMenuService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IUserApi _userApi;
|
||||
private readonly IUserService _userService;
|
||||
|
||||
public MenuService(IDbContext dbContext, ICurrentUser currentUser, IUserApi userApi)
|
||||
public MenuService(IDbContext dbContext, ICurrentUser currentUser, IUserService userService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUser = currentUser;
|
||||
_userApi = userApi;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
public async Task<List<MenuResponse>> GetListAsync(PlatformEnumType platform)
|
||||
@@ -270,9 +270,7 @@ public class MenuService : IMenuService
|
||||
|
||||
private async Task<List<string>> GetAllAssignmentCodesAsync()
|
||||
{
|
||||
var userApiResult = await _userApi.GetUserByIdAsync(_currentUser.GetIntSubjectId());
|
||||
(userApiResult.Code == ApiStateCode.Success).ThrowIfFalse(userApiResult.Msg);
|
||||
var user = userApiResult.Data;
|
||||
var user = await _userService.GetUserByIdAsync(_currentUser.GetIntSubjectId());
|
||||
|
||||
// var groupCodes = await GetAssignmentCodesAsync(MenuPermissionTypeEnumType.Group, manager.usergrp);
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5003"
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_URLS": "http://+:80"
|
||||
},
|
||||
"publishAllPorts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://localhost:5001",
|
||||
"UserRequestUrl": "http://localhost:5004"
|
||||
"SysRequestUrl": "http://localhost:5003"
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"AllowedHosts": "*",
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common",
|
||||
"UserRequestUrl": "http://user"
|
||||
"SysRequestUrl": "http://sys"
|
||||
},
|
||||
"SqlSugarOptions": {
|
||||
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Dlhis.User.Api;
|
||||
/// <summary>
|
||||
/// 租户Api
|
||||
/// </summary>
|
||||
[EnableRemoteClient(Name = "user-service", BaseUrl = "${InternalRequest:UserRequestUrl}")]
|
||||
[EnableRemoteClient(Name = "sys-service", BaseUrl = "${InternalRequest:SysRequestUrl}")]
|
||||
public interface ITenantApi
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -4,7 +4,7 @@ using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.User.Api;
|
||||
|
||||
[EnableRemoteClient(Name = "user-service", BaseUrl = "${InternalRequest:UserRequestUrl}")]
|
||||
[EnableRemoteClient(Name = "sys-service", BaseUrl = "${InternalRequest:SysRequestUrl}")]
|
||||
public interface IUserApi
|
||||
{
|
||||
[Auth]
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -7,7 +7,6 @@ EXPOSE 80
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.User/Dlhis.User.csproj", "Src/Dlhis.User/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
RUN dotnet restore "Src/Dlhis.User/Dlhis.User.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Src/Dlhis.User"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
|
||||
namespace Dlhis.User.Packs;
|
||||
|
||||
public class SqlSugarPack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddSqlSugar();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,14 @@
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5004"
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_URLS": "http://+:80"
|
||||
},
|
||||
"publishAllPorts": true
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||
|
||||
@@ -56,14 +56,6 @@
|
||||
"Args": {
|
||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "MySQL",
|
||||
"Args": {
|
||||
"connectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=log;charset=utf8mb4;",
|
||||
"tableName": "Logs",
|
||||
"autoCreateSqlTable": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user