You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

using Entity.Api.Req;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Charger.Client;
using Service.Execute.Api;
using Service.Execute.Model;
namespace WebStarter.Controllers;
/// <summary>
/// rfid读取
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class RfidController : ControllerBase
{
/// <summary>
/// rfid写
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("BeginWrite")]
public async Task<Result<bool>> BeginWrite([FromBody] RfidWriteReq req)
{
await RfidApi.BeginWriteAsync(req.VehicleNo,req.VehicleVin);
return Result<bool>.Success(true, "发送成功");
}
/// <summary>
/// 读rfid
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("ReadRfid")]
public async Task<Result<RfidReadModel>> ReadRfid()
{
RfidReadModel? rfidReadModel = await RfidApi.ReadRfid();
if (rfidReadModel != null) return Result<RfidReadModel>.Success(rfidReadModel, "读取成功");
return Result<RfidReadModel>.Fail();
}
}