外采淘宝
This commit is contained in:
1 parent
74e59b4892
commit
60b1088e55
5 files changed
+169
-57
No files matched your search
@@ -326,24 +326,32 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
|
||||
{
|
||||
var cookie1 = request.Headers["Cookie"];
|
||||
Task.Run(() =>
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var url1 = url;
|
||||
var data1 = responseData;
|
||||
var send1 = sender;
|
||||
var cookies = new List<CefSharp.Cookie>();
|
||||
if (sender is ChromiumWebBrowser cefBrowser)
|
||||
{
|
||||
cookies = WPFCEFBrowser.GetCookieList("taobao.com", cefBrowser.GetCookieManager(null));
|
||||
}
|
||||
|
||||
//if (data1.Contains("260415-154067299863696") || data1.Contains("待用户退回商品") || data1.Contains("已寄出,待商家处理") || data1.Contains("待商家处理退货申请") || data1.Contains("待用户拒收商品"))
|
||||
//{
|
||||
//}
|
||||
//https://h5api.m.taobao.com/h5/mtop.taobao.order.queryboughtlistv2/1.0/?jsv=2.7.2&appKey=12574478&t=1791772085595&sign=c3107dae91d0e3117bc9228593f78993&v=1.0&ecode=1&timeout=8000&dataType=json&valueType=original&ttid=1%40tbwang_windows_1.0.0%23pc&needLogin=true&type=originaljson&isHttps=1&needRetry=true&api=mtop.taobao.order.queryboughtlistV2&__customTag__=boughtList_all_OrderList&preventFallback=true
|
||||
//{"api":"mtop.taobao.order.queryboughtlistv2","data":{"data":{"pcTaoBoughtList":{"tag":"pcTaoBoughtList"},"contentContainer":{"tag":"contentContainer"},"orderContainer":{"tag":"orderContainer"},"orderHeader":{"tag":"orderHeader","type":"native$tbpc_bought_list_order_header"},"shopOrderContainer_5127836437008004903":{"tag":"shopOrderContainer","id":"5127836437008004903","type":"layout$tbpc_container$0$0","fields":{"className":"trade-bought-list-order-container"}},"shopInfo_5127836437008004903":{"tag":"shopInfo","id":"5127836437008004903","type":"native$tbpc_bought_list_order_shop_info","fields":{"createDay":"2026-10-09","createTime":"2026-10-09 19:19:11","hideWangWang":false,"isInstallmentPay":"false","isNewShopImg":"true","isPurchaseUser":false,"isRelatedPay":"false","maxCheckCnt":0,"memoFlag":0,"newShopImg":"//gw.alicdn.com/imgextra/i2/O1CN01IBkgQN26Fy77Dv9zk_!!6000000007633-2-tps-80-36.png","orderDetailUrl":"//trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=5127836437008004903","orderId":"5127836437008004903","orderOperationList":[{"orderOperation":{"event":"delOrder","eventType":"delOrder","highLight":false,"name":"删除订单","status":"normal"}}],"outUrl":"https://shop445007916.taobao.com/category.htm","sellerName":"jtt_fan","shopImg":"//gtd.alicdn.com/tps/i4/TB1f.8ZFVXXXXXvaXXXEDhGGXXX-32-32.png","shopName":"JttFan的小店1313","supportBuyerFlagPopUpWindow":true,"tradeTitle":"交易关闭"},"events":{"delOrder":[{"type":"delOrderV2","fields":{"alert":{"cancelText":"取消","confirmText":"确定","msg":"删除之后可以从电脑端订单回收站恢复","title":"确认删除订单?"},"mtopConfig":{"apiMethod":"mtop.order.doOp","apiVersion":"3.0","data":{"archive":"false","code":"delOrder","orderId":"5127836437008004903"},"header":{},"isNeedWua":true,"needEcodeSign":true,"usePost":true},"toastError":"response_msg","toastSucceed":"response_msg"}}]}},"orderColContainer_5127836437008004903":{"tag":"orderColContainer","id":"5127836437008004903","type":"layout$tbpc_container$0$0","fields":{"type":"row"}},"orderDetailCol_5127836437008004903":{"tag":"orderDetailCol","id":"5127836437008004903","type":"layout$tbpc_container$0$0","fields":{"className":"trade-bought-col-order-detail"}},"orderItemGroup_5127836437008004903_1_1":{"tag":"orderItemGroup","id":"5127836437008004903_1_1"},"orderItemInfo_5127836437008004903_5127836437008004903":{"tag":"orderItemInfo","id":"5127836437008004903_5127836437008004903","type":"native$tbpc_order_item_info","fields":{"item":{"h5SnapshotUrl":"https://market.m.taobao.com/app/tp/snapshot-m/pages/index/index.html?bizOrderId=5127836437008004903","isUseH5SnapshotUrl":"true","itemId":"1086145916321","itemUrl":"https://item.taobao.com/item.htm?id=1086145916321&mi_id=0000yseHp6Dc14XqU9Z_3a3nh_esoatLyv7ANXpcothZwP4","outerUrl":"//trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=5127836437008004903","pic":"//img.alicdn.com/imgextra/i4/440631048/O1CN017oJSA71Jc1iDXhwgV_!!440631048.jpg_200x200.jpg","priceInfo":{"actualTotalFee":"¥5.00","promotion":"¥5.00"},"quantity":"1","skuInfo":[{"skuKey":"颜色分类","skuText":"颜色分类:发绳1条","skuValue":"发绳1条"}],"skuText":"发绳1条","title":"网红高弹力橡皮筋头绳女简约百搭扎可爱头发发饰发绳发圈头绳"},"orderId":"5127836437008004903","serviceinfo":{"main":[{"name":"极速退款"},{"name":"7天无理由退货"}]},"suborderop":{"values":[{"event":"subAddBagAgain","eventData":{"addBagAgain":true,"alert":false,"alertWithOpenUrl":false,"degrade2OldVersion":false,"doPay":false,"eventType":"addBagAgain","eventUtArgsCondition":true,"eventUtArgsExposureCondition":true,"eventUtArgsNotExposureCondition":false,"openAnimateWin":false,"openBatchRefundPop":false,"openRefundPop":false,"openUrl":false,"openUrlUtArgsCondition":false,"openUrlUtArgsExposureCondition":false,"openUrlUtArgsNotExposureCondition":false,"params":{"failUrl":"https://market.m.taobao.com/app/tb-source-app/order-search/pages/orderPurchase?wh_weex=true&type=0&showSubTitle=0&showBenefit=false&benefitParam=%7B%22itemInfoList%22%3A%22440631048%3A1086145916321%22%2C%22applyChannel%22%3A%22REPEAT_PURCHASE%22%7D","loadingConfig":{"message":"载入中..."},"mtopConfig":{"apiMethod":"mtop.trade.addBag","apiVersion":"3.1","data":{"cartFrom":"DEFAULT_HSF","exParams":"{\"repeatPurchaseChannel\":\"orderList\",\"mi_id\":\"00005xPspPjdIxxLxG8aD5_zjcs2a5xwCwfY3MpG6WuAG7acYGR88mDa33psjMqP_F2b\"}","itemId":"1086145916321","quantity":"1","skuId":"6139115929803"},"header":{},"isNeedWua":true,"needEcodeSign":true,"usePost":true},"reasons":[{"1":"我不想买了"}],"successUrl":"https://market.m.taobao.com/app/tb-source-app/order-search/pages/orderPurchase?wh_weex=true&type=1&showSubTitle=1&itemId=1086145916321&showBenefit=false&benefitParam=%7B%22itemInfoList%22%3A%22440631048%3A1086145916321%22%2C%22applyChannel%22%3A%22REPEAT_PURCHASE%22%7D","toastExtraParams":{}},"refreshMtop":false,"remoteUltronPop":false,"utArg1":"Page_OrderDLine truncated
|
||||
//data1.Contains("1634559696625614947")
|
||||
if (url.StartsWith("https://h5api.m.taobao.com/h5/mtop.taobao.order.queryboughtlistv"))
|
||||
{
|
||||
var cookiestr = JsonHelper.SerializeObject(cookies); // "Name":"unb","Value":"2210214614749"
|
||||
var buyer = GlobalConfig.TaobaoBuyerLoginList.FirstOrDefault(u => cookiestr.Contains(cookiestr));
|
||||
await CefReadBuyerOrder(url1, data1, buyer);
|
||||
}
|
||||
|
||||
// 读订单
|
||||
if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v"))
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
CefReadBuyerOrder(url1, data1);
|
||||
});
|
||||
}
|
||||
// if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v"))
|
||||
//{
|
||||
// await CefReadBuyerOrder(url1, data1);
|
||||
// }
|
||||
|
||||
//// 读取售后
|
||||
//if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/blade/after_sales_list"))
|
||||
@@ -565,51 +573,124 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
tb_afterSale.AfterSaleAddress = buyer_after_sale?.afterSaleAddress;
|
||||
}
|
||||
|
||||
void CefReadBuyerOrder(string url, string data)
|
||||
{
|
||||
if (data.Contains("轻奢壁挂式香皂盒置物架卫生间沥水家居可拆卸收纳盒翻盖肥皂盒"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
var buyer = GlobalConfig.TaobaoBuyerLoginList.FirstOrDefault(b => url.Contains(b.buyer_id));
|
||||
if (buyer == null)
|
||||
return;
|
||||
async Task CefReadBuyerOrder(string url, string data, BuyerLoginInfo buyer)
|
||||
{
|
||||
if (buyer == null)
|
||||
return;
|
||||
|
||||
lastCefReadOrderTime = DateTime.Now;
|
||||
|
||||
//{"server_time":1775789489,"orders":[],"extra_info":{}}
|
||||
if (data.Contains("\"orders\":[]"))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
lblMsg.Content = buyer.buyer_name + " 获取到空订单列表,退出自动滑动 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}));
|
||||
currentReadBuyer = "";
|
||||
return;
|
||||
}
|
||||
if (data.Contains("\"error_code\":40001"))
|
||||
{
|
||||
currentReadBuyer = "";
|
||||
TaobaoLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
|
||||
return;
|
||||
}
|
||||
if (data.Contains("\"orderContainer\":[]"))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
lblMsg.Content = buyer.buyer_name + " 获取到空订单列表,退出自动滑动 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}));
|
||||
currentReadBuyer = "";
|
||||
return;
|
||||
}
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
lblMsg.Content = buyer.buyer_name + " 正在获取订单列表 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}));
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
lblMsg.Content = buyer.buyer_name + " 正在获取订单列表 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}));
|
||||
|
||||
var list = JsonHelper.DeserializeJsonToList<TbBuyerOrderLiteInfo>(JsonHelper.JObjectParse(data)["orders"].ParseToString());
|
||||
var shopOrderContainerString = BaseRegex.GetOneJsonArrStrJson(ref data, "orderContainer");
|
||||
List<string> shopOrderContainerList = JsonHelper.DeserializeJsonToList<string>(shopOrderContainerString);
|
||||
shopOrderContainerList.RemoveAll(o => !o.Contains("shopOrderContainer_"));
|
||||
List<TbBuyerOrderLiteInfo> list = new List<TbBuyerOrderLiteInfo>();
|
||||
var orderIdLst = shopOrderContainerList.Select(o => o.Replace("shopOrderContainer_", "")).ToList();
|
||||
foreach (var orderId in orderIdLst)
|
||||
{
|
||||
var orderPaymentStr = BaseRegex.GetOneJsonObjStrJson(ref data, "orderPayment_" + orderId);
|
||||
var orderPayment = JsonHelper.DeserializeJsonToObject<TaobaoOrderPayment>(orderPaymentStr);
|
||||
|
||||
// 提取拼多多外采订单列表
|
||||
var orderItemInfoStr = BaseRegex.GetOneJsonObjStrJson(ref data, "orderItemInfo_" + orderId + "_" + orderId).ParseToString();
|
||||
var shopInfoStr = BaseRegex.GetOneJsonObjStrJson(ref data, "shopInfo_" + orderId);
|
||||
var orderLogistics = BaseRegex.GetOneJsonObjStrJson(ref data, "orderLogistics_" + orderId);
|
||||
|
||||
TbBuyerOrderLiteInfo o = new TbBuyerOrderLiteInfo();
|
||||
o.order_sn = "tb_" + orderId;
|
||||
o.activity_type = "0";
|
||||
o.after_sales = null;
|
||||
o.discount_amount = (orderPayment.fields.discountFee?.value) == null ? null : ((orderPayment.fields.discountFee?.value?.Replace("¥", "")).ParseToDecimal() * 100).ParseToInt();
|
||||
o.extra_info = null;
|
||||
o.order_amount = (orderPayment.fields.actualFee?.value) == null ? null : ((orderPayment.fields.actualFee?.value?.Replace("¥", "")).ParseToDecimal() * 100).ParseToInt();
|
||||
if (!string.IsNullOrEmpty(orderItemInfoStr))
|
||||
{
|
||||
o.order_Goods =
|
||||
[
|
||||
new order_good()
|
||||
{
|
||||
goods_name = BaseRegex.GetStringJson(ref orderItemInfoStr, "title"),
|
||||
cat_id_1 = 0,
|
||||
cat_id_2 = 0,
|
||||
cat_id_3 = 0,
|
||||
cat_id_4 = 0,
|
||||
event_type = 0,
|
||||
goods_id = BaseRegex.GetStringJson(ref orderItemInfoStr, "itemId"),
|
||||
goods_number = BaseRegex.GetStringJson(ref orderItemInfoStr, "quantity").ParseToInt(),
|
||||
goods_price = (BaseRegex.GetStringJson(ref orderItemInfoStr, "actualTotalFee").Replace("¥", "").ParseToDecimal() * 100).ParseToInt(),
|
||||
goods_type = 1,
|
||||
is_pre_sale = 0,
|
||||
sku_id = BaseRegex.GetStringJson(ref orderItemInfoStr, "skuId"),
|
||||
spec = BaseRegex.GetStringJson(ref orderItemInfoStr, "skuText"),
|
||||
thumb_url = BaseRegex.GetStringJson(ref orderItemInfoStr, "itemUrl"),
|
||||
},
|
||||
];
|
||||
}
|
||||
o.order_link_url = BaseRegex.GetStringJson(ref shopInfoStr, "orderDetailUrl");
|
||||
o.order_prompt_color = "#E02E24";
|
||||
o.order_status_prompt = BaseRegex.GetStringJson(ref shopInfoStr, "tradeTitle");
|
||||
o.parent_order_sn = "";
|
||||
o.service_amount = 0;
|
||||
o.shipping_amount = ((orderPayment.fields.pcPostFee?.value?.Replace("¥", "")).ParseToDecimal() * 100).ParseToInt();
|
||||
o.order_time = o.order_time;
|
||||
if (orderLogistics != null)
|
||||
{
|
||||
o.tbOutExpressCompanyMsg = BaseRegex.GetStringJson(ref orderLogistics, "cpName");
|
||||
o.tracking_number = BaseRegex.GetStringJson(ref orderLogistics, "mailNo");
|
||||
}
|
||||
|
||||
//order.TransitCreateTime = o.TransitCreateTime;
|
||||
//order.TransitPickupTime = o.TransitPickupTime;
|
||||
|
||||
//order.TransitWarehouseRawMessage = o.TransitWarehouseRawMessage;
|
||||
//order.WxOrderCreateTime = o.WxOrderCreateTime;
|
||||
//order.ShopIdStr = o.ShopIdStr;
|
||||
//order.ShopOrderIdStr = o.ShopOrderIdStr;
|
||||
//order.ShopOrderSkuIdStr = o.ShopOrderSkuIdStr;
|
||||
//order.ShopOrderSkuNameStr = o.ShopOrderSkuNameStr;
|
||||
//order.TransitBuyerOrderRefundStatus = o.TransitBuyerOrderRefundStatus;
|
||||
//order.TransitWarehouseIdStr = o.TransitWarehouseIdStr;
|
||||
//order.TransitWarehouseOrderCodeStr = o.TransitWarehouseOrderCodeStr;
|
||||
//order.Express1WaybillStr = o.Express1WaybillStr;
|
||||
//order.Express1CompanyStr = o.Express1CompanyStr;
|
||||
//order.Express2WaybillStr = o.Express2WaybillStr;
|
||||
//order.Express2CompanyStr = o.Express2CompanyStr;
|
||||
//order.TransferWareHouseStatus = o.TransferWareHouseStatus;
|
||||
//order.WxOrderVoidStatus = o.WxOrderVoidStatus;
|
||||
//order.PreAllocatedOrderNoStr = o.PreAllocatedOrderNoStr;
|
||||
//order.ShopOrderRefundStr = o.ShopOrderRefundStr; // "" 或者 "店铺售后"
|
||||
//order.OutAfterSaleStatusStr = o.OutAfterSaleStatusStr; // 店铺售后状态文本描述
|
||||
//order.wxRefundStatus = o.wxRefundStatus;
|
||||
//order.WxOrderStatus = o.WxOrderStatus;
|
||||
|
||||
//var index = lstTbBuyerOrderInfoLite.IndexOf(order);
|
||||
//Dispatcher.Invoke(new Action(() =>
|
||||
//{
|
||||
// lstTbBuyerOrderInfoLite.Remove(order);
|
||||
// lstTbBuyerOrderInfoLite.Insert(index, order);
|
||||
//}));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
//var list = JsonHelper.DeserializeJsonToList<TbBuyerOrderLiteInfo>(JsonHelper.JObjectParse(data)["orders"].ParseToString());
|
||||
|
||||
// 提取外采订单列表
|
||||
var out_order_nos = string.Join(",", list.Select(bo => bo.order_sn));
|
||||
|
||||
if (out_order_nos.Contains("260817-535832839751006"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 装载同步单
|
||||
var syncOrderList = OrderListCtrl.GetSyncLogistics(out_order_nos);
|
||||
foreach (var syncOrder in syncOrderList)
|
||||
@@ -2662,4 +2743,29 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
/// </summary>
|
||||
public bool IsAutoAfterSale = true;
|
||||
}
|
||||
|
||||
public class TaobaoOrderPayment
|
||||
{
|
||||
public string tag { get; set; } // "orderPayment",
|
||||
public string id { get; set; } // "5127806125533004903",
|
||||
public string type { get; set; } // "native$tbpc_bought_list_order_payment",
|
||||
public TaobaoOrderPaymentFields fields { get; set; }
|
||||
}
|
||||
|
||||
public class TaobaoOrderPaymentFields
|
||||
{
|
||||
public TaobaoOrderPaymentFee actualFee { get; set; } // 实付款
|
||||
public TaobaoOrderPaymentFee discountFee { get; set; } // 优惠
|
||||
public string hasBuyerMessage { get; set; } // "false",
|
||||
public bool? isMobileOrder{ get; set; } // false,
|
||||
public bool? isXCardOrder { get; set; } // false,
|
||||
public TaobaoOrderPaymentFee pcPostFee { get; set; } // 含运费
|
||||
public TaobaoOrderPaymentFee totalFee { get; set; } // 总价
|
||||
}
|
||||
|
||||
public class TaobaoOrderPaymentFee
|
||||
{
|
||||
public string prefix { get; set; } // "实付款"
|
||||
public string value { get; set; } // "¥1.43"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user