From 4c03b94808a709dc4ef2d0e0470472148f04bbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E9=B9=8F?= <304594656@qq.com> Date: Tue, 11 Feb 2025 15:42:05 +0800 Subject: [PATCH] =?UTF-8?q?#=20/api/open/getdevinfo=20-=20=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Waste.Application/ThirdApiInfo/OpenService.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Waste.Application/ThirdApiInfo/OpenService.cs b/Waste.Application/ThirdApiInfo/OpenService.cs index 61601f3..4a3e8f7 100644 --- a/Waste.Application/ThirdApiInfo/OpenService.cs +++ b/Waste.Application/ThirdApiInfo/OpenService.cs @@ -446,6 +446,15 @@ namespace Waste.Application.ThirdApiInfo else if (type == "其他垃圾") return 4; else return 0; } + private string TrashTypeTitle(string type) + { + if (!int.TryParse(type, out var num)) return type; + if (num == 1) return "厨余垃圾"; + else if (num == 2) return "可回收物"; + else if (num == 3) return "有害垃圾"; + else if (num == 4) return "其他垃圾"; + else return "0"; + } private int GetTimestamp(DateTime time) { @@ -585,7 +594,7 @@ namespace Waste.Application.ThirdApiInfo ResultId = returndata.ResultId, Tare = device.Tare, trash = returndata.trash, - wastetype = type, + wastetype = TrashTypeTitle(type), weight = weight }); @@ -596,7 +605,7 @@ namespace Waste.Application.ThirdApiInfo WasteSType = "", Time = DateTime.Now, TrashCode = returndata.trash, - WasteType = type, + WasteType = TrashTypeTitle(type), Weight = weight.ToDecimal(), faccode = device.FacEcode, ecode = device.Ecode,