fix 配置时间校验分秒
This commit is contained in:
@@ -9,6 +9,7 @@ using Kurisu.SqlSugar.Extensions;
|
|||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ public class CanteenSettingService : ICanteenSettingService
|
|||||||
var result = request.Item switch
|
var result = request.Item switch
|
||||||
{
|
{
|
||||||
//TimeOnly
|
//TimeOnly
|
||||||
CanteenSettingItemEnumType.BusinessSwitchTime => IsValidFormat<TimeOnly>(value),
|
CanteenSettingItemEnumType.BusinessSwitchTime => IsValidFormat<TimeOnly>(value, request.Item),
|
||||||
|
|
||||||
//int
|
//int
|
||||||
CanteenSettingItemEnumType.DayEVoucherUseCountMax => IsValidFormat<int>(value),
|
CanteenSettingItemEnumType.DayEVoucherUseCountMax => IsValidFormat<int>(value),
|
||||||
@@ -88,9 +89,9 @@ public class CanteenSettingService : ICanteenSettingService
|
|||||||
CanteenSettingItemEnumType.InitBalance => IsValidFormat<decimal>(value),
|
CanteenSettingItemEnumType.InitBalance => IsValidFormat<decimal>(value),
|
||||||
|
|
||||||
//bool
|
//bool
|
||||||
CanteenSettingItemEnumType.AllowSendAtMeal => IsValidFormat<bool>(value),
|
CanteenSettingItemEnumType.AllowSendAtMeal => IsValidFormat<bool>(value, request.Item),
|
||||||
CanteenSettingItemEnumType.AllowRepeatInOneShift => IsValidFormat<bool>(value),
|
CanteenSettingItemEnumType.AllowRepeatInOneShift => IsValidFormat<bool>(value,request.Item),
|
||||||
CanteenSettingItemEnumType.AllowCrossTenant => IsValidFormat<bool>(value),
|
CanteenSettingItemEnumType.AllowCrossTenant => IsValidFormat<bool>(value, request.Item),
|
||||||
_ => throw new NotImplementedException(),
|
_ => throw new NotImplementedException(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -162,8 +163,29 @@ public class CanteenSettingService : ICanteenSettingService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//判断0/1
|
||||||
|
if (type == CanteenSettingItemEnumType.AllowSendAtMeal ||
|
||||||
|
type == CanteenSettingItemEnumType.AllowRepeatInOneShift ||
|
||||||
|
type == CanteenSettingItemEnumType.AllowCrossTenant)
|
||||||
|
{
|
||||||
|
var intvaule = int.Parse(value);
|
||||||
|
if (intvaule == 0 || intvaule == 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(type == CanteenSettingItemEnumType.BusinessSwitchTime)
|
||||||
|
{
|
||||||
|
var timeOnly = value.Adapt<TimeOnly>();
|
||||||
|
return timeOnly.Minute == 0 && timeOnly.Second == 0;
|
||||||
|
}
|
||||||
//mapster
|
//mapster
|
||||||
value.Adapt<T>();
|
value.Adapt<T>();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user