temu推单相关功能
This commit is contained in:
1 parent
165df61234
commit
b05de6797e
27 files changed
+4561
-315
No files matched your search
@@ -39,6 +39,26 @@ namespace NaiBa.Util.Extension
|
||||
}
|
||||
}
|
||||
|
||||
public static long? ParseToNullableLong(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
string str = obj.ParseToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return long.Parse(str);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将object转换为long,若转换失败,则返回指定值。不抛出异常。
|
||||
/// </summary>
|
||||
@@ -82,6 +102,21 @@ namespace NaiBa.Util.Extension
|
||||
}
|
||||
}
|
||||
|
||||
public static int? ParseToNullableInt(this object str)
|
||||
{
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
return Convert.ToInt32(str);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int DecimalPointParseToInt(this object str)
|
||||
{
|
||||
try
|
||||
@@ -194,6 +229,17 @@ namespace NaiBa.Util.Extension
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public static decimal? ParseToNullableDecimal(this object str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return decimal.Parse(str.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 转化为bool
|
||||
|
||||
@@ -20,6 +20,19 @@ namespace KJD_Web.Utils
|
||||
return dateTimeStart.Add(toNow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳转为C#格式时间
|
||||
/// </summary>
|
||||
/// <param name="timeStamp"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime StampMillisecondsToDateTime(long timeStamp)
|
||||
{
|
||||
DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
long lTime = long.Parse(timeStamp + "0000");
|
||||
TimeSpan toNow = new TimeSpan(lTime);
|
||||
return dateTimeStart.Add(toNow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C#格式时间转换为Unix时间戳(秒)
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user