From b23e9ce7d462c375ea3089d5c174a4535704bf2e Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Thu, 13 Jun 2024 13:10:12 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E7=8E=87=E8=B0=83=E8=8A=82=E9=99=90?=
=?UTF-8?q?=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WebStarter/Controllers/ChargeController.cs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/WebStarter/Controllers/ChargeController.cs b/WebStarter/Controllers/ChargeController.cs
index f7f3235..815e373 100644
--- a/WebStarter/Controllers/ChargeController.cs
+++ b/WebStarter/Controllers/ChargeController.cs
@@ -68,8 +68,13 @@ public class ChargeController : ControllerBase
/// 发送结果
[HttpGet]
[Route("SendPowerRegulation/{code}/{power}")]
- public Result SendPowerRegulation(string code,float power)
+ public Result SendPowerRegulation(string code, float power)
{
+ if (power < 1 || power > 360)
+ {
+ return Result.Fail("功率值范围1到360");
+ }
+
ChargerClient? chargerClient = ClientMgr.GetBySn(code);
if (chargerClient != null)
@@ -79,7 +84,6 @@ public class ChargeController : ControllerBase
}
return Result.Fail("充电机未连接");
-
}
///