优化了微店商品上传 优化pdd买手读单

This commit is contained in:
wule committed 2026-04-15 21:04:37 +08:00
1 parent 6c4f16b897
commit f360688c43
62 files changed
+5620 -1432

No files matched your search

+32 -35
View File
@@ -65,7 +65,7 @@ namespace TemuKJD.PDDForms.ShopForms
localShop.ApiAuthInfoList.AddRange(serverShop.ApiAuthInfoList);
}
localShop.BuyApiAuth.AccessToken = serverShop.BuyApiAuth.AccessToken;
localShop.BuyApiAuth.AddTime = serverShop.BuyApiAuth.AddTime;
localShop.BuyApiAuth.UpdateTime = serverShop.BuyApiAuth.UpdateTime;
localShop.BuyApiAuth.AppKey = serverShop.BuyApiAuth.AppKey;
localShop.BuyApiAuth.ExpiresTime = serverShop.BuyApiAuth.ExpiresTime;
localShop.BuyApiAuth.RefreshToken = serverShop.BuyApiAuth.RefreshToken;
@@ -82,7 +82,7 @@ namespace TemuKJD.PDDForms.ShopForms
GlobalConfig.ShopLoginList.Add(localShop);
}
}
PddApiHelper.PddGetLocalTokens();
//PddApiHelper.GetPddLocalTokens();
}
public static List<ShopLoginInfo> GetServerShop()
@@ -152,7 +152,7 @@ namespace TemuKJD.PDDForms.ShopForms
AppKey = appkey,
AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"),
RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"),
AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(),
});
}
@@ -165,7 +165,7 @@ namespace TemuKJD.PDDForms.ShopForms
AppKey = appkey,
AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"),
RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"),
AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(),
});
}
@@ -174,7 +174,7 @@ namespace TemuKJD.PDDForms.ShopForms
shop.BuyApiAuth.AppKey = appkey;
shop.BuyApiAuth.AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token");
shop.BuyApiAuth.RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token");
shop.BuyApiAuth.AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime();
shop.BuyApiAuth.UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime();
shop.BuyApiAuth.ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime();
}
}
@@ -805,23 +805,6 @@ namespace TemuKJD.PDDForms.ShopForms
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=mms.pinduoduo.com; expires=" +
DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
}
// 全球站cookie
//foreach (var shopCook in shop.Cookies2.Split(';'))
//{
// var cookie = shopCook.Trim();
// if (cookie.StartsWith("mallid"))
// cookie = "mallid=" + shop.ShopId;
// if (!keys2.Any(k => cookie.StartsWith(k)))
// continue;
// if (!cookie.StartsWith("seller_temp") && !cookie.StartsWith("_nano_fp") && !cookie.StartsWith("mallid"))
// cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.temu.com; expires=" +
// DateTime.Now.AddDays(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
// else
// cookJs += "\r\ndocument.cookie='" + cookie + "; domain=agentseller.temu.com; expires=" +
// DateTime.Now.AddDays(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
//}
//cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');";
//cookJs += "\r\nwindow.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');";
cookJs += "\r\nsetTimeout(() => { window.location.href='https://mms.pinduoduo.com/home'; }, 200)";
Clipboard.SetDataObject(cookJs);
BaseMsgForm.ShowInfo("复制成功");
@@ -831,6 +814,7 @@ namespace TemuKJD.PDDForms.ShopForms
//PDDShopUpdateCookieForm updateCookieForm = new PDDShopUpdateCookieForm(shop);
//updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
//updateCookieForm.ShowDialog();
// 使用fiddler工具获取小密封破解工作台cookie
PDDShopUpdateFddlCookieForm updateFddlCookieForm = new PDDShopUpdateFddlCookieForm(shop);
updateFddlCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
updateFddlCookieForm.ShowDialog();
@@ -861,23 +845,36 @@ namespace TemuKJD.PDDForms.ShopForms
break;
case "购买授权":
{
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=84862";
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
btnRefreshCookie_Click(null, null);
var currentPddClient = GlobalConfig.PddClentInfoList.FirstOrDefault(c => c.is_current == true);
if (currentPddClient != null)
{
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=84862";
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=84690";
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=" + currentPddClient.market_id;
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
btnRefreshCookie_Click(null, null);
}
}
break;
case "绑定授权":
{
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=" + PddApi.clientId + "&redirect_uri=" +
GetHtml.UrlEncodeUtf8("http://po.e57.cn/login") + "?source=pdd_code&response_type=code";
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
btnRefreshCookie_Click(null, null);
var currentPddClient = GlobalConfig.PddClentInfoList.FirstOrDefault(c => c.is_current == true);
if (currentPddClient != null)
{
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=" + PddApi.clientId_pi_xiu_guan_jia + "&redirect_uri=" + GetHtml.UrlEncodeUtf8("http://po.e57.cn/login") + "?source=pdd_code&response_type=code";
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=48e76c60853d47d8a4e2e631b6db26b5&redirect_uri=http%3A%2F%2Fxtjpd.jiaotian.vip%2Fpdd_token.html&response_type=code"
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=" + currentPddClient.client_id +
"&redirect_uri=" + currentPddClient.redirect_uri + "&response_type=code";
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.AuthClientId = currentPddClient.client_id;
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
btnRefreshCookie_Click(null, null);
}
}
break;
//case "多重登录":
+44 -39
View File
@@ -27,6 +27,7 @@ using Work.BLL.Tools;
using TemuKJD.BLL;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Param.PDDProdParam;
using TemuKJD.BLL.PddApi;
namespace TemuKJD.PDDForms.ShopForms
{
@@ -63,6 +64,8 @@ namespace TemuKJD.PDDForms.ShopForms
private ShopLoginInfo shop = null;
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
private string currentUrl = "";
// 绑定授权的时候传进来和回调信息封装好传到数据库端
public string AuthClientId = "";
public PDDShopLoginForm(ShopLoginInfo shopInfo)
{
@@ -754,45 +757,6 @@ namespace TemuKJD.PDDForms.ShopForms
}
}
//if (responseData.Contains("球球小小店铺55") && responseData.Contains("pdd24873711027"))
//{
// Task.Run(() =>
// {
// var data = responseData;
// if (this.shop != null && data.Contains("\"success\":true"))
// {
// var username = BaseRegex.GetStringJson(ref data, "username");
// var maskMobile = BaseRegex.GetStringJson(ref data, "mobile");
// maskMobile = maskMobile.Split('*').Last();
// if (string.IsNullOrWhiteSpace(maskMobile) || string.IsNullOrWhiteSpace(username))
// return;
// if (shop.LoginName.EndsWith(maskMobile) || shop.LoginName == username)
// {
// lstShopCompany.Clear();
// //var jObj = JObject.Parse(data);
// //var jArr = jObj["result"] as JArray;
// //if (jArr == null)
// // jArr = new JArray();
// Thread.Sleep(500);
// ShopCompany sc = new ShopCompany()
// {
// MallId = BaseRegex.GetStringJson(ref data, "mall_id"),
// AccountId = BaseRegex.GetStringJson(ref data, "username"),
// AccountName = BaseRegex.GetStringJson(ref data, "mall_name"),
// LoginName = shop.LoginName,
// UserName = BaseClass.UserName,
// LoginStatus = "登录成功",
// AntiContent = antiContent,
// };
// this.lstShopCompany.Add(sc);
// }
// }
// });
//}
//if (url == "https://mms.pinduoduo.com/janus/api/userinfo" /*|| url == "https://mms.pinduoduo.com/janus/api/new/userinfo"*/)
//{
// Task.Run(() =>
@@ -889,6 +853,47 @@ namespace TemuKJD.PDDForms.ShopForms
}
});
}
if (url.Contains("https://xtjpd.jiaotian.vip/") && responseData.Contains("access_token"))
{
Task.Run(() =>
{
var pddClientData = responseData;
pddClientData = GetHtml.Unicode2String(pddClientData);
// {"id":"2","cid":"2","company_id":"0","site_id":"2","main_sid":"0","shop_id":"490943134","shop_name":"pdd49094313446","mall_name":"阿杰小铺浦哈哈","mall_desc":"您的小店已开启,为了更方便消费者了解您的店铺,快来补充店铺详情吧~","logo":"http:\/\/t16img.yangkeduo.com\/pdd_ims\/img_check\/v2\/E62F2CFFFFFF0720200112155452281\/7a235545414b40deaa2a90ab8eaebfd3.png","merchant_type":"1","mall_character":"2","access_token":"3f66557920e0481697325b46c73299e76e3d9e7e","refresh_token":"aa163da98e944063abbbe57a5365fad2fa90fe50","expires_at":"1776264848","expires_in":"26259","refresh_token_expires_at":"1776264848","refresh_token_expires_in":"26259","buy_sku_id":"435494","spec_name":"服务版本:专业版,周期:15天","spec_value":"专业版","goods_get_time":null,"order_get_time":null,"addtime":"2026-03-31 22:54:29","add_user_id":"2","add_user_name":"授权","update_time":"2026-04-15 15:36:27","update_user_id":"0","delete_user_id":"0"}
var access_token = BaseRegex.GetStringJson(ref pddClientData, "access_token");
var refresh_token = BaseRegex.GetStringJson(ref pddClientData, "refresh_token");
var mall_id = BaseRegex.GetStringJson(ref pddClientData, "shop_id");
var shop_id = BaseRegex.GetStringJson(ref pddClientData, "shop_name");
var mall_name = BaseRegex.GetStringJson(ref pddClientData, "mall_name"); // 阿杰小铺浦哈哈
var expires_at = BaseRegex.GetStringJson(ref pddClientData, "expires_at");
if (shop?.MallId == mall_id && !string.IsNullOrWhiteSpace(AuthClientId))
{
var auth = shop.ApiAuthInfoList.FirstOrDefault(a => a.AppKey == AuthClientId);
if (auth == null)
{
auth = new AuthInfo();
shop.ApiAuthInfoList.Add(auth);
}
auth.ShopId = shop_id;
auth.AccessToken = access_token;
auth.RefreshToken = refresh_token;
auth.AppKey = AuthClientId;
auth.ExpiresTime = BaseClass.StampToDateTime(expires_at.ParseToInt());
auth.UpdateTime = DateTime.Now;
auth.ApiAuthStatus = "授权成功";
auth.AppSecret = "";
var rst = PddApiHelper.SaveShopClientInfo(auth);
Invoke(new Action(() =>
{
if (this.Created && !this.IsDisposed && !this.Disposing)
this.Close();
}));
}
});
}
}
/// <summary>