39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using AllBase;
|
|
using AllBase.Model.Result;
|
|
using NaiBa.Util.Extension;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Work;
|
|
|
|
namespace TemuKJD.BLL.PddApi
|
|
{
|
|
public class PddApiHelper
|
|
{
|
|
public static AuthInfo GetShopPddToken(ShopLoginInfo shop)
|
|
{
|
|
var url = BaseClass.BuildObjString("shop/e57_get_pdd_shop_token");
|
|
var data = UserLogin.GetSignaturex();
|
|
data += "&mall_id=" + shop.MallId;
|
|
var html = GetHtml.PostUtf8(url, data);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":0"))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
var token = new AuthInfo()
|
|
{
|
|
ShopId = shop.ShopId,
|
|
AppKey = BaseClass.GetFileMd5(BaseRegex.GetStringJson(ref html, "appKey").ParseToString()),
|
|
AccessToken = BaseRegex.GetStringJson(ref html, "accessToken"),
|
|
ExpiresTime = BaseClass.StampToDateTime(BaseRegex.GetIntJson(ref html, "tokenExpiresTime")),
|
|
};
|
|
return token;
|
|
}
|
|
return new AuthInfo() { ShopId = shop.ShopId, AccessToken = "", ExpiresTime = DateTime.Now };
|
|
}
|
|
}
|
|
}
|