增加项目,分层
This commit is contained in:
1 parent
6e995a5bdb
commit
0a3e5af6a9
234 files changed
+26994
-1
No files matched your search
@@ -0,0 +1,83 @@
|
||||
using MAX.Core.DependencyInjection;
|
||||
using MAX.Core.Helpers;
|
||||
using Store.Client;
|
||||
using Store.Client.Apis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Store.Client.Services
|
||||
{
|
||||
internal class CommonService : ITransientDependency
|
||||
{
|
||||
private readonly CommonApi _commonApi;
|
||||
public CommonService(CommonApi commonApi)
|
||||
{
|
||||
_commonApi = commonApi;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取签名配置
|
||||
/// </summary>
|
||||
public void LoadAuthConfig()
|
||||
{
|
||||
var value = _commonApi.GetAuthConfig();
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
ServerConfig.IsNewSignatureAuth = value.Equals("1");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取本地与服务器时间差
|
||||
/// </summary>
|
||||
public void LoadServerTimeSpan()
|
||||
{
|
||||
DateTime SDateTime = _commonApi.GetServerTime();
|
||||
long s = DateHelper.GetUnixTimestampInSeconds(SDateTime);
|
||||
long a = DateHelper.GetUnixTimestampInSeconds(DateTime.Now);
|
||||
ServerConfig.TimeDifferent = s - a;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取服务器时间戳
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static long GetServerUnix()
|
||||
{
|
||||
return DateHelper.GetUnixTimestampInSeconds(DateTime.Now) + ServerConfig.TimeDifferent;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取服务器时间
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DateTime GetServerDataTime()
|
||||
{
|
||||
return DateHelper.ConvertFromUnixTimestampInSeconds(GetServerUnix());
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 获取服务器图片缓存
|
||||
///// </summary>
|
||||
///// <param name="imgUrl"></param>
|
||||
///// <returns></returns>
|
||||
//public string GetImageCache(string imgUrl)
|
||||
//{
|
||||
// string imgurl = "";
|
||||
// HttpResult result = _commonApi.GetImageCache(imgUrl);
|
||||
// if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
// {
|
||||
// result.Html = result.Html.Trim();
|
||||
// if (Regex.IsMatch(result.Html, "^http"))
|
||||
// {
|
||||
// imgurl = result.Html;
|
||||
|
||||
// }
|
||||
// }
|
||||
// return imgurl;
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user