拼多多接口调用调试 微信商品随机逻辑调整
This commit is contained in:
1 parent
3b3a903e25
commit
b2c152889a
8 files changed
+661
-114
No files matched your search
@@ -0,0 +1,73 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.Result;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TemuKJD.BLL.PddApi
|
||||
{
|
||||
public class PddApi
|
||||
{
|
||||
public Dictionary<string, object> Data { get; set; } = new Dictionary<string, object>();
|
||||
|
||||
public PddApi(ShopLoginInfo shop)
|
||||
{
|
||||
Data["access_token"] = shop.AccessToken;
|
||||
}
|
||||
|
||||
public string PddGoodsDetailGet()
|
||||
{
|
||||
string type = "pdd.goods.detail.get";
|
||||
string html = PddApiRequest(type, Data);
|
||||
return html;
|
||||
}
|
||||
|
||||
public string PddGoodsInformationUpdate()
|
||||
{
|
||||
string type = "pdd.goods.information.update";
|
||||
string html = PddApiRequest(type, Data);
|
||||
return html;
|
||||
}
|
||||
|
||||
public string PddGoodsLogisticsTemplateGet()
|
||||
{
|
||||
string type = "pdd.goods.logistics.template.get";
|
||||
string html = PddApiRequest(type, Data);
|
||||
return html;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="type">拼多多调用接口 pdd.*</param>
|
||||
/// <param name="dict">拼多多接口入参</param>
|
||||
/// <returns></returns>
|
||||
static string PddApiRequest(string type, Dictionary<string,object> dict)
|
||||
{
|
||||
string clientId = "ad502ec19e0c49ab9df14f83494e153c";
|
||||
string clientSecret = "bd52aba51737d03fc073711d386b3b0779d010ad";
|
||||
|
||||
if (string.IsNullOrEmpty(type))
|
||||
return "{\"success\":false, \"error_msg\":\"调用接口不能为空\"}";
|
||||
if (dict == null)
|
||||
return "{\"success\":false, \"error_msg\":\"参数数组不能为空\"}";
|
||||
|
||||
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
var timeStamp = (long)(DateTime.Now - startTime).TotalMilliseconds;
|
||||
|
||||
dict["type"] = type;
|
||||
dict["client_id"] = clientId;
|
||||
dict["timestamp"] = timeStamp.ToString();
|
||||
dict["data_type"] = "JSON";
|
||||
|
||||
var paramsDic = SignHelper.BuildSign(dict, clientSecret);
|
||||
var jsonBody = JsonConvert.SerializeObject(paramsDic);
|
||||
string result = GetHtml.PostUtf8("http://gw-api.pinduoduo.com/api/router", jsonBody, "application/json");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TemuKJD.BLL.PddApi
|
||||
{
|
||||
public class PddApiHelper
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user