gx
This commit is contained in:
1 parent
c2dcedd238
commit
16cdd3d46e
34 files changed
+837
-481
No files matched your search
@@ -1,70 +0,0 @@
|
||||
using MAX.Core.Cryptography;
|
||||
using MAX.Core.Helpers;
|
||||
using Store.Client;
|
||||
using Store.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Store.Client.Commons
|
||||
{
|
||||
/// <summary>
|
||||
/// 签名工具
|
||||
/// </summary>
|
||||
public class SignTool
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取签名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSign()
|
||||
{
|
||||
long time = GetReviseUnix();
|
||||
string s = Encryption(time);
|
||||
return "time=" + time + "&code=" + s + "&NbCodeVersion=1";
|
||||
}
|
||||
/// <summary>
|
||||
/// 用户签名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetUserSign()
|
||||
{
|
||||
return GetUserSign("", "");
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取当前用户签名
|
||||
/// </summary>
|
||||
/// <param name="shopId"></param>
|
||||
/// <param name="shopName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetUserSign(string shopId, string shopName)
|
||||
{
|
||||
long time = GetReviseUnix();
|
||||
string time1 = Encryption(time);
|
||||
return "time=" + time + "&code=" + time1 + "&NbCodeVersion=1" + "&uid=" + ClientInfo.User.UserId + "&key=" + ClientInfo.User.UserKey +
|
||||
"&cid=" + ClientInfo.User.CompanyId + "&company=" + UrlHelper.Encode(ClientInfo.User.CompanyName) +
|
||||
"&sid=" + shopId + "&shop=" + UrlHelper.Encode(shopName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取校正后的时间戳
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static long GetReviseUnix()
|
||||
{
|
||||
return DateHelper.GetCurrentUnixTimestampInSeconds() + ServerConfig.TimeDifferent;
|
||||
}
|
||||
/// <summary>
|
||||
/// 签名算法
|
||||
/// </summary>
|
||||
/// <param name="s">随机数</param>
|
||||
/// <returns>加密签名结果</returns>
|
||||
public static string Encryption(long s)
|
||||
{
|
||||
string value = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD";
|
||||
return MD5Helper.Md5_32(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user