From c7ae5b25c8fc6bee7bef1e8818d7d2335e8a4f2f Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Wed, 12 Jun 2024 18:36:48 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E9=89=B4=E6=9D=83,=E5=8A=9F?=
=?UTF-8?q?=E7=8E=87=E8=B0=83=E8=8A=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Dto/Resp/BinInfoResp.cs | 7 +--
WebStarter/Controllers/ChargeController.cs | 53 ++++++++++++++++++++++
2 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/Entity/Dto/Resp/BinInfoResp.cs b/Entity/Dto/Resp/BinInfoResp.cs
index a4ebc3d..5c2ded5 100644
--- a/Entity/Dto/Resp/BinInfoResp.cs
+++ b/Entity/Dto/Resp/BinInfoResp.cs
@@ -259,10 +259,11 @@ public partial class BinInfoResp
/// Nullable:
///
public DateTime? ChargingStopTime { get; set; }
-
-
///
/// 是否鉴权
+ /// Default:
+ /// Nullable:
///
- public bool IsAuthed { get; set; }
+ public bool IsAuthed { get; set; } = false;
+
}
\ No newline at end of file
diff --git a/WebStarter/Controllers/ChargeController.cs b/WebStarter/Controllers/ChargeController.cs
index 43ccb7b..f7f3235 100644
--- a/WebStarter/Controllers/ChargeController.cs
+++ b/WebStarter/Controllers/ChargeController.cs
@@ -27,7 +27,60 @@ public class ChargeController : ControllerBase
_chargerService = chargerService;
_binInfoService = binInfoService;
}
+
+ ///
+ /// 获取充电机code列表
+ ///
+ /// 充电机code列表返回
+ [HttpGet]
+ [Route("GetChargerCodeList")]
+ public async Task>> GetChargerCodeList()
+ {
+ List keysList = new List(ClientMgr.Dictionary.Keys);
+ return Result>.Success(keysList);
+ }
+
+ ///
+ /// 给充电机发鉴权
+ ///
+ /// 充电机编码
+ /// 发送结果
+ [HttpGet]
+ [Route("ChargerSendAuth/{code}")]
+ public Result ChargerSendAuth(string code)
+ {
+ ChargerClient? chargerClient = ClientMgr.GetBySn(code);
+ if (chargerClient != null)
+ {
+ chargerClient.SendAuth();
+ return Result.Success(true);
+ }
+
+ return Result.Fail("充电机未连接");
+
+ }
+
+ ///
+ /// 给充电机发送功率调节指令
+ ///
+ /// 充电机编码
+ /// 发送结果
+ [HttpGet]
+ [Route("SendPowerRegulation/{code}/{power}")]
+ public Result SendPowerRegulation(string code,float power)
+ {
+ ChargerClient? chargerClient = ClientMgr.GetBySn(code);
+
+ if (chargerClient != null)
+ {
+ chargerClient.SendPowerRegulation(power);
+ return Result.Success(true);
+ }
+
+ return Result.Fail("充电机未连接");
+
+ }
///
/// 仓位信息