121212
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace Application.Service.Pub;
|
||||
using Photon.Core.Assist;
|
||||
|
||||
namespace Application.Service.Pub;
|
||||
|
||||
public class TimeExtend
|
||||
{
|
||||
@@ -21,4 +23,28 @@ public class TimeExtend
|
||||
{
|
||||
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
|
||||
}
|
||||
|
||||
public static long GetTimeStampSecondsByCode(string code, DateTime maxTime)
|
||||
{
|
||||
long result = 0;
|
||||
switch (code)
|
||||
{
|
||||
case "Long":
|
||||
result = GetTimeStampBySeconds(maxTime);
|
||||
break;
|
||||
case "Day":
|
||||
result = GetTimeStampBySeconds(TimeAssist.GetDateTimeYMD(1));
|
||||
break;
|
||||
case "Month":
|
||||
DateTime nt = DateTime.Now.AddMonths(1);
|
||||
nt = Convert.ToDateTime($"{nt.Year}-{nt.Month}-01");
|
||||
result = GetTimeStampBySeconds(nt);
|
||||
break;
|
||||
case "Week":
|
||||
result = GetTimeStampBySeconds(TimeAssist.WeekEndTime);
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user