parent
3d11190388
commit
c1d824ebf3
|
|
@ -126,6 +126,11 @@ public class MinioService
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (objectName.StartsWith("http"))
|
||||||
|
{
|
||||||
|
objectName = objectName.Replace($"http://{endPoint}/{_bucketName}/", "");
|
||||||
|
}
|
||||||
|
|
||||||
var deleteargs = new RemoveObjectArgs().WithBucket(_bucketName).WithObject(objectName);
|
var deleteargs = new RemoveObjectArgs().WithBucket(_bucketName).WithObject(objectName);
|
||||||
await _minioClient.RemoveObjectAsync(deleteargs);
|
await _minioClient.RemoveObjectAsync(deleteargs);
|
||||||
Console.WriteLine($"File {objectName} deleted.");
|
Console.WriteLine($"File {objectName} deleted.");
|
||||||
|
|
@ -155,7 +160,7 @@ public class MinioService
|
||||||
await _minioClient.MakeBucketAsync(mbArgs).ConfigureAwait(false);
|
await _minioClient.MakeBucketAsync(mbArgs).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var objectName = $"{GenerateId.GenerateOrderNumber() }.wpml";
|
var objectName = $"{GenerateId.GenerateOrderNumber()}.wpml";
|
||||||
// 使用内存流上传
|
// 使用内存流上传
|
||||||
using var stream = new MemoryStream();
|
using var stream = new MemoryStream();
|
||||||
await file.CopyToAsync(stream);
|
await file.CopyToAsync(stream);
|
||||||
|
|
@ -166,9 +171,9 @@ public class MinioService
|
||||||
.WithStreamData(stream)
|
.WithStreamData(stream)
|
||||||
.WithObjectSize(stream.Length)
|
.WithObjectSize(stream.Length)
|
||||||
.WithContentType("application/octet-stream");
|
.WithContentType("application/octet-stream");
|
||||||
//.WithContentType(file.ContentType);
|
//.WithContentType(file.ContentType);
|
||||||
await _minioClient.PutObjectAsync(putArgs);
|
await _minioClient.PutObjectAsync(putArgs);
|
||||||
return "";
|
return "http://" + endPoint + "/" + bucketName + "/" + objectName;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -259,13 +259,20 @@ namespace OpenAuth.App.ServiceApp
|
||||||
//编辑航线
|
//编辑航线
|
||||||
public async Task<Response<bool>> EditAirLine(LasaAirLine lasaAirLine)
|
public async Task<Response<bool>> EditAirLine(LasaAirLine lasaAirLine)
|
||||||
{
|
{
|
||||||
|
var oldLasaAirLine = await Repository.ChangeRepository<SugarRepositiry<LasaAirLine>>()
|
||||||
|
.GetByIdAsync(lasaAirLine.Id);
|
||||||
using (var db = UnitWork.CreateContext())
|
using (var db = UnitWork.CreateContext())
|
||||||
{
|
{
|
||||||
var flag = await db.LasaAirLine.UpdateAsync(lasaAirLine);
|
var flag = await db.LasaAirLine.UpdateAsync(lasaAirLine);
|
||||||
if (db.Commit())
|
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 = "编辑成功" };
|
return new Response<bool> { Result = true, Message = "编辑成功" };
|
||||||
else
|
}
|
||||||
return new Response<bool> { Result = false, Message = "编辑失败" };
|
|
||||||
|
return new Response<bool> { Result = false, Message = "编辑失败" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,6 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
||||||
{
|
{
|
||||||
if (xmlFile == null || xmlFile.Length == 0)
|
if (xmlFile == null || xmlFile.Length == 0)
|
||||||
return BadRequest("文件为空");
|
return BadRequest("文件为空");
|
||||||
|
|
||||||
var path = await _app.UploadFile(xmlFile);
|
var path = await _app.UploadFile(xmlFile);
|
||||||
return Ok(new { message = "上传成功", path });
|
return Ok(new { message = "上传成功", path });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue