diff --git a/Dlis.Jinko.Yikatong.sln b/Dlis.Jinko.Yikatong.sln index e0c233c7..4f58662e 100644 --- a/Dlis.Jinko.Yikatong.sln +++ b/Dlis.Jinko.Yikatong.sln @@ -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 diff --git a/Src/Dlhis.Basic/Dlhis.Basic.csproj b/Src/Dlhis.Basic/Dlhis.Basic.csproj index 507dbc49..a881d873 100644 --- a/Src/Dlhis.Basic/Dlhis.Basic.csproj +++ b/Src/Dlhis.Basic/Dlhis.Basic.csproj @@ -24,7 +24,7 @@ - + diff --git a/Src/Dlhis.Basic/appsettings.Development.json b/Src/Dlhis.Basic/appsettings.Development.json index e5eed0cf..ae653872 100644 --- a/Src/Dlhis.Basic/appsettings.Development.json +++ b/Src/Dlhis.Basic/appsettings.Development.json @@ -7,7 +7,7 @@ }, "InternalRequest": { "CommonRequestUrl": "http://localhost:5001", - "UserRequestUrl": "http://localhost:5004" + "SysRequestUrl": "http://localhost:5003" }, "SwaggerOptions": { "Enable": true, diff --git a/Src/Dlhis.Basic/appsettings.json b/Src/Dlhis.Basic/appsettings.json index 4c7bbab3..f9ac3d8f 100644 --- a/Src/Dlhis.Basic/appsettings.json +++ b/Src/Dlhis.Basic/appsettings.json @@ -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=", diff --git a/Src/Dlhis.Common/Dlhis.Common.csproj b/Src/Dlhis.Common/Dlhis.Common.csproj index e3687200..69affc46 100644 --- a/Src/Dlhis.Common/Dlhis.Common.csproj +++ b/Src/Dlhis.Common/Dlhis.Common.csproj @@ -20,10 +20,6 @@ - - - - diff --git a/Src/Dlhis.Common/EnumSetting/EnumsController.cs b/Src/Dlhis.Common/EnumSetting/EnumsController.cs index 030e8127..f930928c 100644 --- a/Src/Dlhis.Common/EnumSetting/EnumsController.cs +++ b/Src/Dlhis.Common/EnumSetting/EnumsController.cs @@ -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; diff --git a/Src/Dlhis.Common/FileOperation/Configurations/MinIOOptions.cs b/Src/Dlhis.Common/FileOperation/Configurations/MinIOOptions.cs new file mode 100644 index 00000000..5d1cd799 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Configurations/MinIOOptions.cs @@ -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; } +} diff --git a/Src/Dlhis.Common/FileOperation/Controllers/ApkFileController.cs b/Src/Dlhis.Common/FileOperation/Controllers/ApkFileController.cs new file mode 100644 index 00000000..fceeb505 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Controllers/ApkFileController.cs @@ -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; + +/// +/// 文件上传/下载 +/// +[Authorize] +[Route("api/[controller]")] +[ApiController] +public class ApkFileController : ControllerBase +{ + private IApkFIileService _apkFIileService; + + public ApkFileController(IApkFIileService apkFIileService) + { + _apkFIileService = apkFIileService; + } + /// + /// minlo文件上传 + /// + /// + /// + [HttpPost("minlo")] + public async Task FormSingleFileUpload([FromForm] ApkRequest request) + { + return await _apkFIileService.FormSingleFileUpload(request); + } + + /// + /// minlo文件下载 + /// + /// + /// + [HttpGet("url")] + public async Task RequestDownloadFile(string fileName) + { + return await _apkFIileService.RequestDownloadFile(fileName); + } + + + /// + /// 本地文件上传 + /// + /// + /// + [HttpPost("local")] + [RequestSizeLimit(100_000_0000)] + + public async Task FormLocalFileUpload([FromForm] ApkRequest request) + { + return await _apkFIileService.FormLocalFileUpload(request); + } + + /// + /// 本地文件下载 + /// + /// + /// + [HttpGet("local")] + public IActionResult FormLocalDownloadFile(string filePath) + { + return _apkFIileService.FormLocalDownloadFile(filePath); + } +} + + + diff --git a/Src/Dlhis.Common/FileOperation/Controllers/FileController.cs b/Src/Dlhis.Common/FileOperation/Controllers/FileController.cs new file mode 100644 index 00000000..46fb28f3 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Controllers/FileController.cs @@ -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; + } + + /// + /// 文件上传 + /// + /// + /// 相对路径 + [HttpPost("{Bucket}/upload")] + public async Task UploadFileAsync([FromForm] UploadFileReuqest request) + { + return await _minioService.UploadFileAsync(request.Bucket, request.File); + } +} diff --git a/Src/Dlhis.Common/FileOperation/Request/UploadFileReuqest.cs b/Src/Dlhis.Common/FileOperation/Request/UploadFileReuqest.cs new file mode 100644 index 00000000..1863e728 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Request/UploadFileReuqest.cs @@ -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; } +} diff --git a/Src/Dlhis.Common/FileOperation/Response/ApkFileResponse.cs b/Src/Dlhis.Common/FileOperation/Response/ApkFileResponse.cs new file mode 100644 index 00000000..6f26307e --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Response/ApkFileResponse.cs @@ -0,0 +1,27 @@ +using SqlSugar; + +namespace Dlhis.Common.FileOperation.Response +{ + public class ApkFileResponse + { + /// + /// 文件名称 + /// + public string Name { get; set; } + + /// + /// 地址 + /// + public string Url { get; set; } + + /// + /// 版本号 + /// + public int VersionCode { get; set; } + + /// + /// 修改信息 + /// + public string UpdateMessage { get; set; } + } +} diff --git a/Src/Dlhis.Common/Response/CommonEnumResponse.cs b/Src/Dlhis.Common/FileOperation/Response/CommonEnumResponse.cs similarity index 79% rename from Src/Dlhis.Common/Response/CommonEnumResponse.cs rename to Src/Dlhis.Common/FileOperation/Response/CommonEnumResponse.cs index 68a3d718..06a5a66e 100644 --- a/Src/Dlhis.Common/Response/CommonEnumResponse.cs +++ b/Src/Dlhis.Common/FileOperation/Response/CommonEnumResponse.cs @@ -1,4 +1,4 @@ -namespace Dlhis.Common.Response +namespace Dlhis.Common.FileOperation.Response { public class CommonEnumResponse { diff --git a/Src/Dlhis.Common/FileOperation/Response/KeyValueDto.cs b/Src/Dlhis.Common/FileOperation/Response/KeyValueDto.cs new file mode 100644 index 00000000..f7cc487f --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Response/KeyValueDto.cs @@ -0,0 +1,8 @@ +namespace Dlhis.Common.FileOperation.Response; + +public class KeyValueDto +{ + public string Key { get; set; } + + public object Value { get; set; } +} diff --git a/Src/Dlhis.Common/FileOperation/Services/IApkFIileService.cs b/Src/Dlhis.Common/FileOperation/Services/IApkFIileService.cs new file mode 100644 index 00000000..e53ab808 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Services/IApkFIileService.cs @@ -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 +{ + /// + /// 文件上传 + /// + /// + /// + Task FormSingleFileUpload(ApkRequest request); + + /// + /// 文件下载 + /// + /// + Task RequestDownloadFile(string fileName); + + /// + /// 本地上传 + /// + /// + /// + Task FormLocalFileUpload(ApkRequest request); + /// + /// 本地下载 + /// + /// + /// + IActionResult FormLocalDownloadFile(string filePath); +} + + + diff --git a/Src/Dlhis.Common/FileOperation/Services/IMinioService.cs b/Src/Dlhis.Common/FileOperation/Services/IMinioService.cs new file mode 100644 index 00000000..7fd36cc2 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Services/IMinioService.cs @@ -0,0 +1,21 @@ +using Dlhis.Common.Request; + +namespace Dlhis.Common.FileOperation.Services; + +public interface IMinioService : ISingletonDependency +{ + Task MinloUploadFileAsync(ApkRequest request); + + Task MinloDownloadLinkAsync(string fileName); + + Task MinloRemoveFileAsync(string fileName); + + + + Task ExistsBucketAsync(string bucket); + + Task ExistsFileAsync(string bucket, string objectName); + + Task UploadFileAsync(string bucket, IFormFile formFile); + +} diff --git a/Src/Dlhis.Common/FileOperation/Services/Implements/ApkFIileService.cs b/Src/Dlhis.Common/FileOperation/Services/Implements/ApkFIileService.cs new file mode 100644 index 00000000..ab146490 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Services/Implements/ApkFIileService.cs @@ -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; + } + + /// + /// 文件上传 + /// + /// + /// + public async Task FormSingleFileUpload(ApkRequest request) + { + //上传 + var fileUrl = await _minioService.MinloUploadFileAsync(request); + + string fileName = request.formFile.FileName; + + //更新数据库 + var entity = await _dbContext.Queryable().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().Where(x => x.Name == fileName).FirstAsync(); + var res = newEntity.Adapt(); + return res; + } + + /// + /// 文件下载 + /// + /// + public async Task RequestDownloadFile(string fileName) + { + return await _minioService.MinloDownloadLinkAsync(fileName); + } + + /// + /// 本地文件上传 + /// + /// + /// + public async Task 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().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().Where(x => x.Name == fileName).FirstAsync(); + var res = newEntity.Adapt(); + 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; + } + } + + + /// + /// 本地下载 + /// + /// + /// + public IActionResult FormLocalDownloadFile(string filePath) + { + string fileName = Path.GetFileName(filePath); + return new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName }; + } +} + + diff --git a/Src/Dlhis.Common/FileOperation/Services/Implements/MinioService.cs b/Src/Dlhis.Common/FileOperation/Services/Implements/MinioService.cs new file mode 100644 index 00000000..3abff519 --- /dev/null +++ b/Src/Dlhis.Common/FileOperation/Services/Implements/MinioService.cs @@ -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 options) + { + _client = client; + _minIOOptions = options.Value; + } + + public async Task 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 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 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}"; + } + + + /// + /// 上传文件 + /// + /// + /// + public async Task 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; + } + + /// + /// 文件下载链接 + /// + /// + public async Task 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; + } + } + + + /// + /// 单个删除文件 + /// + /// + /// + public async Task MinloRemoveFileAsync(string fileName) + { + await _client.RemoveObjectAsync(new RemoveObjectArgs() + .WithBucket(_minIOOptions.DefaultBucket) + .WithObject(fileName)); + } + +} diff --git a/Src/Dlhis.Common/Packs/MinioPack.cs b/Src/Dlhis.Common/Packs/MinioPack.cs index d987ec99..dd601657 100644 --- a/Src/Dlhis.Common/Packs/MinioPack.cs +++ b/Src/Dlhis.Common/Packs/MinioPack.cs @@ -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>().Value; + return new MinioClient().WithEndpoint(new Uri(config.Endpoint)) + .WithCredentials(config.AccessKey, config.SecretKey) + .Build(); + }); } +} diff --git a/Src/Dlhis.Common/Response/KeyValueDto.cs b/Src/Dlhis.Common/Response/KeyValueDto.cs deleted file mode 100644 index 26e64747..00000000 --- a/Src/Dlhis.Common/Response/KeyValueDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Dlhis.Common.Response -{ - public class KeyValueDto - { - public string Key { get; set; } - public object Value { get; set; } - } -} diff --git a/Src/Dlhis.Common/Services/IMinioService.cs b/Src/Dlhis.Common/Services/IMinioService.cs deleted file mode 100644 index 0e7c4a56..00000000 --- a/Src/Dlhis.Common/Services/IMinioService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Dlhis.Common.Request; - -namespace Dlhis.Common.Services -{ - public interface IMinioService : IScopeDependency - { - Task MinloUploadFileAsync(ApkRequest request); - Task MinloDownloadLinkAsync(string fileName); - Task MinloRemoveFileAsync(string fileName); - } -} diff --git a/Src/Dlhis.Common/Services/Implements/ApkFIileService.cs b/Src/Dlhis.Common/Services/Implements/ApkFIileService.cs index f96fa496..cc6800bd 100644 --- a/Src/Dlhis.Common/Services/Implements/ApkFIileService.cs +++ b/Src/Dlhis.Common/Services/Implements/ApkFIileService.cs @@ -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; diff --git a/Src/Dlhis.Common/Services/Implements/MinioService.cs b/Src/Dlhis.Common/Services/Implements/MinioService.cs deleted file mode 100644 index 4a932690..00000000 --- a/Src/Dlhis.Common/Services/Implements/MinioService.cs +++ /dev/null @@ -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; - } - - - /// - /// 上传文件 - /// - /// - /// - public async Task 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; - } - - /// - /// 文件下载链接 - /// - /// - public async Task 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; - } - } - - - /// - /// 单个删除文件 - /// - /// - /// - public async Task MinloRemoveFileAsync(string fileName) - { - await _client.RemoveObjectAsync(new RemoveObjectArgs() - .WithBucket(bucketName) - .WithObject(fileName)); - } - - } -} diff --git a/Src/Dlhis.Common/appsettings.Development.json b/Src/Dlhis.Common/appsettings.Development.json index 32a011f5..11bc9e44 100644 --- a/Src/Dlhis.Common/appsettings.Development.json +++ b/Src/Dlhis.Common/appsettings.Development.json @@ -33,10 +33,10 @@ //服务器IP "Endpoint": "http://192.168.199.124:9000", //账号 - "AccessKey": "Zbjj05OFtR19e5TJopQU", + "AccessKey": "oQ7tD55EVNElIoO3D43r", //密码 - "SecretKey": "UMXtNdZhufhAAyYJ3XND4cEgZNUsgOWtbUzksizK", + "SecretKey": "3eWLaAFQ9fnFx8pOp5SgJogoF47ecAH6dcCWlyAp", //默认存储桶 - "Bucket": "apk" + "DefaultBucket": "apk" } } diff --git a/Src/Dlhis.Common/appsettings.json b/Src/Dlhis.Common/appsettings.json index 06b8f3e0..b0af5f26 100644 --- a/Src/Dlhis.Common/appsettings.json +++ b/Src/Dlhis.Common/appsettings.json @@ -45,7 +45,7 @@ //密码 "SecretKey": "UMXtNdZhufhAAyYJ3XND4cEgZNUsgOWtbUzksizK", //apk默认存储桶 - "Bucket": "apk" + "DefaultBucket": "apk" }, "Serilog": { "MinimumLevel": { diff --git a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj index b93d3f71..55719d72 100644 --- a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj +++ b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj @@ -22,11 +22,12 @@ + - + diff --git a/Src/Dlhis.ScheduledTask/Dockerfile b/Src/Dlhis.ScheduledTask/Dockerfile index 8db1c218..106390f5 100644 --- a/Src/Dlhis.ScheduledTask/Dockerfile +++ b/Src/Dlhis.ScheduledTask/Dockerfile @@ -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" diff --git a/Src/Dlhis.Sys/Dlhis.Sys.csproj b/Src/Dlhis.Sys/Dlhis.Sys.csproj index 2fa7f453..fe92dc2c 100644 --- a/Src/Dlhis.Sys/Dlhis.Sys.csproj +++ b/Src/Dlhis.Sys/Dlhis.Sys.csproj @@ -18,11 +18,11 @@ + - diff --git a/Src/Dlhis.Sys/Dockerfile b/Src/Dlhis.Sys/Dockerfile index 44238aec..036437ee 100644 --- a/Src/Dlhis.Sys/Dockerfile +++ b/Src/Dlhis.Sys/Dockerfile @@ -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" diff --git a/Src/Dlhis.User/Identity/Controllers/RolesController.cs b/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs similarity index 86% rename from Src/Dlhis.User/Identity/Controllers/RolesController.cs rename to Src/Dlhis.Sys/Identity/Controllers/RolesController.cs index be7468ac..ae0ba399 100644 --- a/Src/Dlhis.User/Identity/Controllers/RolesController.cs +++ b/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs @@ -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; /// /// 角色 diff --git a/Src/Dlhis.User/Identity/Controllers/TenantsController.cs b/Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs similarity index 90% rename from Src/Dlhis.User/Identity/Controllers/TenantsController.cs rename to Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs index 36862536..578347eb 100644 --- a/Src/Dlhis.User/Identity/Controllers/TenantsController.cs +++ b/Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs @@ -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]")] diff --git a/Src/Dlhis.User/Identity/Controllers/UsersController.cs b/Src/Dlhis.Sys/Identity/Controllers/UsersController.cs similarity index 77% rename from Src/Dlhis.User/Identity/Controllers/UsersController.cs rename to Src/Dlhis.Sys/Identity/Controllers/UsersController.cs index 84ad6832..229708bc 100644 --- a/Src/Dlhis.User/Identity/Controllers/UsersController.cs +++ b/Src/Dlhis.Sys/Identity/Controllers/UsersController.cs @@ -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; /// /// 用户 @@ -44,6 +44,11 @@ public class UsersController : ControllerBase return await _userService.GetUsersAsync(); } + /// + /// 根据id获取用户 + /// + /// + /// [Authorize] [HttpGet] public async Task GetUserByIdAsync(int id) @@ -51,6 +56,11 @@ public class UsersController : ControllerBase return await _userService.GetUserByIdAsync(id); } + /// + /// 上传头像 + /// + /// + /// [Authorize] [HttpPost("avatar")] public async Task UploadUserAvatarAsync([FromForm] UserAvatarUploadRequest request) diff --git a/Src/Dlhis.Sys/Identity/Request/ClientGrantRequest.cs b/Src/Dlhis.Sys/Identity/Request/ClientGrantRequest.cs new file mode 100644 index 00000000..b91e5398 --- /dev/null +++ b/Src/Dlhis.Sys/Identity/Request/ClientGrantRequest.cs @@ -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"; +} diff --git a/Src/Dlhis.User/Identity/Request/RolePageRequest.cs b/Src/Dlhis.Sys/Identity/Request/RolePageRequest.cs similarity index 67% rename from Src/Dlhis.User/Identity/Request/RolePageRequest.cs rename to Src/Dlhis.Sys/Identity/Request/RolePageRequest.cs index cd83c5a7..2c0ceab3 100644 --- a/Src/Dlhis.User/Identity/Request/RolePageRequest.cs +++ b/Src/Dlhis.Sys/Identity/Request/RolePageRequest.cs @@ -1,6 +1,6 @@ using Kurisu.Core.DataAccess.Dto; -namespace Dlhis.User.Identity.Request; +namespace Dlhis.Sys.Identity.Request; public class RolePageRequest : PageDto { diff --git a/Src/Dlhis.User/Identity/Request/TenantPageRequest.cs b/Src/Dlhis.Sys/Identity/Request/TenantPageRequest.cs similarity index 72% rename from Src/Dlhis.User/Identity/Request/TenantPageRequest.cs rename to Src/Dlhis.Sys/Identity/Request/TenantPageRequest.cs index 6dbe5a50..f5a5704a 100644 --- a/Src/Dlhis.User/Identity/Request/TenantPageRequest.cs +++ b/Src/Dlhis.Sys/Identity/Request/TenantPageRequest.cs @@ -1,6 +1,6 @@ using Kurisu.Core.DataAccess.Dto; -namespace Dlhis.User.Identity.Request +namespace Dlhis.Sys.Identity.Request { public class TenantPageRequest : PageDto { diff --git a/Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs b/Src/Dlhis.Sys/Identity/Request/UserAvatarUploadRequest.cs similarity index 90% rename from Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs rename to Src/Dlhis.Sys/Identity/Request/UserAvatarUploadRequest.cs index 319f97ae..c0838d03 100644 --- a/Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs +++ b/Src/Dlhis.Sys/Identity/Request/UserAvatarUploadRequest.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Dlhis.User.Identity.Request; +namespace Dlhis.Sys.Identity.Request; public class UserAvatarUploadRequest { diff --git a/Src/Dlhis.User/Identity/Request/UserPageRequest.cs b/Src/Dlhis.Sys/Identity/Request/UserPageRequest.cs similarity index 67% rename from Src/Dlhis.User/Identity/Request/UserPageRequest.cs rename to Src/Dlhis.Sys/Identity/Request/UserPageRequest.cs index 578d3daa..3184123a 100644 --- a/Src/Dlhis.User/Identity/Request/UserPageRequest.cs +++ b/Src/Dlhis.Sys/Identity/Request/UserPageRequest.cs @@ -1,6 +1,6 @@ using Kurisu.Core.DataAccess.Dto; -namespace Dlhis.User.Identity.Request; +namespace Dlhis.Sys.Identity.Request; public class UserPageRequest : PageDto { diff --git a/Src/Dlhis.User/Identity/Response/RoleRespone.cs b/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs similarity index 77% rename from Src/Dlhis.User/Identity/Response/RoleRespone.cs rename to Src/Dlhis.Sys/Identity/Response/RoleRespone.cs index 7ad308cb..0b233448 100644 --- a/Src/Dlhis.User/Identity/Response/RoleRespone.cs +++ b/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs @@ -1,4 +1,4 @@ -namespace Dlhis.User.Identity.Response; +namespace Dlhis.Sys.Identity.Response; public class RoleRespone { diff --git a/Src/Dlhis.User/Identity/Response/TenantResponse.cs b/Src/Dlhis.Sys/Identity/Response/TenantResponse.cs similarity index 76% rename from Src/Dlhis.User/Identity/Response/TenantResponse.cs rename to Src/Dlhis.Sys/Identity/Response/TenantResponse.cs index 46b131c5..1949b745 100644 --- a/Src/Dlhis.User/Identity/Response/TenantResponse.cs +++ b/Src/Dlhis.Sys/Identity/Response/TenantResponse.cs @@ -1,4 +1,4 @@ -namespace Dlhis.User.Identity.Response; +namespace Dlhis.Sys.Identity.Response; public class TenantResponse { diff --git a/Src/Dlhis.User/Identity/Response/UserResponse.cs b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs similarity index 93% rename from Src/Dlhis.User/Identity/Response/UserResponse.cs rename to Src/Dlhis.Sys/Identity/Response/UserResponse.cs index 8269d1b2..d11dec11 100644 --- a/Src/Dlhis.User/Identity/Response/UserResponse.cs +++ b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs @@ -1,4 +1,4 @@ -namespace Dlhis.User.Identity.Response; +namespace Dlhis.Sys.Identity.Response; public class UserResponse { diff --git a/Src/Dlhis.User/Identity/Services/IRoleService.cs b/Src/Dlhis.Sys/Identity/Services/IRoleService.cs similarity index 73% rename from Src/Dlhis.User/Identity/Services/IRoleService.cs rename to Src/Dlhis.Sys/Identity/Services/IRoleService.cs index 78930ffd..41af7fd6 100644 --- a/Src/Dlhis.User/Identity/Services/IRoleService.cs +++ b/Src/Dlhis.Sys/Identity/Services/IRoleService.cs @@ -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; diff --git a/Src/Dlhis.User/Identity/Services/ITenantService.cs b/Src/Dlhis.Sys/Identity/Services/ITenantService.cs similarity index 70% rename from Src/Dlhis.User/Identity/Services/ITenantService.cs rename to Src/Dlhis.Sys/Identity/Services/ITenantService.cs index 1edb801e..6fadc229 100644 --- a/Src/Dlhis.User/Identity/Services/ITenantService.cs +++ b/Src/Dlhis.Sys/Identity/Services/ITenantService.cs @@ -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 { diff --git a/Src/Dlhis.User/Identity/Services/IUserService.cs b/Src/Dlhis.Sys/Identity/Services/IUserService.cs similarity index 76% rename from Src/Dlhis.User/Identity/Services/IUserService.cs rename to Src/Dlhis.Sys/Identity/Services/IUserService.cs index 53932ffb..98932a32 100644 --- a/Src/Dlhis.User/Identity/Services/IUserService.cs +++ b/Src/Dlhis.Sys/Identity/Services/IUserService.cs @@ -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 { diff --git a/Src/Dlhis.User/Identity/Services/Implements/RoleService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs similarity index 82% rename from Src/Dlhis.User/Identity/Services/Implements/RoleService.cs rename to Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs index d501d200..40f341a4 100644 --- a/Src/Dlhis.User/Identity/Services/Implements/RoleService.cs +++ b/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs @@ -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 { diff --git a/Src/Dlhis.User/Identity/Services/Implements/TenantService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs similarity index 90% rename from Src/Dlhis.User/Identity/Services/Implements/TenantService.cs rename to Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs index 43be5531..80ecab0d 100644 --- a/Src/Dlhis.User/Identity/Services/Implements/TenantService.cs +++ b/Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs @@ -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 { diff --git a/Src/Dlhis.User/Identity/Services/Implements/UserService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs similarity index 93% rename from Src/Dlhis.User/Identity/Services/Implements/UserService.cs rename to Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs index 4845f537..809b6cd3 100644 --- a/Src/Dlhis.User/Identity/Services/Implements/UserService.cs +++ b/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs @@ -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 { diff --git a/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs b/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs index 16f9c883..bb4af71b 100644 --- a/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs +++ b/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs @@ -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> GetListAsync(PlatformEnumType platform) @@ -270,9 +270,7 @@ public class MenuService : IMenuService private async Task> 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); diff --git a/Src/Dlhis.Sys/Properties/launchSettings.json b/Src/Dlhis.Sys/Properties/launchSettings.json index f52c9c8c..9e5d357b 100644 --- a/Src/Dlhis.Sys/Properties/launchSettings.json +++ b/Src/Dlhis.Sys/Properties/launchSettings.json @@ -7,6 +7,14 @@ }, "dotnetRunMessages": true, "applicationUrl": "http://localhost:5003" + }, + "Docker": { + "commandName": "Docker", + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_URLS": "http://+:80" + }, + "publishAllPorts": true } } } \ No newline at end of file diff --git a/Src/Dlhis.Sys/appsettings.Development.json b/Src/Dlhis.Sys/appsettings.Development.json index e5eed0cf..ae653872 100644 --- a/Src/Dlhis.Sys/appsettings.Development.json +++ b/Src/Dlhis.Sys/appsettings.Development.json @@ -7,7 +7,7 @@ }, "InternalRequest": { "CommonRequestUrl": "http://localhost:5001", - "UserRequestUrl": "http://localhost:5004" + "SysRequestUrl": "http://localhost:5003" }, "SwaggerOptions": { "Enable": true, diff --git a/Src/Dlhis.Sys/appsettings.json b/Src/Dlhis.Sys/appsettings.json index 7e589004..eed08175 100644 --- a/Src/Dlhis.Sys/appsettings.json +++ b/Src/Dlhis.Sys/appsettings.json @@ -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;", diff --git a/Src/Dlhis.User.Api/Dlhis.User.Api.csproj b/Src/Dlhis.User.Api/Dlhis.Sys.Api.csproj similarity index 100% rename from Src/Dlhis.User.Api/Dlhis.User.Api.csproj rename to Src/Dlhis.User.Api/Dlhis.Sys.Api.csproj diff --git a/Src/Dlhis.User.Api/ITenantApi.cs b/Src/Dlhis.User.Api/ITenantApi.cs index f9515bb1..f6b1dfb1 100644 --- a/Src/Dlhis.User.Api/ITenantApi.cs +++ b/Src/Dlhis.User.Api/ITenantApi.cs @@ -7,7 +7,7 @@ namespace Dlhis.User.Api; /// /// 租户Api /// -[EnableRemoteClient(Name = "user-service", BaseUrl = "${InternalRequest:UserRequestUrl}")] +[EnableRemoteClient(Name = "sys-service", BaseUrl = "${InternalRequest:SysRequestUrl}")] public interface ITenantApi { /// diff --git a/Src/Dlhis.User.Api/IUserApi.cs b/Src/Dlhis.User.Api/IUserApi.cs index 1e52028b..2437c11d 100644 --- a/Src/Dlhis.User.Api/IUserApi.cs +++ b/Src/Dlhis.User.Api/IUserApi.cs @@ -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] diff --git a/Src/Dlhis.User/Dlhis.User.csproj b/Src/Dlhis.User/Dlhis.User.csproj index fa15b059..78c08d85 100644 --- a/Src/Dlhis.User/Dlhis.User.csproj +++ b/Src/Dlhis.User/Dlhis.User.csproj @@ -18,9 +18,6 @@ - - - - + diff --git a/Src/Dlhis.User/Dockerfile b/Src/Dlhis.User/Dockerfile index f8459494..75d24763 100644 --- a/Src/Dlhis.User/Dockerfile +++ b/Src/Dlhis.User/Dockerfile @@ -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" diff --git a/Src/Dlhis.User/Packs/SqlSugarPack.cs b/Src/Dlhis.User/Packs/SqlSugarPack.cs deleted file mode 100644 index bfb8cc3c..00000000 --- a/Src/Dlhis.User/Packs/SqlSugarPack.cs +++ /dev/null @@ -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(); - } -} diff --git a/Src/Dlhis.User/Properties/launchSettings.json b/Src/Dlhis.User/Properties/launchSettings.json index 5ea15179..8bf84199 100644 --- a/Src/Dlhis.User/Properties/launchSettings.json +++ b/Src/Dlhis.User/Properties/launchSettings.json @@ -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" diff --git a/Src/Dlhis.User/appsettings.json b/Src/Dlhis.User/appsettings.json index ec86779d..990506f2 100644 --- a/Src/Dlhis.User/appsettings.json +++ b/Src/Dlhis.User/appsettings.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 - } } ] }