parent
3d11190388
commit
c1d824ebf3
|
|
@ -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.");
|
||||
|
|
@ -155,7 +160,7 @@ public class MinioService
|
|||
await _minioClient.MakeBucketAsync(mbArgs).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var objectName = $"{GenerateId.GenerateOrderNumber() }.wpml";
|
||||
var objectName = $"{GenerateId.GenerateOrderNumber()}.wpml";
|
||||
// 使用内存流上传
|
||||
using var stream = new MemoryStream();
|
||||
await file.CopyToAsync(stream);
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 = "编辑失败" };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue