797 lines
33 KiB
C#
797 lines
33 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using AllBase;
|
||
using Work.Api;
|
||
|
||
namespace Work
|
||
{
|
||
/// <summary>
|
||
/// 获取上家
|
||
/// </summary>
|
||
public class JumpUpProductNew
|
||
{
|
||
public static Dictionary<int, Dictionary<char, char>> ShouZhangXinTb = new Dictionary<int, Dictionary<char, char>>();
|
||
public static Dictionary<int, Dictionary<char, char>> ShouZhangXinPdd = new Dictionary<int, Dictionary<char, char>>();
|
||
public UpShopIdBase UpId = new UpShopIdBase();
|
||
public ShopChatBase Shop = null;
|
||
public string Good_Sn="";
|
||
public string Html="";
|
||
public string OutGoodId = "";
|
||
|
||
public JumpUpProductNew(ShopChatBase shop)
|
||
{
|
||
Shop = shop;
|
||
}
|
||
|
||
public static string GetUrl(string url, out string pid, ShopChatBase shop)
|
||
{
|
||
JumpUpProductNew ju = new JumpUpProductNew();
|
||
ju.Shop = shop;
|
||
ju.GetUrl(url);
|
||
pid = ju.UpId.ProductIdFrom.ToString();
|
||
return ju.UpId.Url;
|
||
}
|
||
public JumpUpProductNew()
|
||
{
|
||
}
|
||
|
||
public void GetUrl(string url)
|
||
{
|
||
string pidCode="",idx="";
|
||
UpId.SiteId = 2;
|
||
string cookies = BaseClass.ChromeCookies;
|
||
int maillId = BaseClass.MallId;
|
||
if (Shop != null)
|
||
{
|
||
cookies = Shop.Cookies;
|
||
maillId = Shop.MallId;
|
||
}
|
||
long proId = 0;
|
||
if (!string.IsNullOrEmpty(OutGoodId) && (OutGoodId.Contains("PBB") || OutGoodId.Contains("TJM") || OutGoodId.Contains("TJH")))
|
||
{
|
||
pidCode = OutGoodId;
|
||
goto End;
|
||
}
|
||
if (!string.IsNullOrEmpty(url))
|
||
{
|
||
string id = BaseRegex.GetMatchRegexString(url, @"([\d]{5,15})");
|
||
string pid = "0";
|
||
if (string.IsNullOrEmpty(id))
|
||
{
|
||
UpId.Message = "没有找到拼多多ID";
|
||
return;
|
||
}
|
||
proId = long.Parse(id);
|
||
if (UpShopIdFromServer.UpIds.ContainsKey(proId))
|
||
{
|
||
UpId = UpShopIdFromServer.UpIds[proId];
|
||
UpId.GetOk = true;
|
||
return;
|
||
}
|
||
if (PinduoduoApiGetProduct.OutId.ContainsKey(proId))
|
||
{
|
||
pidCode = PinduoduoApiGetProduct.OutId[proId];
|
||
if(!string.IsNullOrEmpty(pidCode))
|
||
goto End;
|
||
}
|
||
//if (string.IsNullOrEmpty(pidCode)) //没有上家,优先走api
|
||
//{
|
||
// if(string.IsNullOrEmpty(Html))
|
||
//Html = new PinduoduoApiGetProduct(Shop).GetProductInfor(proId);
|
||
// pidCode = BaseRegex.GetMatchRegexString(ref Html, @"""out_sku_sn"":""(PBB[^""]+?)""");
|
||
// if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
|
||
// goto End;
|
||
// var m = BaseRegex.GetMatchRegex(ref Html, @"""outer_goods_id"":""([^""]+?)""");
|
||
// if (m != null && m.Count > 0)
|
||
// pidCode = m[m.Count - 1].Groups[1].Value;
|
||
// if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
|
||
// goto End;
|
||
// if (Html.Contains("outer_goods_id"))
|
||
// {
|
||
// if (GetServerId(proId, out idx))
|
||
// {
|
||
// DeCode(idx);
|
||
// return;
|
||
// }
|
||
// }
|
||
//}
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
{
|
||
string urlx = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail";
|
||
string data = "{\"goods_id\":\"" + id + "\"}";
|
||
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(urlx, "https://mms.pinduoduo.com/", true, data,
|
||
cookies);
|
||
pidCode = BaseRegex.GetStringJson(ref htmlx, "out_goods_sn");
|
||
if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
|
||
goto End;
|
||
}
|
||
if (UpIdsList.Count == 0)
|
||
{
|
||
UpdataUpIds();
|
||
}
|
||
foreach (string key in UpIdsList.Keys)
|
||
{
|
||
if (key == proId.ToString())
|
||
{
|
||
idx = UpIdsList[key].upProIdOne;
|
||
if (string.IsNullOrEmpty(idx))
|
||
idx = UpIdsList[key].upProIdTwo;
|
||
break;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(idx) && idx.Contains("-"))
|
||
{
|
||
DeCode(idx);
|
||
return;
|
||
}
|
||
if (GetServerId(proId, out idx))
|
||
{
|
||
DeCode(idx);
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
{
|
||
string urlx = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
||
string data = "{\"order_by\":\"id:desc\",\"goods_id\":\"" + id + "\",\"size\":15,\"page\":1,\"mall_id\":" + maillId + "}";
|
||
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(urlx, "https://mms.pinduoduo.com/Pdd.html", true, data,
|
||
cookies);
|
||
pidCode = BaseRegex.GetStringJson(ref htmlx, "out_goods_sn");
|
||
if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
|
||
goto End;
|
||
}
|
||
url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
||
string date = "{\"sort_by\":\"id\",\"sort_type\":\"DESC\",\"goods_id\":\"" + id +
|
||
"\",\"size\":15,\"page\":1,\"mall_id\":" + maillId + "}";
|
||
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true, date,
|
||
cookies);
|
||
//url = "https://mms.pinduoduo.com/malls/" + maillId + "/goodsList?sort_by=id&sort_type=DESC&goods_id=" + id + "&size=15&page=1";
|
||
// html = GetPostTaobaoHtml.UploadTaobao(url, "https://mms.pinduoduo.com/Pdd.html", true, cookies);
|
||
Good_Sn = BaseRegex.GetStringJson(ref html, "goods_sn");
|
||
|
||
if (string.IsNullOrEmpty(Good_Sn)) //没有上家
|
||
{
|
||
Thread.Sleep(5*1000);
|
||
html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true, date,
|
||
cookies);
|
||
Good_Sn = BaseRegex.GetStringJson(ref html, "goods_sn");
|
||
}
|
||
if (string.IsNullOrEmpty(Good_Sn)) //没有上家
|
||
{
|
||
Thread.Sleep(20*1000);
|
||
html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true, date,
|
||
cookies);
|
||
Good_Sn = BaseRegex.GetStringJson(ref html, "goods_sn");
|
||
}
|
||
if (string.IsNullOrEmpty(Good_Sn)) //没有上家
|
||
{
|
||
//message = "查询无数据";
|
||
UpId.Message = "未查询到产品id,请点选正确的店铺";
|
||
//AddToTemp(proId);
|
||
return;
|
||
}
|
||
}
|
||
//李尹添加
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
{
|
||
//获取包含✅的上传记录
|
||
long idUp = proId;
|
||
string urlUp = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/list";
|
||
string referex = "https://mms.pinduoduo.com/goods/goods_record";
|
||
string datax = "{\"check_status\":2,\"start\":0,\"length\":10,\"goods_id\":" + idUp + "}";
|
||
//第一页匹配结果
|
||
string htmlUp = GetPostTaobaoHtml.UploadTaobaoPost(urlUp, referex, true, datax, cookies);
|
||
int allCount = BaseRegex.GetIntJson(ref htmlUp, "total");
|
||
int page = allCount / 10 + (allCount % 10 > 0 ? 1 : 0);
|
||
long editId = 0;
|
||
for (int j = 1; j <= page; j++)
|
||
{
|
||
if (editId > 0)
|
||
{
|
||
break;
|
||
}
|
||
if (j != 1)
|
||
{
|
||
datax = "{\"check_status\":2,\"start\":" + (j - 1) * 10 + ",\"length\":10,\"goods_id\":" + idUp + "}";
|
||
htmlUp = GetPostTaobaoHtml.GetJsonPost(urlUp, referex, true, datax, cookies);
|
||
}
|
||
var m = BaseRegex.GetMatchRegex(ref htmlUp, @"\{([\w\W]+?)\}");
|
||
for (int k = 0; m != null && k < m.Count; k++)
|
||
{
|
||
string list = m[k].Groups[0].Value;
|
||
string goods_name = BaseRegex.GetStringJson(ref list, "goods_name");
|
||
if (string.IsNullOrEmpty(goods_name) || goods_name.Contains("✅"))
|
||
{
|
||
editId = BaseRegex.GetLongJson(ref list, "id");
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
string urlx = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/detail/" + editId;
|
||
string htmlx = GetPostTaobaoHtml.UploadTaobao(urlx, "https://mms.pinduoduo.com/goods/goods_add/index?id=" + editId + "&type=edit", true, cookies);
|
||
pidCode = BaseRegex.GetStringJson(ref htmlx, "out_goods_sn");
|
||
if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
|
||
goto End;
|
||
}
|
||
|
||
url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail";
|
||
Html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true,
|
||
"{\"goods_sn\":\"" + Good_Sn + "\"}", cookies);
|
||
if (!string.IsNullOrEmpty(Html) && Html.Contains("过于频繁"))
|
||
{
|
||
Thread.Sleep(30*1000);
|
||
Html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true,
|
||
"{\"goods_sn\":\"" + Good_Sn + "\"}", cookies);
|
||
}
|
||
if (!string.IsNullOrEmpty(Html) && Html.Contains("过于频繁"))
|
||
{
|
||
Thread.Sleep(90*1000);
|
||
Html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true,
|
||
"{\"goods_sn\":\"" + Good_Sn + "\"}", cookies);
|
||
}
|
||
pidCode = BaseRegex.GetStringJson(ref Html, @"out_goods_sn");
|
||
//if (string.IsNullOrEmpty(pidCode) || pidCode.Contains("wait:")) //没有上家
|
||
//{
|
||
// Html = new PinduoduoApiGetProduct(Shop).GetProduct(proId);
|
||
// var m = BaseRegex.GetMatchRegex(ref Html, @"""outer_goods_id"":""([^""]+?)""");
|
||
// if (m != null && m.Count > 0)
|
||
// pidCode = m[m.Count - 1].Groups[1].Value;
|
||
// if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
|
||
// goto End;
|
||
//}
|
||
//if (string.IsNullOrEmpty(pidCode) || pidCode.Contains("wait:")) //没有上家
|
||
//{
|
||
// Html = new PinduoduoApiGetProduct(Shop).GetProductInfor(proId);
|
||
// var m = BaseRegex.GetMatchRegex(ref Html, @"""outer_goods_id"":""([^""]+?)""");
|
||
// if (m != null && m.Count > 0)
|
||
// pidCode = m[m.Count - 1].Groups[1].Value;
|
||
// if (!string.IsNullOrEmpty(pidCode))
|
||
// goto End;
|
||
//}
|
||
End:
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
pidCode = BaseRegex.GetMatchRegexString(ref Html, @"(TJM_[a-z0-9=+/]+?)"",""");
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
pidCode = BaseRegex.GetMatchRegexString(ref Html, @"(JM_[a-z0-9]+?)"",""");
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
pidCode = BaseRegex.GetMatchRegexString(ref Html, @"[\D]([a-z0-9=+/]+?=)"",""");
|
||
if (!string.IsNullOrEmpty(pidCode))
|
||
{
|
||
string pidCodex = BaseRegex.GetMatchRegexString(ref pidCode, @"([\d]{6,15})"); //未加密
|
||
if (!string.IsNullOrEmpty(pidCodex))
|
||
{
|
||
long upid = long.Parse(pidCodex);
|
||
if (upid < 999999999l)
|
||
UpId.SiteIdFrom = 2;
|
||
else
|
||
UpId.SiteIdFrom = 1;
|
||
if (pidCode.Contains("tb-"))
|
||
UpId.SiteIdFrom = 1;
|
||
if (pidCode.Contains("pdd-") || pidCode.Contains("pd-"))
|
||
UpId.SiteIdFrom = 2;
|
||
if (pidCode.Contains("al-") || pidCode.Contains("albb-") || pidCode.Contains("1688-"))
|
||
UpId.SiteIdFrom = 3;
|
||
UpId.GetOk = true;
|
||
UpId.ProductIdFrom = upid;
|
||
AddToTemp(proId);
|
||
return;
|
||
}
|
||
}
|
||
if (string.IsNullOrEmpty(pidCode))
|
||
{
|
||
UpId.Message = "未找到加密密钥";
|
||
AddToTemp(proId);
|
||
return;
|
||
}
|
||
|
||
if (pidCode.Contains("TJM_"))
|
||
{
|
||
if (!string.IsNullOrEmpty(pidCode) && pidCode.Contains("|"))
|
||
pidCode = pidCode.Substring(0, pidCode.IndexOf("|"));
|
||
try
|
||
{
|
||
byte[] inArray = Convert.FromBase64String(pidCode.Replace("TJM_", ""));
|
||
idx = Encoding.UTF8.GetString(inArray);
|
||
DeCode(idx);
|
||
return;
|
||
}
|
||
catch
|
||
{
|
||
UpId.Message = "解密异常,请联系管理员";
|
||
}
|
||
AddToTemp(proId);
|
||
return;
|
||
}
|
||
if (pidCode.Length > 3 && (pidCode.Substring(0, 3) == "PBB" || pidCode.Substring(0, 3) == "TJH"))
|
||
{
|
||
int mid = Shop == null ? BaseClass.MallId : Shop.MallId;
|
||
if (pidCode.Contains("?"))
|
||
{
|
||
string data = UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName);
|
||
data += "&mall_id=" + mid + "&encode=" + GetHtml.UrlEncodeUtf8(pidCode);
|
||
string urlx = BaseClass.BuildObjString("decode&act=get");
|
||
idx = GetHtml.PostUtf8(urlx, data);
|
||
}
|
||
else if (pidCode.Contains("#"))
|
||
{
|
||
string data = UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName);
|
||
data += "&mall_id=" + mid + "&encode=" + GetHtml.UrlEncodeUtf8(pidCode);
|
||
string urlx = BaseClass.BuildObjString("decode&act=getx");
|
||
idx = GetHtml.PostUtf8(urlx, data);
|
||
}
|
||
else
|
||
{
|
||
idx = GetUpId(pidCode, mid);
|
||
}
|
||
DeCode(idx);
|
||
return;
|
||
}
|
||
if (pidCode.Contains("JM_"))
|
||
{
|
||
string pid = Decode(pidCode);
|
||
if (string.IsNullOrEmpty(pid))
|
||
UpId.Message = "解密失败,字典不足";
|
||
AddToTemp(proId);
|
||
return;
|
||
}
|
||
if (UpIdsList.Count==0)
|
||
{
|
||
UpdataUpIds();
|
||
}
|
||
foreach (string key in UpIdsList.Keys)
|
||
{
|
||
if (key == proId.ToString())
|
||
{
|
||
idx = UpIdsList[key].upProIdOne;
|
||
if (string.IsNullOrEmpty(idx))
|
||
idx = UpIdsList[key].upProIdTwo;
|
||
break;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(idx) && idx.Contains("-"))
|
||
{
|
||
DeCode(idx);
|
||
return;
|
||
}
|
||
url = BaseClass.LoginApiUrl + "?obj=upshopid/upid&act=get";
|
||
string datay = "&pdd_id=" + proId + "&table=" + (proId % 1024);
|
||
string htmly = GetHtml.PostUtf8(url, UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName) + datay);
|
||
if (!string.IsNullOrEmpty(htmly) && htmly.Contains("-"))
|
||
{
|
||
DeCode(htmly);
|
||
return;
|
||
}
|
||
UpId.Message = "未找到解密方法,请联系管理员";
|
||
}
|
||
public static Dictionary<string, UpProId> UpIdsList = new Dictionary<string, UpProId>();
|
||
public static void UpdataUpIds()
|
||
{
|
||
UpIdsList.Clear();
|
||
bool had = true;
|
||
int page = 1;
|
||
while (had)
|
||
{
|
||
string data = UserLogin.GetSignaturex() + "";
|
||
string url = BaseClass.BuildObjString("upid&act=getx&page=" + page);
|
||
string html = GetHtml.PostUtf8(url, data);
|
||
var m = BaseRegex.GetMatchRegex(ref html, @"({[\s\S]+?})");
|
||
for (int i = 0; i < m.Count; i++)
|
||
{
|
||
var item = m[i].Groups[0].Value;
|
||
string pid = BaseRegex.GetStringJson(ref item, "product_id");//商品ID
|
||
string upids = BaseRegex.GetStringJson(ref item, "up_ids");//上家Id
|
||
string upidsTwo = BaseRegex.GetStringJson(ref item, "up_ids2");//上家Id2
|
||
if ((string.IsNullOrEmpty(upids)&& string.IsNullOrEmpty(upidsTwo)) || string.IsNullOrEmpty(pid))
|
||
continue;
|
||
if (UpIdsList.ContainsKey(pid))//如果dictionary 存在相同的key,remove后再添加。
|
||
{
|
||
UpIdsList.Remove(pid);
|
||
}
|
||
UpProId upProId = new UpProId();
|
||
upProId.upProIdOne = upids;
|
||
upProId.upProIdTwo = upidsTwo;
|
||
UpIdsList.Add(pid, upProId);
|
||
}
|
||
had = m.Count > 2;
|
||
page++;
|
||
}
|
||
|
||
}
|
||
|
||
public void DeCode(string idx)
|
||
{
|
||
string rid = BaseRegex.GetMatchRegexString(idx, @"([\d]+)");
|
||
if (string.IsNullOrEmpty(rid))
|
||
{
|
||
UpId.Message = "解密遇到空数据";
|
||
return;
|
||
}
|
||
UpId.ProductIdFrom = long.Parse(rid);
|
||
if (idx.Contains("tb-"))
|
||
UpId.SiteIdFrom = 1;
|
||
if (idx.Contains("pd-"))
|
||
{
|
||
if (idx.Length>13)
|
||
{
|
||
UpId.SiteIdFrom = 1;
|
||
}
|
||
UpId.SiteIdFrom = 2;
|
||
}
|
||
if (idx.Contains("al-"))
|
||
UpId.SiteIdFrom = 3;
|
||
if (idx.Contains("jx-"))
|
||
UpId.SiteIdFrom = 4;
|
||
if (idx.Contains("wd-"))
|
||
UpId.SiteIdFrom = 6;
|
||
UpId.GetOk = true;
|
||
}
|
||
|
||
public bool GetServerId(long pid,out string idx)
|
||
{
|
||
idx = "";
|
||
string url = BaseClass.LoginApiUrl + "?obj=upshopid/upid&act=get";
|
||
string data = "&pdd_id=" + pid + "&table=" + (pid % 1024);
|
||
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName) + data);
|
||
if (html == "none")
|
||
return false;
|
||
idx = html;
|
||
return true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新版加密解密
|
||
/// </summary>
|
||
/// <param name="code"></param>
|
||
/// <param name="mid"></param>
|
||
/// <returns></returns>
|
||
public string GetUpId(string code, int mid)
|
||
{
|
||
if (string.IsNullOrEmpty(code) || !code.Contains("PBB") && !code.Contains("TJH"))
|
||
return "";
|
||
if (!code.Contains("|"))
|
||
return "";
|
||
int ridMain = int.Parse(code.Substring(code.IndexOf("|") + 1));
|
||
int ridClient = (mid % ridMain) % 26;
|
||
List<int> k = new List<int>();
|
||
char[] ke = mid.ToString().ToCharArray();
|
||
for (int i = 0; i < ke.Length; i++)
|
||
{
|
||
int j = int.Parse(ke[i].ToString());
|
||
k.Add(j);
|
||
}
|
||
string codeNew = code.Substring(3, code.IndexOf("|") - 3);
|
||
byte[] b = Convert.FromBase64String(codeNew);
|
||
int y = 0;
|
||
for (int i = 0; i < b.Length; i++)
|
||
{
|
||
int z = b[i] - k[y] * ridClient;
|
||
if (z < 0)
|
||
z += 256;
|
||
b[i] = (byte)(z % 256);
|
||
y++;
|
||
if (y >= ke.Length)
|
||
y = 0;
|
||
}
|
||
string decode = Encoding.UTF8.GetString(b);
|
||
return decode;
|
||
}
|
||
|
||
private void AddToTemp(long proId)
|
||
{
|
||
if(proId==0 || UpId.ProductIdFrom==0)
|
||
return;
|
||
try
|
||
{
|
||
UpId.Url = GetJumpUrl(UpId.SiteIdFrom, UpId.ProductIdFrom);
|
||
if (!UpShopIdFromServer.UpIds.ContainsKey(proId))
|
||
{
|
||
UpShopIdFromServer.UpIds.Add(proId,UpId);
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 解密密文
|
||
/// </summary>
|
||
/// <param name="code"></param>
|
||
/// <returns></returns>
|
||
public string Decode(string code)
|
||
{
|
||
string temp = "";
|
||
if (code.Contains("JM_DD8E5ED"))
|
||
{
|
||
UpId.SiteIdFrom = 1;
|
||
code = code.Replace("JM_DD8E5ED", "");
|
||
int b = 0;
|
||
char[] h = code.ToCharArray();
|
||
temp = "";
|
||
for (int i = 0; i < h.Length + 1; i += 2)
|
||
{
|
||
char a = h[i];
|
||
if (ShouZhangXinTb[b].ContainsKey(a))
|
||
temp += ShouZhangXinTb[b][a];
|
||
else
|
||
return "";
|
||
b++;
|
||
}
|
||
}
|
||
if (code.Contains("JM_D98817C43"))
|
||
{
|
||
UpId.SiteIdFrom = 2;
|
||
code = code.Replace("JM_D98817C43", "");
|
||
int b = 1;
|
||
char[] h = code.ToCharArray();
|
||
temp = "";
|
||
for (int i = 0; i < h.Length + 1; i += 2)
|
||
{
|
||
char a = h[i];
|
||
if (ShouZhangXinTb[b].ContainsKey(a))
|
||
temp += ShouZhangXinTb[b][a];
|
||
else
|
||
return "";
|
||
b++;
|
||
}
|
||
}
|
||
|
||
long.TryParse(temp,out UpId.ProductIdFrom);
|
||
UpId.SiteId = 2;
|
||
UpId.GetOk = true;
|
||
UpId.Url = GetJumpUrl(UpId.SiteIdFrom, UpId.ProductIdFrom);
|
||
return temp;
|
||
}
|
||
|
||
public static string GetJumpUrl(int siteId, long pid)
|
||
{
|
||
string url = "";
|
||
if (pid>9900000000)
|
||
{
|
||
if (siteId != 3)
|
||
{
|
||
url = "http://taoke.qixiaoke.com/first.php?pid=mm_15630535_36114777_129010993&product_id=" + pid;
|
||
if (!string.IsNullOrEmpty(BaseClass.AlimamaPid) && !string.IsNullOrEmpty(BaseClass.AlimamaDomain))
|
||
url = "http://" + BaseClass.AlimamaDomain + "/first.php?pid=" + BaseClass.AlimamaPid + "&product_id=" + pid;
|
||
}
|
||
else
|
||
{
|
||
url = "https://detail.1688.com/offer/"+ pid + ".html";
|
||
}
|
||
|
||
}
|
||
if ( pid < 9900000000)
|
||
{
|
||
url = BaseClass.LoginApiUrl + "?obj=upshopid/pinduoduo_click&act=jump&id=" + pid;
|
||
}
|
||
return url;
|
||
}
|
||
|
||
public void Ini()
|
||
{
|
||
ShouZhangXinTb.Clear();
|
||
ShouZhangXinPdd.Clear();
|
||
string[] l = DeCodeString.Split('\n');
|
||
for (int i = 0; i < l.Length; i++)
|
||
{
|
||
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("\t"))
|
||
continue;
|
||
string[] li = l[i].Split('\t');
|
||
string c = li[0];
|
||
string id = li[1];
|
||
if (c.Contains("JM_DD8E5ED"))
|
||
{
|
||
int b = 0;
|
||
c = c.Replace("JM_DD8E5ED", "");
|
||
char[] h = c.ToCharArray();
|
||
char[] s = id.Trim().ToCharArray();
|
||
for (int j = 0; b < 12 && b < s.Length; j += 2)
|
||
{
|
||
if (!ShouZhangXinTb.ContainsKey(b))
|
||
ShouZhangXinTb.Add(b, new Dictionary<char, char>());
|
||
char a = h[j];
|
||
char d = s[b];
|
||
if (!ShouZhangXinTb[b].ContainsKey(a))
|
||
ShouZhangXinTb[b].Add(a, d);
|
||
if (!ShouZhangXinTb[b].ContainsKey(d))
|
||
ShouZhangXinTb[b].Add(d, a);
|
||
b++;
|
||
}
|
||
}
|
||
if (c.Contains("JM_D98817C43"))
|
||
{
|
||
int b = 0;
|
||
c = c.Replace("JM_D98817C43", "");
|
||
char[] h = c.ToCharArray();
|
||
char[] s = id.Trim().ToCharArray();
|
||
for (int j = 0; b < 12 && b < s.Length; j += 2)
|
||
{
|
||
if (!ShouZhangXinPdd.ContainsKey(b))
|
||
ShouZhangXinPdd.Add(b, new Dictionary<char, char>());
|
||
char a = h[j];
|
||
char d = s[b];
|
||
if (!ShouZhangXinPdd[b].ContainsKey(a))
|
||
ShouZhangXinPdd[b].Add(a, d);
|
||
if (!ShouZhangXinPdd[b].ContainsKey(d))
|
||
ShouZhangXinPdd[b].Add(d, a);
|
||
b++;
|
||
}
|
||
}
|
||
}
|
||
string allMun = "0123456789";
|
||
foreach (KeyValuePair<int, Dictionary<char, char>> key in ShouZhangXinTb)
|
||
{
|
||
string noHad = allMun;
|
||
string noReplace = allMun + "ABCDEF";
|
||
string temp = "";
|
||
foreach (KeyValuePair<char, char> ke in key.Value)
|
||
{
|
||
noHad = noHad.Replace(ke.Value.ToString(), "");
|
||
noReplace = noReplace.Replace(ke.Key.ToString(), "");
|
||
temp += ke.Key + " = " + ke.Value + "\r\n";
|
||
}
|
||
if (noHad.Length == 1)
|
||
{
|
||
char[] no = noReplace.ToCharArray();
|
||
foreach (char c in no)
|
||
{
|
||
key.Value.Add(c, char.Parse(noHad));
|
||
}
|
||
}
|
||
}
|
||
|
||
foreach (KeyValuePair<int, Dictionary<char, char>> key in ShouZhangXinPdd)
|
||
{
|
||
string noHad = allMun;
|
||
string noReplace = allMun + "ABCDEF";
|
||
string temp = "";
|
||
foreach (KeyValuePair<char, char> ke in key.Value)
|
||
{
|
||
noHad = noHad.Replace(ke.Value.ToString(), "");
|
||
noReplace = noReplace.Replace(ke.Key.ToString(), "");
|
||
temp += ke.Key + " = " + ke.Value + "\r\n";
|
||
}
|
||
if (noHad.Length == 1)
|
||
{
|
||
char[] no = noReplace.ToCharArray();
|
||
foreach (char c in no)
|
||
{
|
||
key.Value.Add(c, char.Parse(noHad));
|
||
}
|
||
}
|
||
}
|
||
ShouZhangXinPdd[9] = ShouZhangXinTb[10];
|
||
|
||
//string t = Decode("JM_DD8E5EDC3643D01817BAEC21C67352");
|
||
}
|
||
|
||
public string DeCodeString = @"JM_DD8E5EDC3542D11713B9EB21C07752 564961026602
|
||
JM_DD8E5EDC3642D01710B8EF21C47754 554862166204
|
||
JM_DD8E5EDC3641D0191BB8E82FC67658 557889118018
|
||
JM_DD8E5EDC3542DC1411B0EE21C57756 564453976306
|
||
JM_DD8E5EDC3545DF191BB9ED25C07558 563789042628
|
||
JM_DD8E5EDC3542D0171AB0ED21C57555 564868946325
|
||
JM_DD8E5EDC364FD81713BBEC21C47151 559061256261
|
||
JM_DD8E5EDC3542DB1913BEED21C07353 564381746643
|
||
JM_DD8E5EDC3641DE111ABDED24C47F57 557608443287
|
||
JM_DD8E5EDC3542DC1411B0EE21C57756 564453976306
|
||
JM_DD8E5EDC364ED81514BEE82FC77250 558046718150
|
||
JM_DD8E5EDC3642D01710B8EF21C47754 554862166204
|
||
JM_DD8E5EDC3641DB1512BEEF26C27251 557340761451
|
||
JM_DD8E5EDC3543DF1016B1EF27C57050 565714860370
|
||
JM_DD8E5EDC374FDD1715B8E923C07152 549567104662
|
||
JM_DD8E5EDC3146DC1716BBE82EC37356 520464219546
|
||
JM_DD8E5EDC3746DE1511BFE820C37751 540643617501
|
||
JM_DD8E5EDC3643DA191ABDEB20C77E56 555288427196
|
||
JM_DD8E5EDC3545DA1214B9EA25CF7056 563236032976
|
||
JM_DD8E5EDC3543DF1812BDE020C17257 565790497757
|
||
JM_DD8E5EDC3545DB131ABCE021C17E50 56332859690
|
||
JM_DD8E5EDC3542D01914B0EB2FC77F58 564886928188
|
||
JM_DD8E5EDC3543DE1115BEEB22C07259 565607725659
|
||
JM_DD8E5EDC3540D91611BBED26C47659 566173241219
|
||
JM_DD8E5EDC3544D0111BBCED27CF7351 562809540941
|
||
JM_DD8E5EDC3740DA1211BFED2FC67F56 546233648086
|
||
JM_DD8E5EDC374FDD1914BAEB21C07354 549586326644
|
||
JM_DD8E5EDC3543D81313BFEC24C47E50 565021653290
|
||
JM_DD8E5EDC3141D01316BBE923C57755 527824204305
|
||
JM_D98817C43B40DC1415B9E022CE 864570958
|
||
JM_D98817C43A44DE1212BCE827 92630510
|
||
JM_D98817C43142DD1814BDED23C0 245964446
|
||
JM_D98817C43B40DC1415B9E022CE 864570958
|
||
JM_D98817C43445DC1310BCE927CF 734225009
|
||
JM_D98817C43446DD1014BAEF23C4 705163642
|
||
JM_D98817C43440D81116BBEA21C0 760042366
|
||
JM_D98817C43A45D0121BBDEC22CF 938394559
|
||
JM_D98817C4354FDD1017BAE124C0 695153836
|
||
JM_D98817C4354FDA191BB9EC21C7 692890561
|
||
JM_D98817C43547DD1215BFEA2E 61537639
|
||
JM_D98817C43445DF1313B8E82F 73721118
|
||
JM_D98817C43045DD1413BAE120C2 335513874
|
||
JM_D98817C43546DA1615BBED23C6 602772440
|
||
JM_D98817C43140DF141ABFE12FC4 267586882
|
||
JM_D98817C43541D11910BDE827C4 679824102
|
||
JM_D98817C43446D91316BEE02F 70124798
|
||
JM_D98817C43440D11110B1EA25C4 769028322
|
||
JM_D98817C43246DB1316BBEE25C27E 1032427249
|
||
JM_D98817C43643DC121ABFED21C7 554386461
|
||
JM_D98817C43A46DF131ABAEF23 90728364
|
||
JM_DD8E5EDC3741DF1011B8E120CE7F59 547713187889
|
||
JM_DD8E5EDC3141DF1210B9E923CE7057 527732004877
|
||
JM_DD8E5EDC374EDB1213B1E922CF7553 548331805923
|
||
JM_DD8E5EDD374FDD1013B8EF22C47E 44951116529
|
||
JM_DD8E5EDC3742D81111BBEA20C27355 544003237445
|
||
JM_DD8E5EDC3745D91217B9E12FC27354 543135088444
|
||
JM_DD8E5EDC3547DF1013B1E120C17F57 561711887787
|
||
JM_DD8E5EDC3747D81214BDEA2ECF7051 541036439971
|
||
JM_DD8E5EDC3041D1151AB1E122C37254 537948885554
|
||
JM_DD8E5EDC3640DB131AB9EC2FC37E52 556328058592
|
||
JM_DD8E5EDC3646DE1112B8EF25CF7256 550600162956
|
||
JM_DD8E5EDC3641DA151ABFEC2FC57751 557248658301
|
||
JM_DD8E5EDC3640DC1415B1ED2ECE7352 556457849842
|
||
JM_DD8E5EDC3045DF1511BDEA21C17F51 533743436781
|
||
JM_DD8E5EDC3147DB1311BBE923C77457 521323204137
|
||
JM_DD8E5EDC364EDC1811B1E821C67253 558493816053
|
||
JM_DD8E5EDD3743D01117BDEE26C073 44580547164
|
||
JM_DD8E5EDD3144DC1014B1E12EC673 42241688904
|
||
JM_DD8E5EDD374ED01114BCEB20C174 44880652773
|
||
JM_DD8E5EDC304EDB1712B9E926C27E54 538360001494
|
||
JM_DD8E5ED83B43D91217B9EA2FC276 18513503841
|
||
JM_DD8E5EDC3142DC1814BDEA21C37652 524496436512
|
||
JM_D98817C43645DD1512B0EC20 53540957
|
||
JM_D98817C43142D81917BFE826C2 240856114
|
||
JM_D98817C43543D0171AB0EF23C0 658689646
|
||
JM_D98817C4314ED8131BB8EB 2802912
|
||
JM_D98817C4364FDA1212B0E821CF 592309169
|
||
JM_D98817C43247D01612B1EC2E 11870859
|
||
JM_D98817C43546DB1316BDE8 6032441
|
||
JM_D98817C4314ED8131BB8EB 2802912
|
||
JM_D98817C4364FDA1212B0E821CF 592309169
|
||
JM_D98817C43247D01612B1EC2E 11870859
|
||
JM_D98817C43546DB1316BDE8 6032441
|
||
JM_D98817C4324EDB1110B9E027 18302090
|
||
JM_D98817C43743DB1113B8E92FCF 453011089
|
||
JM_DD8E5EDB3345DB1215BDEE2FC076 20333747861
|
||
JM_DD8E5EDB3340DA1414B8E82EC474 20625611923
|
||
JM_DD8E5EDD3347D91714BAE024C27E 40116639349
|
||
JM_DD8E5ED83346D91911B0EC2FC676 10018395801
|
||
JM_DD8E5EDA3545DB1016B0EF2FC571 36331496836
|
||
JM_D98817C43245D81312BFEE22C4 130206752
|
||
JM_D98817C43041D91617BCEA25C7 371755321
|
||
JM_D98817C43546DB181AB0E0 6039899
|
||
JM_D98817C43140DA1412B9EE 2625007
|
||
JM_D98817C43543D0171AB0EF23C0 658689646
|
||
JM_D98817C43142D81917BFE826C2 240856114
|
||
JM_D98817C43245DD1417BFEF24 13555663
|
||
JM_D98817C43246DB1211B9EF20C375 1033306752
|
||
JM_D98817C43A41D11315BCE920C6 979275070
|
||
JM_D98817C4324FDF1816B9EC23C2 197940544
|
||
JM_D98817C43446DB1610BCEC 7037255
|
||
JM_D98817C43544D0171ABAEB27C0 628683206
|
||
JM_D98817C43745DF1916BBE126C3 437842815
|
||
JM_D98817C4304EDC1913B0EA26C4 384819312
|
||
JM_D98817C43A42D11713B1E120C3 949618875
|
||
JM_D98817C43246DC1416BEEB24C1 104547237
|
||
JM_D98817C43A4FDF1815BDEC21C2 997974564
|
||
JM_D98817C43544D91115BCEE2FC5 621075783
|
||
JM_D98817C43A42DA111BBEE9 9420970
|
||
JM_D98817C43B40DA131BBFEA26C7 862296311
|
||
JM_D98817C4324FDE1712B9E820 19660017
|
||
JM_D98817C43140DF191BB8EF 2678916
|
||
JM_D98817C43045DA1111BCEE26 33203571
|
||
JM_D98817C43544DF1711BAE0 6276339
|
||
JM_D98817C43447DE1011B9E925CF 716130029
|
||
JM_D98817C4304FD01310BDE820C1 398224177
|
||
JM_D98817C43246D81811B8ED27CE73 1009314084
|
||
JM_D98817C4364FD01017BEE127CF 598157809
|
||
JM_D98817C43247D01217BEE122 11835785
|
||
JM_D98817C43544D01017B8E92FC0 628151086
|
||
JM_D98817C43545DA121ABAE020C5 632383973
|
||
JM_D98817C4304FD11116B8EB27C6 399041200
|
||
JM_D98817C43A43D1101ABEE020C6 959187970
|
||
JM_D98817C43241DC1313BEED27 17421740";
|
||
}
|
||
|
||
|
||
}
|