1. 修改航线编辑

2. minio删除对象方法优化
feature-flyModify
陈伟 2025-06-17 09:08:02 +08:00
parent 3d11190388
commit c1d824ebf3
3 changed files with 17 additions and 6 deletions

View File

@ -126,6 +126,11 @@ public class MinioService
{
try
{
if (objectName.StartsWith("http"))
{
objectName = objectName.Replace($"http://{endPoint}/{_bucketName}/", "");
}
var deleteargs = new RemoveObjectArgs().WithBucket(_bucketName).WithObject(objectName);
await _minioClient.RemoveObjectAsync(deleteargs);
Console.WriteLine($"File {objectName} deleted.");
@ -168,7 +173,7 @@ public class MinioService
.WithContentType("application/octet-stream");
//.WithContentType(file.ContentType);
await _minioClient.PutObjectAsync(putArgs);
return "";
return "http://" + endPoint + "/" + bucketName + "/" + objectName;
}
catch (Exception ex)
{

View File

@ -259,12 +259,19 @@ namespace OpenAuth.App.ServiceApp
//编辑航线
public async Task<Response<bool>> EditAirLine(LasaAirLine lasaAirLine)
{
var oldLasaAirLine = await Repository.ChangeRepository<SugarRepositiry<LasaAirLine>>()
.GetByIdAsync(lasaAirLine.Id);
using (var db = UnitWork.CreateContext())
{
var flag = await db.LasaAirLine.UpdateAsync(lasaAirLine);
if (db.Commit())
{
// http://175.27.168.120:6013/test/2025061617111990020017.wpml
var wmpl = oldLasaAirLine.WPML;
await _minioService.DeleteFile(wmpl);
return new Response<bool> { Result = true, Message = "编辑成功" };
else
}
return new Response<bool> { Result = false, Message = "编辑失败" };
}
}

View File

@ -253,7 +253,6 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
if (xmlFile == null || xmlFile.Length == 0)
return BadRequest("文件为空");
var path = await _app.UploadFile(xmlFile);
return Ok(new { message = "上传成功", path });
}