gx
This commit is contained in:
1 parent
c2dcedd238
commit
16cdd3d46e
34 files changed
+837
-481
No files matched your search
@@ -1,68 +0,0 @@
|
||||
using MAX.Core.Helpers;
|
||||
using Store.Client.Commons;
|
||||
using Store.Client.HttpExtension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Store.Client.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求扩展
|
||||
/// </summary>
|
||||
public static class HttpItemExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 增加签名
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public static void Sign(this ServerHttpItem item)
|
||||
{
|
||||
SetSign(item, SignTool.GetSign());
|
||||
}
|
||||
/// <summary>
|
||||
/// 增加用户签名
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public static void SignUser(this ServerHttpItem item)
|
||||
{
|
||||
item.SignUser("", "");
|
||||
}
|
||||
/// <summary>
|
||||
/// 增加用户签名
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="shopId"></param>
|
||||
/// <param name="shopName"></param>
|
||||
public static void SignUser(this ServerHttpItem item, string shopId, string shopName)
|
||||
{
|
||||
SetSign(item, SignTool.GetUserSign(shopId, shopName));
|
||||
}
|
||||
private static void SetSign(ServerHttpItem item, string sign)
|
||||
{
|
||||
if (item.Method == MethodType.Get)
|
||||
{
|
||||
if (item.URL.Contains("?"))
|
||||
{
|
||||
item.URL += "&";
|
||||
}
|
||||
else
|
||||
{
|
||||
item.URL += "?";
|
||||
}
|
||||
item.URL += sign;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Postdata.Length > 0)
|
||||
{
|
||||
item.Postdata += "&";
|
||||
}
|
||||
item.Postdata += sign;
|
||||
}
|
||||
item.IsSign = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user