fix 移除离线时参数校验
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using Dlhis.Entity.Canteen.Enums;
|
||||||
using Dlhis.Entity.Canteen.Enums;
|
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
|
||||||
|
|
||||||
namespace Dlhis.Middle.Request;
|
namespace Dlhis.Middle.Request;
|
||||||
|
|
||||||
public class OrderAddRequest : IValidatableObject
|
public class OrderAddRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否离线数据
|
/// 是否离线数据
|
||||||
@@ -24,19 +22,13 @@ public class OrderAddRequest : IValidatableObject
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 档案号/QrCode/学工号
|
/// 档案号/QrCode/学工号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required(ErrorMessage = "人员档案号/QrCode/学工号/userId 不能为空")]
|
|
||||||
public string UserUniqueNo { get; set; }
|
public string UserUniqueNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 来源
|
/// 来源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[EnumDataType(typeof(BalanceRecordSourceEnumType))]
|
|
||||||
public BalanceRecordSourceEnumType Source { get; set; }
|
public BalanceRecordSourceEnumType Source { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 金额
|
|
||||||
/// </summary>
|
|
||||||
[Range(0.01, double.MaxValue)]
|
|
||||||
public decimal Amount { get; set; }
|
public decimal Amount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -44,20 +36,5 @@ public class OrderAddRequest : IValidatableObject
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? CostDateTime { get; set; }
|
public DateTime? CostDateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string Image { get; set; }
|
public string Image { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
||||||
{
|
|
||||||
//处理金额
|
|
||||||
Amount = -Math.Abs(Amount);
|
|
||||||
|
|
||||||
CostDateTime ??= DateTime.Now;
|
|
||||||
|
|
||||||
if (DeviceUniqueNo.IsEmpty())
|
|
||||||
{
|
|
||||||
yield return new ValidationResult("设备号不能为空", new[] { nameof(DeviceUniqueNo) });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,7 +44,7 @@ public class RemoteOrderService : IRemoteOrderService
|
|||||||
|
|
||||||
var content = new StringContent(request.ToJson(), Encoding.UTF8, "application/json");
|
var content = new StringContent(request.ToJson(), Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
var response = await httpClient.PostAsync($"https://{_hostName}/api/Canteen/Orders/device", content);
|
var response = await httpClient.PostAsync($"https://{_hostName}/api/canteen/orders", content);
|
||||||
|
|
||||||
var responseJson = await response.Content.ReadAsStringAsync();
|
var responseJson = await response.Content.ReadAsStringAsync();
|
||||||
return responseJson.ToObject<DefaultApiResult<OrderResultResponse>>();
|
return responseJson.ToObject<DefaultApiResult<OrderResultResponse>>();
|
||||||
|
|||||||
Reference in New Issue
Block a user