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("充电机未连接"); + + } /// /// 仓位信息