|
|
@@ -10,6 +10,7 @@ using Microsoft.IdentityModel.Tokens;
|
|
|
using System.Security.Claims;
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
using System.Text;
|
|
|
+using Aop.Api.Util;
|
|
|
|
|
|
namespace MySystem
|
|
|
{
|
|
|
@@ -213,5 +214,77 @@ namespace MySystem
|
|
|
return new JwtSecurityTokenHandler().WriteToken(securityToken);
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+
|
|
|
+ public static decimal NumberFormat(decimal number, int floatCount = 2)
|
|
|
+ {
|
|
|
+ string str = number.ToString();
|
|
|
+ if (str.Contains("."))
|
|
|
+ {
|
|
|
+ string[] list = str.Split('.');
|
|
|
+ if (list[1].Length > floatCount)
|
|
|
+ {
|
|
|
+ str = list[0] + "." + list[1].Substring(0, floatCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ str += ".00";
|
|
|
+ }
|
|
|
+ return decimal.Parse(str);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #region 获取网络文件内容
|
|
|
+
|
|
|
+ public static string GetNetFileContent(string url)
|
|
|
+ {
|
|
|
+ string textContent = "";
|
|
|
+ using (var client = new System.Net.WebClient())
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ textContent = client.DownloadString(url); // 通过 DownloadString 方法获取网页内容
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "获取网络文件内容异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return textContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static byte[] GetNetFileData(string url)
|
|
|
+ {
|
|
|
+ byte[] textContent = new byte[] { };
|
|
|
+ using (var client = new System.Net.WebClient())
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ textContent = client.DownloadData(url); // 通过 DownloadString 方法获取网页内容
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "获取网络文件流异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return textContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static FileItem GetNetFileItem(string url)
|
|
|
+ {
|
|
|
+ string fileName = url;
|
|
|
+ if(fileName.Contains("/"))
|
|
|
+ {
|
|
|
+ fileName = fileName.Substring(fileName.LastIndexOf("/") + 1);
|
|
|
+ }
|
|
|
+ FileItem item = new FileItem(fileName, GetNetFileData(url));
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|