手动鉴权,功率调节

zw
tq 6 months ago
parent e42f8981bf
commit c7ae5b25c8

@ -259,10 +259,11 @@ public partial class BinInfoResp
/// Nullable: /// Nullable:
/// </summary> /// </summary>
public DateTime? ChargingStopTime { get; set; } public DateTime? ChargingStopTime { get; set; }
/// <summary> /// <summary>
/// 是否鉴权 /// 是否鉴权
/// Default:
/// Nullable:
/// </summary> /// </summary>
public bool IsAuthed { get; set; } public bool IsAuthed { get; set; } = false;
} }

@ -27,7 +27,60 @@ public class ChargeController : ControllerBase
_chargerService = chargerService; _chargerService = chargerService;
_binInfoService = binInfoService; _binInfoService = binInfoService;
} }
/// <summary>
/// 获取充电机code列表
/// </summary>
/// <returns>充电机code列表返回</returns>
[HttpGet]
[Route("GetChargerCodeList")]
public async Task<Result<List<string>>> GetChargerCodeList()
{
List<string> keysList = new List<string>(ClientMgr.Dictionary.Keys);
return Result<List<string>>.Success(keysList);
}
/// <summary>
/// 给充电机发鉴权
/// </summary>
/// <param name="code">充电机编码</param>
/// <returns>发送结果</returns>
[HttpGet]
[Route("ChargerSendAuth/{code}")]
public Result<bool> ChargerSendAuth(string code)
{
ChargerClient? chargerClient = ClientMgr.GetBySn(code);
if (chargerClient != null)
{
chargerClient.SendAuth();
return Result<bool>.Success(true);
}
return Result<bool>.Fail("充电机未连接");
}
/// <summary>
/// 给充电机发送功率调节指令
/// </summary>
/// <param name="code">充电机编码</param>
/// <returns>发送结果</returns>
[HttpGet]
[Route("SendPowerRegulation/{code}/{power}")]
public Result<bool> SendPowerRegulation(string code,float power)
{
ChargerClient? chargerClient = ClientMgr.GetBySn(code);
if (chargerClient != null)
{
chargerClient.SendPowerRegulation(power);
return Result<bool>.Success(true);
}
return Result<bool>.Fail("充电机未连接");
}
/// <summary> /// <summary>
/// 仓位信息 /// 仓位信息

Loading…
Cancel
Save