622 lines
33 KiB
C#
622 lines
33 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using AllBase;
|
||
using System.IO;
|
||
using System.Windows.Forms;
|
||
using Work.Tips;
|
||
using System.Threading.Tasks;
|
||
using System.Linq;
|
||
using Work.Pinduoduo;
|
||
using Work.Taobao;
|
||
using Work.BuyUsers;
|
||
|
||
namespace Work
|
||
{
|
||
public class AutoConfirmExpress
|
||
{
|
||
public static List<KeyValueBase> ExpressList = new List<KeyValueBase>();
|
||
public int BuyType;
|
||
public string Cookies = "";
|
||
|
||
public static List<string> ordersx = new List<string>();//存储已发货的订单--拍单
|
||
public static Dictionary<string, string> beforeOrderx = new Dictionary<string, string>();
|
||
|
||
public static List<string> ordersp = new List<string>();//存储已发货的订单--拼单
|
||
public static Dictionary<string, string> beforeOrderp = new Dictionary<string, string>();
|
||
|
||
public Dictionary<string, ProvinceBase> Province = new Dictionary<string, ProvinceBase>();
|
||
public AutoConfirmExpress()
|
||
{
|
||
|
||
}
|
||
|
||
public AutoConfirmExpress(string cookies)
|
||
{
|
||
Cookies = cookies;
|
||
}
|
||
|
||
public AutoConfirmExpress(int buyType, string cookies)
|
||
{
|
||
Cookies = cookies;
|
||
BuyType = buyType;
|
||
if (ExpressList.Count > 0)
|
||
{
|
||
return;
|
||
}
|
||
var m = BaseRegex.GetMatchRegex(ref ExpressNames, @"<a val=""([\d]+)"">([^<]+?)</a>");
|
||
for (int i = 0; i < m.Count; i++)
|
||
{
|
||
string key = m[i].Groups[1].Value;
|
||
string value = m[i].Groups[2].Value;
|
||
KeyValueBase k = new KeyValueBase(key, value);
|
||
ExpressList.Add(k);
|
||
}
|
||
}
|
||
|
||
public AutoConfirmExpress(int buyType)
|
||
{
|
||
BuyType = buyType;
|
||
if (ExpressList.Count > 0)
|
||
{
|
||
return;
|
||
}
|
||
var m = BaseRegex.GetMatchRegex(ref ExpressNames, @"<a val=""([\d]+)"">([^<]+?)</a>");
|
||
for (int i = 0; i < m.Count; i++)
|
||
{
|
||
string key = m[i].Groups[1].Value;
|
||
string value = m[i].Groups[2].Value;
|
||
KeyValueBase k = new KeyValueBase(key, value);
|
||
ExpressList.Add(k);
|
||
}
|
||
}
|
||
|
||
public static List<string> TaobaoOrder = new List<string>();
|
||
|
||
public void GetTaobao(string cookies)
|
||
{
|
||
//Dictionary<char,Dictionary< char,Dictionary < char,string>>> chars = new Dictionary<char, Dictionary<char, Dictionary<char, string>>>();
|
||
|
||
string url = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&tabCode=waitConfirm";
|
||
string refere = url;
|
||
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, false, cookies);
|
||
html = GetHtml.Decode(html);
|
||
if (!string.IsNullOrEmpty(html))
|
||
html = html.Replace("\\\"", "\"").Replace("\\/", "/");
|
||
int page = BaseRegex.GetIntJson(ref html, "totalPage");
|
||
for (int k = 1; k <= page; k++)
|
||
{
|
||
if (k != 1)
|
||
{
|
||
//string data =
|
||
// "buyerNick=&dateBegin=0&dateEnd=0&lastStartRow=&logisticsService=&options=0&orderStatus=&pageNum=" + k
|
||
// + "&pageSize=15&queryBizType=&queryOrder=desc&rateStatus=&refund=&sellerNick=&prePageNo=2";
|
||
string data = "lastStartRow=&options=0&orderStatus=SEND&pageNum=" + k + "&pageSize=15&queryBizType=&queryOrder=desc&tabCode=waitConfirm&prePageNo=" + (k - 1);
|
||
url = "https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8";
|
||
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies);
|
||
Thread.Sleep(5 * 1000);
|
||
}
|
||
|
||
var m = BaseRegex.GetMatchRegex(ref html, @"\{""extra"":([\w\W]+?)""quantity"":""([\d]+)""");
|
||
for (int i = 0; m != null && i < m.Count; i++)
|
||
{
|
||
string list = m[i].Groups[0].Value;
|
||
string oid = BaseRegex.GetLongJson(ref list, "id").ToString();
|
||
if (oid == "553074309923804790")
|
||
{
|
||
|
||
}
|
||
//if (!beforeOrder.ContainsKey(oid))
|
||
//{
|
||
// continue;
|
||
//}
|
||
//根据上家的订单从数据库获取此订单
|
||
|
||
string status = BaseRegex.GetStringJson(ref list, "tradeStatus");
|
||
if (status != "WAIT_BUYER_CONFIRM_GOODS" && status != "TRADE_BUYER_SIGNED" && status != "TRADE_CLOSED" && status != "TRADE_FINISHED")
|
||
{
|
||
continue;
|
||
}
|
||
string sell = BaseRegex.GetMatchRegexString(ref list, @"""seller"":\{([^\}]+?)\}");
|
||
long shopId = BaseRegex.GetLongJson(ref sell, "id");
|
||
url = "https://wuliu.taobao.com/user/order_detail_new.htm?trade_id=" + oid + "&seller_id=" + shopId;
|
||
html = GetPostTaobaoHtml.UploadTaobao(url, refere, false);
|
||
Thread.Sleep(1500);
|
||
string no = BaseRegex.GetMatchRegexString(ref html,
|
||
@"<label class=""label"">运单号码:</label>\s+<span class=""em"">([^<]+?)</span>");
|
||
string company = BaseRegex.GetMatchRegexString(ref html,
|
||
@"<label class=""label"">物流公司:</label>\s+<span class=""em"">([^<]+?)</span>");
|
||
if (string.IsNullOrEmpty(no) || string.IsNullOrEmpty(company))
|
||
{
|
||
continue;
|
||
}
|
||
no = no.Trim();
|
||
company = company.Trim();
|
||
if (company == "中国邮政")
|
||
{
|
||
company = "邮政快递包裹";
|
||
}
|
||
var express = GetExpressId(company);
|
||
if (express == null)
|
||
{
|
||
LogSave.Add("没有找到快递公司");
|
||
continue;
|
||
}
|
||
company = express.Value;
|
||
int companyId = int.Parse(express.Key);
|
||
//string orderId = beforeOrder[oid];
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
public KeyValueBase GetExpressId(string company)
|
||
{
|
||
if (ExpressList.Count == 0)
|
||
{
|
||
var m = BaseRegex.GetMatchRegex(ref ExpressNames, @"<a val=""([\d]+)"">([^<]+?)</a>");
|
||
for (int i = 0; i < m.Count; i++)
|
||
{
|
||
string key = m[i].Groups[1].Value;
|
||
string value = m[i].Groups[2].Value;
|
||
KeyValueBase k = new KeyValueBase(key, value);
|
||
ExpressList.Add(k);
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < ExpressList.Count; i++)
|
||
{
|
||
if (ExpressList[i].Value == company || ExpressList[i].Value.Replace("快递", "速递") == company || ExpressList[i].Value.Replace("快递", "速运") == company)
|
||
return ExpressList[i];
|
||
}
|
||
for (int i = 0; i < ExpressList.Count; i++)
|
||
{
|
||
int subNum = 2;//截取的长度
|
||
if (ExpressList[i].Value.Contains("邮政") && ExpressList[i].Value.Length > 3 && company.Length > 3)
|
||
{
|
||
subNum = 4;
|
||
}
|
||
if (ExpressList[i].Value.Length > 1 && company.Length > 1 && ExpressList[i].Value.Substring(0, subNum) == company.Substring(0, subNum))
|
||
return ExpressList[i];
|
||
}
|
||
return null;
|
||
}
|
||
|
||
|
||
#region 新方式获取买手号拍单物流信息
|
||
|
||
#endregion
|
||
|
||
#region 从拼多多买手获取上家发货的物流信息后,自动购买快递单
|
||
|
||
public string IsBuyEmptyBag(string orderId)
|
||
{
|
||
string data = UserLogin.GetSignaturex();
|
||
StringBuilder s = new StringBuilder();
|
||
s.Append("&order_id=" + orderId);
|
||
string url = BaseClass.BuildObjString("pay_group_order&act=get_empty_id");
|
||
string html = GetHtml.PostUtf8(url, data + s);
|
||
|
||
return html;
|
||
}
|
||
|
||
#region 将上家Id存到txt
|
||
public static void PreserveBuyEmptyBags(string orderId)
|
||
{
|
||
string path = Environment.CurrentDirectory + "\\temp\\emptybag_temp";
|
||
|
||
try
|
||
{
|
||
//判断文件路径是否存在
|
||
DirectoryInfo directory = new DirectoryInfo(path);
|
||
bool isHas = directory.Exists;
|
||
if (!isHas)//若文件路径不存在则创建
|
||
{
|
||
isHas = FileBase.DirectoryCreate(path);
|
||
}
|
||
if (isHas)
|
||
{
|
||
string file = "BuyEmptyBag.txt";
|
||
|
||
string filePath = Environment.CurrentDirectory + "\\temp\\emptybag_temp\\" + file;
|
||
|
||
//FileStream fileStream = new FileStream(filePath, FileMode.Create);
|
||
StreamWriter streamWriter = new StreamWriter(filePath, true);
|
||
|
||
string content = orderId;
|
||
|
||
streamWriter.Write(content + "\r\n");
|
||
|
||
streamWriter.Flush();
|
||
streamWriter.Close();
|
||
//fileStream.Close();
|
||
|
||
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
|
||
//throw;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 从服务端获取已发货的订单
|
||
public void GetConfirmOrders()
|
||
{
|
||
int page = 1;
|
||
string url, html;
|
||
|
||
for (int p = 0; p < page; p++)
|
||
{
|
||
Thread.Sleep(1000);
|
||
string data = UserLogin.GetSignaturex();
|
||
url = BaseClass.BuildObjString("pay_group_order&act=get_confirm_order&buy_type=" + BuyType + "&page=" + p);
|
||
html = GetHtml.PostUtf8(url, data);
|
||
page = BaseRegex.GetIntValue(html, "page");
|
||
if (string.IsNullOrEmpty(html))
|
||
{
|
||
LogSave.Add("拼单", "获取订单列表网络异常,请稍后重试");
|
||
return;
|
||
}
|
||
var mm = BaseRegex.GetMatchRegex(ref html, "<order ([^>]+?)>");
|
||
for (int i = 0; i < mm.Count; i++)
|
||
{
|
||
string list = mm[i].Groups[0].Value;
|
||
string orderId = BaseRegex.GetStringJson(ref list, "order_id_buy");
|
||
string orderIdb = BaseRegex.GetStringJson(ref list, "order_id");
|
||
if (string.IsNullOrEmpty(orderId))
|
||
{
|
||
continue;
|
||
}
|
||
if (BuyType == 1)
|
||
{
|
||
var isHas = ordersp.Find(x => x != null && x == orderId);
|
||
if (isHas == null)
|
||
ordersp.Add(orderId);
|
||
|
||
if (!beforeOrderp.ContainsKey(orderId))
|
||
beforeOrderp.Add(orderId, orderIdb);
|
||
}
|
||
else
|
||
{
|
||
|
||
var isHas = ordersx.Find(x => x != null && x == orderId);
|
||
if (isHas == null)
|
||
ordersx.Add(orderId);
|
||
|
||
if (!beforeOrderx.ContainsKey(orderId))
|
||
beforeOrderx.Add(orderId, orderIdb);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 订单确认收货
|
||
/// </summary>
|
||
/// <param name="oid"></param>
|
||
/// <param name="goods_id"></param>
|
||
public void ConfirmOrder(string oid, string goods_id)
|
||
{
|
||
string url = "http://apiv4.yangkeduo.com/order/" + oid + "/received?pdduid=" + BaseClass.PddUid + "&is_back=1";
|
||
string data = "{}";
|
||
string refere = BaseClass.PddMobileUrlx + "orders.html?refer_page_name=login&refer_page_id=login_1513005785399_B4Dxk8TYgA&type=3&order_index=0";
|
||
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Cookies);
|
||
|
||
refere = BaseClass.PddMobileUrlx + "comments.html?order_sn=" + oid + "&goods_id=" + goods_id +
|
||
"&page_el_sn=99664&type=3&refer_page_name=my_order&refer_page_id=my_order_1513006052449_n43miXeWuI&refer_page_sn=10032&refer_page_el_sn=99664";
|
||
url = "http://apiv4.yangkeduo.com/v2/order/goods/review?pdduid=" + BaseClass.PddUid;
|
||
data = "{\"goods_id\":" + goods_id + ",\"order_sn\":\"" + oid + "\",\"desc_score\":5,\"logistics_score\":5,\"service_score\":5,\"comment\":\"\",\"pictures\":[]}";
|
||
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Cookies);
|
||
if (html.Contains("rating_id"))
|
||
{
|
||
LogSave.Add("拼单", "确认收货成功:" + oid);
|
||
}
|
||
Thread.Sleep(300);
|
||
}
|
||
|
||
public bool UpdateServer(string order_id, string shippingName, string trackingNumber, int expressId, string oId, string status)
|
||
{
|
||
StringBuilder s = new StringBuilder();
|
||
if (status != "发货成功" && status != "快递单发货成功" && status != "错误单发货成功" && status != "单号修改成功" && !status.Contains("单号修改失败"))//已发货订单不改成上家发货
|
||
{
|
||
s.Append("&status=" + 8);//上家发货
|
||
}
|
||
s.Append("&oid=" + order_id);
|
||
s.Append("&express_name=" + shippingName);
|
||
s.Append("&express_id=" + expressId);
|
||
s.Append("&express_no=" + trackingNumber);
|
||
string now = BaseClass.GetServerTimeString().ToString("yyyy-MM-dd HH:mm:ss");
|
||
s.Append("&get_up_express_time=" + now);
|
||
s.Append("&get_time=1");
|
||
string data = UserLogin.GetSignaturex();
|
||
string url = BaseClass.BuildObjString("pay_group_order&act=updatex&buy_type=" + BuyType);
|
||
string html = GetHtml.PostUtf8(url, data + s);
|
||
if (html != "ok")
|
||
{
|
||
Thread.Sleep(10 * 1000);
|
||
data = UserLogin.GetSignaturex();
|
||
html = GetHtml.PostUtf8(url, data + s);
|
||
}
|
||
if (html != "ok")
|
||
{
|
||
Thread.Sleep(30 * 1000);
|
||
data = UserLogin.GetSignaturex();
|
||
html = GetHtml.PostUtf8(url, data + s);
|
||
}
|
||
if (html != "ok")
|
||
{
|
||
//LogSave.Add("拼单", "自动提交物流信息失败,请检查网络");
|
||
string msg = "【订单:" + order_id + "】 获取上家物流更新到服务器异常" + html + "\r\n\r\n";
|
||
FileBase.WriteTxt("\\temp\\UpdUpExpLog", "updUpExpLog", msg, false);
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
|
||
return true;
|
||
}
|
||
}
|
||
|
||
#region 获取进价
|
||
public string CheckOrderPrice(string orderId_buy, string orderId, string payMobile)
|
||
{
|
||
string buyPrice = "";
|
||
//string provinceName = "";
|
||
//string cityName = "";
|
||
//string districtName = "";
|
||
//string shippingAddress = "";
|
||
string addressDetail = "";
|
||
string receiveName = "";
|
||
string mobile = "";
|
||
if (orderId_buy.Contains("-"))
|
||
{
|
||
|
||
var payAccount = PddBuyUser.buyUserCookies.First(x => x.Value.UserName == payMobile);
|
||
string cookies = "";
|
||
for (int j = 0; j < payAccount.Value.Cookies.Count; j++)
|
||
{
|
||
cookies += payAccount.Value.Cookies[j].Name + "=" + payAccount.Value.Cookies[j].Value + "; ";
|
||
}
|
||
|
||
string url = BaseClass.PddMobileUrl + "order.html?order_sn=" + orderId_buy +
|
||
"&refer_page_name=my_order&refer_page_id=my_order_1513009667550_P4xCgmERE6&refer_page_sn=10032";
|
||
string refere = BaseClass.PddMobileUrl;
|
||
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, cookies);
|
||
html = GetHtml.UrlDecode(html);
|
||
buyPrice = BaseRegex.GetMatchRegexString(ref html, "<i>¥</i><span>([\\s\\S]+?)</span>");
|
||
if (html.Contains("window.rawData=null;"))
|
||
{
|
||
MessageBox.Show("买手号已掉线,无法读取");
|
||
return "";
|
||
}
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
decimal buyPriceTemp = BaseRegex.GetDecimalJson(ref html, "displayAmount");
|
||
if (buyPriceTemp > 0)
|
||
{
|
||
buyPrice = (buyPriceTemp / 100).ToString();
|
||
}
|
||
}
|
||
|
||
string provinceName = BaseRegex.GetStringJson(ref html, "provinceName");
|
||
string cityName = BaseRegex.GetStringJson(ref html, "cityName");
|
||
string districtName = BaseRegex.GetStringJson(ref html, "districtName");
|
||
string shippingAddress = BaseRegex.GetStringJson(ref html, "shippingAddress");
|
||
addressDetail = provinceName + cityName + districtName + shippingAddress;
|
||
receiveName = BaseRegex.GetStringJson(ref html, "receiveName");
|
||
mobile = BaseRegex.GetStringJson(ref html, "mobile");
|
||
}
|
||
else
|
||
{
|
||
TbHttpReauest tbRequest = new TbHttpReauest();
|
||
var payAccount = TaoBaoBuyUser.buyUserCookies.First(x => x.Value.UserName == payMobile);
|
||
if (payAccount.Key.site_id==3)//1688读进货价
|
||
{
|
||
tbRequest.url = "https://trade.1688.com/order/new_step_order_detail.htm?orderId=" + orderId_buy;
|
||
tbRequest.cookies = Cookies;
|
||
string html = tbRequest.MakeRequests();
|
||
//把 GBK 数据 转换为 URL 编码的字符串
|
||
html = GetHtml.UrlDecode(html).Replace("\\", "");
|
||
|
||
System.Text.RegularExpressions.Regex rg = new System.Text.RegularExpressions.Regex("(?<=(total-price\">))[.\\s\\S]*?(?=(</em>))", System.Text.RegularExpressions.RegexOptions.Multiline | System.Text.RegularExpressions.RegexOptions.Singleline);
|
||
buyPrice = rg.Match(html).Value;
|
||
}
|
||
else
|
||
{
|
||
tbRequest.url = "https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=" + orderId_buy;
|
||
tbRequest.cookies = Cookies;
|
||
string html = tbRequest.MakeRequests();
|
||
html = GetHtml.UrlDecode(html).Replace("\\", "");
|
||
|
||
|
||
//url = "https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8";
|
||
//string refer = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm";
|
||
//string data = "pageNum=1&pageSize=15&auctionTitle=" + orderId_buy + "&itemTitle=" + orderId_buy + "&prePageNo=1";
|
||
//html = GetPostTaobaoHtml.UploadTaobaoPost(url, refer, true, data, true, Cookies);
|
||
|
||
buyPrice = BaseRegex.GetMatchRegexString(ref html, "\"name\":\"实付款\",\"value\":\"¥([\\s\\S]+?)\"");
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
string url = "https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=" + orderId_buy;
|
||
//string url = "https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=" + orderId_buy;
|
||
html = GetPostTaobaoHtml.UploadTaobao(url, url, true, Cookies);
|
||
if (html.Contains("滑动一下") || html.Contains("验证码") || html.Contains("_____tmd_____/punish"))
|
||
{
|
||
html = GetPostTaobaoHtml.UploadTaobao(url, url, true);//用滑动之后的cookies获取
|
||
if (html.Contains("滑动") || html.Contains("_____tmd_____/punish"))
|
||
{
|
||
url = "https://trade.tmall.com/detail/orderDetail.htm?biz_order_id=" + orderId_buy + "&forward_action=";
|
||
html = GetPostTaobaoHtml.UploadTaobao(url, url, true, Cookies);
|
||
}
|
||
}
|
||
html = GetHtml.UrlDecode(html).Replace("\\", "");
|
||
buyPrice = BaseRegex.GetMatchRegexString(ref html, "\"name\":\"实付款\",\"value\":\"¥([\\s\\S]+?)\"");
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
var arrPrice = BaseRegex.GetMatchRegex(ref html, "({\"content\":[{\"data\":{\"money\":[\\s\\S]+?\"text\":\"[\\s\\S]+?\",\"type\":\"label\"}})");
|
||
for (int i = 0; i < arrPrice.Count; i++)
|
||
{
|
||
var item = arrPrice[i].ToString();
|
||
if (item.Contains("实付款"))
|
||
{
|
||
buyPrice = BaseRegex.GetMatchRegexString(ref item, "\"text\":\"¥([\\s\\S]+?)\"");
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
buyPrice = BaseRegex.GetMatchRegexString(ref html, "\"name\":\"订单总金额\",\"value\":\"([\\s\\S]+?)\"");
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
buyPrice = BaseRegex.GetStringJson(ref html, "priceInfo");
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
decimal tempPrice = 0M;
|
||
try
|
||
{
|
||
var tempPriceInfo = System.Text.RegularExpressions.Regex.Matches(html, "priceInfo\":\\[\\{\"text\":\"¥[\\s\\S]+\",\"type\":\"label\"\\}\\],\"quantity\":\"[\\d]+?\"\\}\\]");
|
||
if (tempPriceInfo.Count > 0)
|
||
{
|
||
string tempPriceInfoStr = tempPriceInfo[0].ToString();
|
||
string tempPriceStr = BaseRegex.GetMatchRegexString(ref tempPriceInfoStr, "priceInfo\":\\[\\{\"text\":\"¥([\\s\\S]+)\",\"type\":\"label\"\\}\\],\"quantity\":\"([\\d]+?)\"\\}\\]");
|
||
if (!string.IsNullOrEmpty(tempPriceStr))
|
||
{
|
||
tempPrice = Convert.ToDecimal(tempPriceStr);//单个商品价格
|
||
int quantity = BaseRegex.GetIntJson(ref tempPriceInfoStr, "quantity");//数量
|
||
tempPrice = tempPrice * quantity;
|
||
buyPrice = tempPrice.ToString();
|
||
}
|
||
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
try
|
||
{
|
||
|
||
var tempPriceInfo = System.Text.RegularExpressions.Regex.Matches(html, "priceInfo\":\\[\\{\"text\":\"¥[\\s\\S]+\",\"type\":\"label\"\\}\\],\"quantity\":\"[\\d]+?\"\\}\\]\\},");
|
||
if (tempPriceInfo.Count > 0)
|
||
{
|
||
string tempPriceInfoStr = tempPriceInfo[0].ToString();
|
||
string tempPriceStr = BaseRegex.GetMatchRegexString(ref tempPriceInfoStr, "priceInfo\":\\[\\{\"text\":\"¥([\\s\\S]+)\",\"type\":\"label\"\\}\\],\"quantity\":\"([\\d]+?)\"\\}\\]");
|
||
if (!string.IsNullOrEmpty(tempPriceStr))
|
||
{
|
||
tempPrice = Convert.ToDecimal(tempPriceStr);//单个商品价格
|
||
int quantity = BaseRegex.GetIntJson(ref tempPriceInfoStr, "quantity");//数量
|
||
tempPrice = tempPrice * quantity;
|
||
buyPrice = tempPrice.ToString();
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
catch (Exception)
|
||
{
|
||
|
||
//throw;
|
||
}
|
||
//throw;
|
||
}
|
||
}
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
string url = "https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8";
|
||
string refer = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm";
|
||
string data = "pageNum=1&pageSize=15&auctionTitle=" + orderId_buy + "&itemTitle=" + orderId_buy + "&prePageNo=1";
|
||
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(url, refer, true, data, Cookies);
|
||
string tempStr = BaseRegex.GetMatchRegexString(ref htmlx, "(\"payInfo\":\\{\"actualFee\":\"[\\s\\S]+?\",)");
|
||
if (!string.IsNullOrEmpty(tempStr))
|
||
{
|
||
buyPrice = BaseRegex.GetStringJson(ref tempStr, "actualFee");
|
||
}
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
htmlx = GetPostTaobaoHtml.UploadTaobaoPost(url, refer, true, data);
|
||
tempStr = BaseRegex.GetMatchRegexString(ref htmlx, "(\"payInfo\":\\{\"actualFee\":\"[\\s\\S]+?\",)");
|
||
if (!string.IsNullOrEmpty(tempStr))
|
||
{
|
||
buyPrice = BaseRegex.GetStringJson(ref tempStr, "actualFee");
|
||
}
|
||
}
|
||
|
||
}
|
||
if (!string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
buyPrice = buyPrice.Replace("¥", "");
|
||
}
|
||
string address = BaseRegex.GetStringJson(ref html, "address");
|
||
if (!string.IsNullOrEmpty(address))
|
||
{
|
||
var receiverInfoArr = address.Split(',');
|
||
if (receiverInfoArr.Length == 4)
|
||
{
|
||
receiveName = receiverInfoArr[0];
|
||
mobile = receiverInfoArr[1];
|
||
addressDetail = receiverInfoArr[2];
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(buyPrice))
|
||
{
|
||
return "0";
|
||
}
|
||
return buyPrice;
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
public bool isReturnProduct(string orderId_buy, string cookies)
|
||
{
|
||
if (orderId_buy.Contains("-"))
|
||
{
|
||
string url = BaseClass.PddMobileUrl + "order.html?order_sn=" + orderId_buy +
|
||
"&refer_page_name=my_order&refer_page_id=my_order_1513009667550_P4xCgmERE6&refer_page_sn=10032";
|
||
string refere = BaseClass.PddMobileUrl;
|
||
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, cookies);
|
||
html = GetHtml.UrlDecode(html);
|
||
if (html.Contains("<a>退款成功(详情)</a>"))
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public void ResetErrorSend()
|
||
{
|
||
string data = UserLogin.GetSignaturex();
|
||
string url = BaseClass.BuildObjString("pay_group_order&act=reset_status");
|
||
string html = GetHtml.PostUtf8(url, data);
|
||
if (html != "ok")
|
||
{
|
||
}
|
||
}
|
||
|
||
public string ExpressNames = "<a val=\"1\">申通快递</a><a val=\"3\">百世快递</a><a val=\"44\">顺丰快递</a><a val=\"85\">圆通快递</a><a val=\"89\">赛澳递</a><a val=\"90\">晟邦物流</a><a val=\"115\">中通快递</a><a val=\"116\">全峰快递</a><a val=\"117\">优速快递</a><a val=\"118\">邮政EMS</a><a val=\"119\">天天快递</a><a val=\"120\">京东配送</a><a val=\"121\">韵达快递</a><a val=\"122\">快捷快递</a><a val=\"124\">国通快递</a><a val=\"129\">宅急送快递</a><a val=\"130\">如风达</a><a val=\"131\">德邦快递</a><a val=\"132\">邮政快递包裹</a><a val=\"133\">龙邦快递</a><a val=\"135\">联邦快递</a><a val=\"136\">九曳供应链</a><a val=\"140\">南京晟邦</a><a val=\"142\">万象物流</a><a val=\"143\">立即送</a><a val=\"144\">门对门</a><a val=\"148\">安达信</a><a val=\"149\">海外快递</a><a val=\"150\">飞远物流</a><a val=\"152\">汇文快递</a><a val=\"154\">黄马甲</a><a val=\"155\">速尔快递</a><a val=\"156\">亚马逊物流</a><a val=\"157\">黑猫宅急便</a><a val=\"161\">上海赛澳递</a><a val=\"162\">城市100</a><a val=\"163\">芝麻开门</a><a val=\"164\">顺捷丰达</a><a val=\"165\">汇通小红马</a><a val=\"180\">其他</a><a val=\"183\">跨越速递</a><a val=\"186\">usps</a><a val=\"187\">青岛安捷</a><a val=\"195\">贝海国际速递</a><a val=\"197\">环球速运</a><a val=\"201\">全一快递</a><a val=\"205\">远成快运</a><a val=\"209\">联众国际快运</a><a val=\"210\">天地华宇</a><a val=\"211\">中邮速递</a><a val=\"213\">EMS-国际件</a><a val=\"214\">中铁物流</a><a val=\"216\">新邦物流</a><a val=\"217\">Flash Express</a><a val=\"218\">新顺丰NSF</a><a val=\"221\">DCS GLOBAL</a><a val=\"227\">日日顺物流</a><a val=\"228\">苏宁快递</a><a val=\"229\">百世快运</a><a val=\"230\">德邦物流</a><a val=\"231\">微特派</a><a val=\"232\">AAE全球专递</a><a val=\"233\">Aramex</a><a val=\"234\">Asendia USA</a><a val=\"235\">City-Link</a><a val=\"236\">COE</a><a val=\"237\">DHL德国</a><a val=\"238\">DHL全球</a><a val=\"239\">DHL中国</a><a val=\"240\">EMS国际</a><a val=\"241\">FedEx美国</a><a val=\"242\">FedEx中国</a><a val=\"243\">OCS</a><a val=\"244\">OnTrac</a><a val=\"245\">TNT</a><a val=\"246\">UPS</a><a val=\"247\">阿尔巴尼亚邮政</a><a val=\"248\">阿根廷邮政</a><a val=\"249\">阿联酋邮政</a><a val=\"250\">爱沙尼亚邮政</a><a val=\"252\">奥地利邮政</a><a val=\"253\">澳大利亚邮政</a><a val=\"254\">巴基斯坦邮政</a><a val=\"255\">巴西邮政</a><a val=\"256\">白俄罗斯邮政</a><a val=\"257\">百福东方</a><a val=\"258\">包裹信件</a><a val=\"259\">保加利亚邮政</a><a val=\"260\">比利时邮政</a><a val=\"261\">波兰邮政</a><a val=\"262\">传喜物流</a><a val=\"263\">大田物流</a><a val=\"264\">递四方</a><a val=\"265\">俄速通</a><a val=\"266\">法国邮政</a><a val=\"267\">凡宇快递</a><a val=\"268\">飞豹快递</a><a val=\"269\">飞远(爱彼西)配送</a><a val=\"270\">芬兰邮政</a><a val=\"271\">哥伦比亚邮政</a><a val=\"272\">韩国邮政</a><a val=\"273\">恒路物流</a><a val=\"274\">华企快运</a><a val=\"275\">加运美</a><a val=\"276\">佳吉快运</a><a val=\"277\">佳怡物流</a><a val=\"278\">嘉里大通</a><a val=\"279\">捷克邮政</a><a val=\"280\">筋斗云物流</a><a val=\"281\">京广速递</a><a val=\"282\">克罗地亚邮政</a><a val=\"283\">拉脱维亚邮政</a><a val=\"284\">黎巴嫩邮政</a><a val=\"285\">联昊通</a><a val=\"286\">马耳他邮政</a><a val=\"287\">马其顿邮政</a><a val=\"288\">毛里求斯邮政</a><a val=\"289\">秘鲁邮政</a><a val=\"290\">民邦快递</a><a val=\"291\">民航快递</a><a val=\"292\">明亮物流</a><a val=\"293\">摩尔多瓦邮政</a><a val=\"294\">南非邮政</a><a val=\"295\">挪威邮政</a><a val=\"296\">葡萄牙邮政</a><a val=\"297\">全日通</a><a val=\"298\">日本邮政</a><a val=\"299\">瑞典邮政</a><a val=\"300\">瑞士邮政</a><a val=\"301\">塞尔维亚邮政</a><a val=\"302\">三态速递</a><a val=\"303\">沙特邮政</a><a val=\"304\">圣安物流</a><a val=\"305\">盛丰物流</a><a val=\"306\">盛辉物流</a><a val=\"307\">斯洛伐克邮政</a><a val=\"308\">斯洛文尼亚邮政</a><a val=\"309\">穗佳物流</a><a val=\"310\">泰国邮政</a><a val=\"311\">土耳其邮政</a><a val=\"312\">万家物流</a><a val=\"313\">乌克兰邮政</a><a val=\"314\">西班牙邮政</a><a val=\"315\">信丰物流</a><a val=\"316\">匈牙利邮政</a><a val=\"317\">亚风速递</a><a val=\"318\">亚美尼亚邮政</a><a val=\"319\">燕文物流</a><a val=\"320\">意大利邮政</a><a val=\"321\">银捷速递</a><a val=\"322\">印度邮政</a><a val=\"323\">英国皇家邮政</a><a val=\"324\">邮政标准快递</a><a val=\"325\">邮政国际包裹</a><a val=\"326\">越丰物流</a><a val=\"327\">运通中港快递</a><a val=\"328\">增益速递</a><a val=\"329\">智利邮政</a><a val=\"330\">中俄快递</a><a val=\"332\">中铁快运</a><a val=\"333\">快服务快递</a><a val=\"335\">优邦国际速运</a><a val=\"336\">天际快递</a><a val=\"337\">飞洋快递</a><a val=\"338\">斑马物联网</a><a val=\"339\">易客满</a><a val=\"340\">京东大件物流</a><a val=\"341\">速必达</a>";
|
||
}
|
||
|
||
|
||
}
|