From 3e79fab29d9799e5c9388c6acf4f90c9a6b16d34 Mon Sep 17 00:00:00 2001 From: lgd Date: Tue, 15 Jul 2025 09:19:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AA=92=E4=BD=93=E5=BA=93=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceApp/AirportMaintenanceApp.cs | 31 +++++++++++++++- .../AirportMaintenanceController.cs | 35 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs b/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs index 6dcc53c..4cd47b1 100644 --- a/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs +++ b/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs @@ -15,15 +15,20 @@ using NPOI.SS.Formula.Functions; using Infrastructure.Extensions; using DocumentFormat.OpenXml.Math; using Microsoft.Extensions.Configuration; +using Infrastructure.CloudSdk.minio; namespace OpenAuth.App.ServiceApp { public class AirportMaintenanceApp : SqlSugarBaseApp { private readonly IConfiguration _configuration; - public AirportMaintenanceApp(ISugarUnitOfWork unitWork, IConfiguration configuration, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) + private readonly ISqlSugarClient _client; + private readonly MinioService _minioService; + public AirportMaintenanceApp(MinioService minioService,ISqlSugarClient client,ISugarUnitOfWork unitWork, IConfiguration configuration, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) { _configuration = configuration; + _client = client; + _minioService = minioService; } //获取设备绑定码 public async Task> GetDeviceBindingCode() @@ -351,6 +356,30 @@ namespace OpenAuth.App.ServiceApp } } + + public async Task> UpdatePicStatus(string id, int showOnMap, int display) + { + string sql = "update lasa_mediafile set \"ShowOnMap\"=" + showOnMap + ",display=" + display + " where \"Id\"='" + id+"'"; + await _client.Ado.ExecuteCommandAsync(sql); + return new Response { Result = "修改成功!" }; + } + + public async Task> deletepic(string ids) + { + string[] idarray = ids.Split(","); + + for (int i = 0; i < idarray.Length; i++) + { + string sqlselect = "select \"ObjectKey\" from lasa_mediafile where \"Id\"='"+idarray[i]+"'"; + string objectkey = _client.Ado.SqlQuerySingle(sqlselect); + string sql = "delete from lasa_mediafile where \"Id\"='"+idarray[i]+"'"; + await _client.Ado.ExecuteCommandAsync(sql); + await _minioService.DeleteFile(objectkey); + + + } + return new Response { Result = "删除成功!" }; + } } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs index dcee7f3..b0b87e6 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/AirportMaintenanceController.cs @@ -639,5 +639,40 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers } return result; } + + + [HttpGet] + [AllowAnonymous] + public async Task> UpdatePicStatus(string id, int showOnMap,int display) + { + var result = new Response(); + try + { + result = await _app.UpdatePicStatus(id, showOnMap, display); + } + catch (Exception ex) + { + result.Code = 500; + result.Message = ex.Message; + } + return result; + } + + [HttpGet] + [AllowAnonymous] + public async Task> deletepic(string ids) + { + var result = new Response(); + try + { + result = await _app.deletepic(ids); + } + catch (Exception ex) + { + result.Code = 500; + result.Message = ex.Message; + } + return result; + } } }