temu客户端程序
This commit is contained in:
commit
4aaf264e89
694 files changed
+263780
No files matched your search
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AllBase;
|
||||
|
||||
|
||||
namespace Work
|
||||
{
|
||||
public class UpShopIdFromServer
|
||||
{
|
||||
/// <summary>
|
||||
/// 上家id队列:id , site_id +'000' + productid
|
||||
/// </summary>
|
||||
public static Dictionary<long, UpShopIdBase> UpIds = new Dictionary<long, UpShopIdBase>();
|
||||
public static void Get(string shopId, string shopName)
|
||||
{
|
||||
string url = BaseClass.LoginApiUrl + "index.php?obj=upshopid/get&act=get_shop";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(UserLogin.GetSignaturex(shopId, shopName));
|
||||
//sb.Append("&act=get_shop");
|
||||
sb.Append("&shop_id=" + shopId);
|
||||
string html = GetHtml.PostUtf8(url, sb);
|
||||
if (string.IsNullOrEmpty(html) )
|
||||
return;
|
||||
var m = BaseRegex.GetMatchRegex(ref html, "<upid_shop([^>]+?)>");
|
||||
for (int i = 0; m!=null && i < m.Count; i++)
|
||||
{
|
||||
string list = m[i].Groups[0].Value;
|
||||
string sid_pid = BaseRegex.GetStringJson(ref list, "sid_pid");
|
||||
if(!sid_pid.Contains("000"))
|
||||
continue;
|
||||
UpShopIdBase us = new UpShopIdBase();
|
||||
us.SiteId = int.Parse(sid_pid.Substring(0, sid_pid.IndexOf("000")));
|
||||
us.ProductId = long.Parse(sid_pid.Substring(sid_pid.IndexOf("000") + 3));
|
||||
us.SiteIdFrom = BaseRegex.GetIntJson(ref list, "site_id_from");
|
||||
us.ProductIdFrom = BaseRegex.GetLongJson(ref list, "product_id_from");
|
||||
AddTemp(us);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddTemp(UpShopIdBase us)
|
||||
{
|
||||
if (UpIds.ContainsKey(us.ProductId))
|
||||
return;
|
||||
try
|
||||
{
|
||||
UpIds.Add(us.ProductId, us);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddToServer(UpShopIdBase us, string shopId, string shopName)
|
||||
{
|
||||
string url = BaseClass.LoginApiUrl+ "index.php?obj=upshopid/add&act=add";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(UserLogin.GetSignaturex(shopId, shopName));
|
||||
//sb.Append("&act=add");
|
||||
sb.Append("&site_id=" + us.SiteId);
|
||||
sb.Append("&product_id=" + us.ProductId);
|
||||
sb.Append("&site_id_from=" + us.SiteIdFrom);
|
||||
sb.Append("&product_id_from=" + us.ProductIdFrom);
|
||||
string html = GetHtml.PostUtf8(url, sb);
|
||||
|
||||
}
|
||||
|
||||
public static UpShopIdBase Get(long productId, string shopId, string shopName)
|
||||
{
|
||||
string url = BaseClass.LoginApiUrl + "index.php?obj=upshopid/get&act=get_id";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(UserLogin.GetSignaturex(shopId, shopName));
|
||||
//sb.Append("&act=get_id");
|
||||
sb.Append("&site_id=2");
|
||||
sb.Append("&product_id=" + productId);
|
||||
string html = GetHtml.PostUtf8(url, sb);
|
||||
if (string.IsNullOrEmpty(html) || html == "none")
|
||||
return null;
|
||||
UpShopIdBase us = new UpShopIdBase();
|
||||
us.ProductId = productId;
|
||||
us.SiteId = 2;
|
||||
us.ProductIdFrom = BaseRegex.GetLongJson(ref html, "product_id_from");
|
||||
us.SiteIdFrom = BaseRegex.GetIntJson(ref html, "site_id_from");
|
||||
AddTemp(us);
|
||||
return us;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class UpShopIdBase
|
||||
{
|
||||
public int SiteId = 0;
|
||||
public long ProductId = 0;
|
||||
public int SiteIdFrom = 0;
|
||||
public long ProductIdFrom = 0;
|
||||
public string Url
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (SiteIdFrom)
|
||||
{
|
||||
case 1:
|
||||
return "https://item.taobao.com/item.htm?id=" + ProductIdFrom;
|
||||
case 2:
|
||||
return BaseClass.NewUrl+"/goods.html?goods_id=" + ProductIdFrom;
|
||||
case 3:
|
||||
return "https://detail.1688.com/offer/" + ProductIdFrom + ".html";
|
||||
case 4:
|
||||
return "https://item.m.jd.com/product/" + ProductIdFrom + ".html";
|
||||
case 6:
|
||||
return "https://weidian.com/item.html?itemID=" + ProductIdFrom + ".html";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
set { }
|
||||
}
|
||||
/// <summary>
|
||||
/// 上家编码带 tb / pd
|
||||
/// </summary>
|
||||
public string UpCode
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (SiteIdFrom)
|
||||
{
|
||||
case 1:
|
||||
return "tb-" + ProductIdFrom;
|
||||
case 2:
|
||||
return "pd-" + ProductIdFrom;
|
||||
case 3:
|
||||
return "al-" + ProductIdFrom;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public bool GetOk = false;
|
||||
public string Message = "";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user