售后单读取
This commit is contained in:
1 parent
c76e5c9663
commit
b63dacfe7e
4 files changed
+1713
-144
No files matched your search
@@ -67,11 +67,12 @@
|
|||||||
<!-- 资源文件:SDK 样式工程默认不会把图片/图标作为 Resource,这里按原工程显式声明 -->
|
<!-- 资源文件:SDK 样式工程默认不会把图片/图标作为 Resource,这里按原工程显式声明 -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\**\*" />
|
<Resource Include="Resources\**\*" />
|
||||||
|
<None Remove="Ctrls\BuyerCtrls\Resources\pdd_afterorder.js" />
|
||||||
<None Remove="Ctrls\PDDInvoice\Resources\invoice.js" />
|
<None Remove="Ctrls\PDDInvoice\Resources\invoice.js" />
|
||||||
<None Remove="Ctrls\PDDInvoice\Resources\order.js" />
|
<None Remove="Ctrls\PDDInvoice\Resources\order.js" />
|
||||||
<Resource Include="29wx.ico" />
|
<Resource Include="29wx.ico" />
|
||||||
<Resource Include="29_common_icon.ico" />
|
<Resource Include="29_common_icon.ico" />
|
||||||
<Resource Include="Ctrls\OrderCtrls\Resources\tbAutoAddress.js" />
|
<Resource Include="Ctrls\BuyerCtrls\Resources\pdd_afterorder.js" />
|
||||||
<Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" />
|
<Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" />
|
||||||
<Resource Include="Ctrls\PDDInvoice\Resources\order.js" />
|
<Resource Include="Ctrls\PDDInvoice\Resources\order.js" />
|
||||||
<Resource Include="gear.ico" />
|
<Resource Include="gear.ico" />
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net462</TargetFramework>
|
||||||
|
<RootNamespace>_29WxOrderWpf</RootNamespace>
|
||||||
|
<AssemblyName>29WxFindOrder</AssemblyName>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ApplicationIcon>gear.ico</ApplicationIcon>
|
||||||
|
<LangVersion>12</LangVersion>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<OutputPath>..\bin\</OutputPath>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\..\KJD Cef138\Bin\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;RELEASE</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CefSharp.Common" Version="138.0.340" />
|
||||||
|
<PackageReference Include="CefSharp.Wpf" Version="138.0.340" />
|
||||||
|
<PackageReference Include="chromiumembeddedframework.runtime.win-x64" Version="138.0.34" />
|
||||||
|
<PackageReference Include="chromiumembeddedframework.runtime.win-x86" Version="138.0.34" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
|
||||||
|
<PackageReference Include="WPFCommon" Version="1.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="NaiBa.Util">
|
||||||
|
<HintPath>..\DllReference\NaiBa.Util.dll</HintPath>
|
||||||
|
<Private>true</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\AllBase\29WxOrderAllBase.csproj" />
|
||||||
|
<ProjectReference Include="..\OrderSupportTicket\OrderSupportTicket.csproj" />
|
||||||
|
<ProjectReference Include="..\Work\29WxOrderWork.csproj" />
|
||||||
|
<ProjectReference Include="..\WxOrder.Framework\WxOrder.Framework.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- 资源文件:SDK 样式工程默认不会把图片/图标作为 Resource,这里按原工程显式声明 -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\**\*" />
|
||||||
|
<None Remove="Ctrls\PDDInvoice\Resources\invoice.js" />
|
||||||
|
<None Remove="Ctrls\PDDInvoice\Resources\order.js" />
|
||||||
|
<Resource Include="29wx.ico" />
|
||||||
|
<Resource Include="29_common_icon.ico" />
|
||||||
|
<Resource Include="Ctrls\PDDInvoice\Resources\invoice.js" />
|
||||||
|
<Resource Include="Ctrls\PDDInvoice\Resources\order.js" />
|
||||||
|
<Resource Include="gear.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Ctrls\BuyerCtrls\PddBuyOrderCtrl.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\ChangePickNoView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Common\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -11,12 +11,16 @@ using AllBase.Util;
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using CefSharp.DevTools.LayerTree;
|
using CefSharp.DevTools.LayerTree;
|
||||||
using CefSharp.DevTools.Network;
|
using CefSharp.DevTools.Network;
|
||||||
|
using CefSharp.DevTools.Page;
|
||||||
using CefSharp.Handler;
|
using CefSharp.Handler;
|
||||||
using CefSharp.Wpf;
|
using CefSharp.Wpf;
|
||||||
using NaiBa.Util;
|
using NaiBa.Util;
|
||||||
using NaiBa.Util.Extension;
|
using NaiBa.Util.Extension;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NPOI.OpenXmlFormats.Dml.Chart;
|
using NPOI.OpenXmlFormats.Dml.Chart;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
using NPOI.XWPF.UserModel;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -25,6 +29,7 @@ using System.ComponentModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.Remoting.Contexts;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Security.Policy;
|
using System.Security.Policy;
|
||||||
@@ -47,6 +52,7 @@ using Work._29Tools.CefTools;
|
|||||||
using Work.BaseForms;
|
using Work.BaseForms;
|
||||||
using Work.BuyUsers;
|
using Work.BuyUsers;
|
||||||
using WxOrder.Framework.Commons;
|
using WxOrder.Framework.Commons;
|
||||||
|
using WxOrder.Framework.Helpers;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
|
||||||
|
|
||||||
namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||||
@@ -79,7 +85,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
PropertyChanged?.Invoke(this, propertyChangedEventArgs);
|
PropertyChanged?.Invoke(this, propertyChangedEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<BuyerLoginInfo, PddPickInfo> dicPddPickInfo = new Dictionary<BuyerLoginInfo, PddPickInfo>();
|
Dictionary<BuyerLoginInfo, string> dicPddAftersaleNextQueryCreatedAt = new Dictionary<BuyerLoginInfo, string>();
|
||||||
|
|
||||||
|
Dictionary <BuyerLoginInfo, PddPickInfo> dicPddPickInfo = new Dictionary<BuyerLoginInfo, PddPickInfo>();
|
||||||
ConcurrentList<yh_sync_logistics> lstSyncLogistics = new ConcurrentList<yh_sync_logistics>();
|
ConcurrentList<yh_sync_logistics> lstSyncLogistics = new ConcurrentList<yh_sync_logistics>();
|
||||||
|
|
||||||
ChromiumWebBrowser cefWebBrowser = null;
|
ChromiumWebBrowser cefWebBrowser = null;
|
||||||
@@ -251,37 +259,37 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
|
|
||||||
void AutoGetPddOrder()
|
void AutoGetPddOrder()
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(5000);
|
Thread.Sleep(5000);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (!buyerReadOrderConfig.IsAutoReadOrder)
|
if (!buyerReadOrderConfig.IsAutoReadOrder)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
btnSearch.Content = "自动刷新暂停中";
|
btnSearch.Content = "自动刷新暂停中";
|
||||||
}));
|
}));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DateTime.Now > nextGetOrderTime)
|
if (DateTime.Now > nextGetOrderTime)
|
||||||
{
|
{
|
||||||
GetOrderAndAfterSale();
|
await GetOrderAndAfterSale();
|
||||||
}
|
}
|
||||||
if (isReadBuyerOrder)
|
if (isReadBuyerOrder)
|
||||||
{
|
{
|
||||||
nextGetOrderTime = DateTime.Now.AddMinutes(25);
|
nextGetOrderTime = DateTime.Now.AddMinutes(25);
|
||||||
}
|
}
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
var ticks = nextGetOrderTime - DateTime.Now;
|
var ticks = nextGetOrderTime - DateTime.Now;
|
||||||
btnSearch.Content = "刷新订单 " + ticks.Minutes + ":" + ticks.Seconds;
|
btnSearch.Content = "刷新订单 " + ticks.Minutes + ":" + ticks.Seconds;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitCef()
|
public void InitCef()
|
||||||
@@ -460,7 +468,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (data1.Contains("listItemStatusVo") && data1.Contains("afterSalesId") && data1.Contains("statusText"))
|
if (data1.Contains("listItemStatusVo") && data1.Contains("afterSalesId") && data1.Contains("statusText"))
|
||||||
{
|
{
|
||||||
var cookie2 = cookie1.Replace(";", "&").Replace(" ", "");
|
var cookie2 = cookie1.Replace(";", "&").Replace(" ", "");
|
||||||
var jsonDatas = BaseRegex.GetJsonObjStrJson(ref data1, "listDataMap");
|
var jsonDatas = BaseRegex.GetJsonObjStrJson(ref data1, "listDataMap");
|
||||||
@@ -470,11 +478,15 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
if (!string.IsNullOrEmpty(buyerId) && !string.IsNullOrEmpty(jsonData))
|
if (!string.IsNullOrEmpty(buyerId) && !string.IsNullOrEmpty(jsonData))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var jObj = JsonHelper.JObjectParse(jsonData);
|
var jObj = JsonHelper.JObjectParse(jsonData);
|
||||||
jObj["result"] = jObj["all"];
|
jObj["result"] = jObj["all"];
|
||||||
jObj["result"]["listItemVOList"] = jObj["result"]["list"];
|
jObj["result"]["listItemVOList"] = jObj["result"]["list"];
|
||||||
CefReadBuyerAfterSale(buyerId, JsonHelper.SerializeObject(jObj));
|
|
||||||
|
var nextQueryCreatedAt = BaseRegex.GetStringJson(ref data1, "nextQueryCreatedAt");
|
||||||
|
jObj["result"]["nextQueryCreatedAt"] = nextQueryCreatedAt;
|
||||||
|
|
||||||
|
CefReadBuyerAfterSale(buyerId, JsonHelper.SerializeObject(jObj));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -484,8 +496,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 读取售后
|
// 读取售后
|
||||||
if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/blade/after_sales_list"))
|
if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/blade/after_sales_list"))
|
||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -1080,9 +1092,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
if (buyer == null)
|
if (buyer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lastCefReadOrderTime = DateTime.Now;
|
lastCefReadOrderTime = DateTime.Now;
|
||||||
|
|
||||||
if (data.Contains("\"listItemVOList\":[]") || data.Contains("\"hasNextQuery\":false"))
|
var nextQueryCreatedAt = BaseRegex.GetStringJson(ref data, "nextQueryCreatedAt");
|
||||||
|
dicPddAftersaleNextQueryCreatedAt[buyer] = nextQueryCreatedAt;
|
||||||
|
|
||||||
|
if (data.Contains("\"listItemVOList\":[]") || data.Contains("\"hasNextQuery\":false"))
|
||||||
//if (!data.Contains("/complaints_new_detail.html?after_sales_id="))
|
//if (!data.Contains("/complaints_new_detail.html?after_sales_id="))
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
@@ -1480,21 +1495,25 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSearch_Click(object sender, RoutedEventArgs e)
|
private async void btnSearch_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
GetOrderAndAfterSale();
|
await GetOrderAndAfterSale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOrderAndAfterSale()
|
async Task GetOrderAndAfterSale()
|
||||||
{
|
|
||||||
ScrollGetPddOrder();
|
|
||||||
//MakeWxToPddAfterSales();
|
|
||||||
|
|
||||||
nextGetOrderTime = DateTime.Now.AddMinutes(25);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JsGetPddOrder()
|
|
||||||
{
|
{
|
||||||
|
await JsGetPddOrder();
|
||||||
|
//ScrollGetPddOrder();
|
||||||
|
//MakeWxToPddAfterSales();
|
||||||
|
|
||||||
|
nextGetOrderTime = DateTime.Now.AddMinutes(25);
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task JsGetPddOrder()
|
||||||
|
{
|
||||||
|
if (isReadBuyerOrder)
|
||||||
|
return;
|
||||||
|
|
||||||
isReadBuyerOrder = true;
|
isReadBuyerOrder = true;
|
||||||
lstPddBuyerOrderVoidAfterSaleOrderSn.Clear();
|
lstPddBuyerOrderVoidAfterSaleOrderSn.Clear();
|
||||||
|
|
||||||
@@ -1502,7 +1521,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
cancellationTokenSource.Cancel();
|
cancellationTokenSource.Cancel();
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
Task.Run(() =>
|
await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var tokenSource = cancellationTokenSource;
|
var tokenSource = cancellationTokenSource;
|
||||||
while (isInitBuyerOrder || isInitBuyerAfterSale)
|
while (isInitBuyerOrder || isInitBuyerAfterSale)
|
||||||
@@ -1561,9 +1580,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
var t = WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), buyer.wpf_browser.GetCookieManager(null));
|
var t = WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), buyer.wpf_browser.GetCookieManager(null));
|
||||||
t.Wait();
|
t.Wait();
|
||||||
|
|
||||||
|
// 进入个人主页
|
||||||
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/personal.html");
|
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/personal.html");
|
||||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
|
||||||
|
// 获取取件码
|
||||||
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/psnl_goods_help.html?_t_module_name=assistant_search&refer_scene=no_pickup_package_express&refer_page_name=goods_express");
|
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/psnl_goods_help.html?_t_module_name=assistant_search&refer_scene=no_pickup_package_express&refer_page_name=goods_express");
|
||||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
|
||||||
@@ -1574,76 +1595,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
#region 售后
|
#region 售后
|
||||||
if (1 == 1)
|
if (1 == 1)
|
||||||
{
|
{
|
||||||
readBuyer = buyer.buyer_id;
|
await JsGetPddAftersaleOrder(buyer, tokenSource);
|
||||||
currentReadBuyer = buyer.buyer_id;
|
|
||||||
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/complaint_list.html?refer_page_name=personal&refer_page_sn=10001&tab=all");
|
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
|
||||||
if (buyer.IsSelect != true)
|
|
||||||
{
|
|
||||||
foreach (var b in GlobalConfig.PDDBuyerLoginList)
|
|
||||||
{
|
|
||||||
b.IsSelect = false;
|
|
||||||
}
|
|
||||||
buyer.IsSelect = true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() => { MainWindow.Instance.Title = buyer.buyer_nick + " 售后读取中"; }));
|
|
||||||
BindBuyerOrderReadInfo(buyer, "正在读取售后");
|
|
||||||
|
|
||||||
top = 0;
|
|
||||||
times = 0;
|
|
||||||
lastCefReadOrderTime = DateTime.Now;
|
|
||||||
while (currentReadBuyer == readBuyer)
|
|
||||||
{
|
|
||||||
if (isSkipNext)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (tokenSource.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
BindBuyerOrderReadInfo(buyer, "已取消读取");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30))
|
|
||||||
{
|
|
||||||
PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
|
|
||||||
if (buyer.status != "在线")
|
|
||||||
{
|
|
||||||
BindBuyerOrderReadInfo(buyer, "店铺掉线");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
BindBuyerOrderReadInfo(buyer, "停滞时间超过30秒,跳过");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
top += Randomx.GetId(450, 600);
|
|
||||||
Thread.Sleep(Randomx.GetId(100, 300));
|
|
||||||
|
|
||||||
var jsStr = @"window.scroll({
|
|
||||||
top: document.body.scrollHeight,
|
|
||||||
left: 0,
|
|
||||||
behavior: 'smooth' // 可选,使滚动平滑
|
|
||||||
});";
|
|
||||||
jsStr = @"window.scroll({
|
|
||||||
top: " + top + @",
|
|
||||||
left: 0,
|
|
||||||
behavior: 'smooth' // 可选,使滚动平滑
|
|
||||||
});";
|
|
||||||
//var t1 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr);
|
|
||||||
//t1.Wait(1000);
|
|
||||||
var client = buyer.wpf_browser.GetDevToolsClient();
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
|
||||||
result.Wait(5000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tokenSource.IsCancellationRequested)
|
if (tokenSource.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
BindBuyerOrderReadInfo(buyer, "已取消读取");
|
BindBuyerOrderReadInfo(buyer, "已取消读取");
|
||||||
@@ -1653,11 +1605,13 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// 待发货
|
#region 待发货
|
||||||
readBuyer = buyer.buyer_id;
|
readBuyer = buyer.buyer_id;
|
||||||
currentReadBuyer = buyer.buyer_id;
|
currentReadBuyer = buyer.buyer_id;
|
||||||
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/orders.html?type=2");
|
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/orders.html?type=2");
|
||||||
|
|
||||||
|
BindBuyerOrderReadInfo(buyer, "正在读取待发货");
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
||||||
@@ -1670,12 +1624,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
buyer.IsSelect = true;
|
buyer.IsSelect = true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() => { MainWindow.Instance.Title = buyer.buyer_nick + " 待发货读取中"; }));
|
|
||||||
BindBuyerOrderReadInfo(buyer, "正在读取待发货");
|
|
||||||
|
|
||||||
top = 0;
|
top = 0;
|
||||||
lastCefReadOrderTime = DateTime.Now;
|
lastCefReadOrderTime = DateTime.Now;
|
||||||
while (currentReadBuyer == readBuyer)
|
while (currentReadBuyer == readBuyer)
|
||||||
@@ -1713,11 +1663,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
Thread.Sleep(Randomx.GetId(100, 300));
|
Thread.Sleep(Randomx.GetId(100, 300));
|
||||||
|
|
||||||
var jsStr = @"window.scroll({
|
var jsStr = @"window.scroll({
|
||||||
top: document.body.scrollHeight,
|
|
||||||
left: 0,
|
|
||||||
behavior: 'smooth' // 可选,使滚动平滑
|
|
||||||
});";
|
|
||||||
jsStr = @"window.scroll({
|
|
||||||
top: " + top + @",
|
top: " + top + @",
|
||||||
left: 0,
|
left: 0,
|
||||||
behavior: 'smooth' // 可选,使滚动平滑
|
behavior: 'smooth' // 可选,使滚动平滑
|
||||||
@@ -1742,15 +1687,15 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
#endregion
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() => { MainWindow.Instance.Title = buyer.buyer_nick + " 已发货读取中"; }));
|
#region 已发货
|
||||||
BindBuyerOrderReadInfo(buyer, "正在读取已发货");
|
|
||||||
|
|
||||||
// 已发货
|
|
||||||
readBuyer = buyer.buyer_id;
|
readBuyer = buyer.buyer_id;
|
||||||
currentReadBuyer = buyer.buyer_id;
|
currentReadBuyer = buyer.buyer_id;
|
||||||
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/orders.html?type=3");
|
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/orders.html?type=3");
|
||||||
|
|
||||||
|
BindBuyerOrderReadInfo(buyer, "正在读取已发货");
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
||||||
@@ -1763,7 +1708,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
buyer.IsSelect = true;
|
buyer.IsSelect = true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
|
||||||
top = 0;
|
top = 0;
|
||||||
@@ -1795,11 +1739,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
Thread.Sleep(Randomx.GetId(100, 300));
|
Thread.Sleep(Randomx.GetId(100, 300));
|
||||||
|
|
||||||
var jsStr = @"window.scroll({
|
var jsStr = @"window.scroll({
|
||||||
top: document.body.scrollHeight,
|
|
||||||
left: 0,
|
|
||||||
behavior: 'smooth' // 可选,使滚动平滑
|
|
||||||
});";
|
|
||||||
jsStr = @"window.scroll({
|
|
||||||
top: " + top + @",
|
top: " + top + @",
|
||||||
left: 0,
|
left: 0,
|
||||||
behavior: 'smooth' // 可选,使滚动平滑
|
behavior: 'smooth' // 可选,使滚动平滑
|
||||||
@@ -1823,6 +1762,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
BindBuyerOrderReadInfo(buyer, "已取消读取");
|
BindBuyerOrderReadInfo(buyer, "已取消读取");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -1832,15 +1773,116 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Thread.Sleep(Randomx.GetId(6000, 8000));
|
Thread.Sleep(Randomx.GetId(3000, 5000));
|
||||||
}
|
}
|
||||||
isReadBuyerOrder = false;
|
isReadBuyerOrder = false;
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() => { MainWindow.Instance.Title = "订单读取已结束,等待下次读取"; }));
|
|
||||||
BindBuyerOrderReadInfo(null, "订单读取已结束,等待下次读取");
|
BindBuyerOrderReadInfo(null, "订单读取已结束,等待下次读取");
|
||||||
}, cancellationTokenSource.Token);
|
}, cancellationTokenSource.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<bool> IsAftersaleJsInstalledAsync(IFrame frame, int timeoutMs = 3000)
|
||||||
|
{
|
||||||
|
var deadline = DateTime.Now.AddMilliseconds(timeoutMs);
|
||||||
|
while (DateTime.Now < deadline)
|
||||||
|
{
|
||||||
|
var r = await frame.EvaluateScriptAsync("!!(window.PDAfterSale && window.PDAfterSale.__installed)")
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
if (r != null && r.Success && r.Result is bool && (bool)r.Result) return true;
|
||||||
|
await Task.Delay(100).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task JsGetPddAftersaleOrder(BuyerLoginInfo buyer, CancellationTokenSource tokenSource)
|
||||||
|
{
|
||||||
|
var readBuyer = buyer.buyer_id;
|
||||||
|
currentReadBuyer = buyer.buyer_id;
|
||||||
|
buyer.wpf_browser.Load("https://mobile.yangkeduo.com/complaint_list.html?refer_page_name=personal&refer_page_sn=10001&tab=all");
|
||||||
|
|
||||||
|
BindBuyerOrderReadInfo(buyer, "正在读取售后");
|
||||||
|
|
||||||
|
Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
||||||
|
if (buyer.IsSelect != true)
|
||||||
|
{
|
||||||
|
foreach (var b in GlobalConfig.PDDBuyerLoginList.ToList())
|
||||||
|
{
|
||||||
|
b.IsSelect = false;
|
||||||
|
}
|
||||||
|
buyer.IsSelect = true;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||||
|
|
||||||
|
var client = buyer.wpf_browser.GetDevToolsClient();
|
||||||
|
if (client == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 注入触发翻滚的js事件
|
||||||
|
string address = "";
|
||||||
|
Dispatcher.Invoke(() => { address = buyer.wpf_browser.Address; });
|
||||||
|
if (address.StartsWith("https://mobile.yangkeduo.com/complaint_list.html"))
|
||||||
|
{
|
||||||
|
string content = ResourceHelper.GetResourceText("/Ctrls/BuyerCtrls/Resources/pdd_afterorder.js", "29WxFindOrder");
|
||||||
|
if (string.IsNullOrEmpty(content))
|
||||||
|
return;
|
||||||
|
await client.Runtime.EvaluateAsync(content, null, true, null, null, true, null, true);
|
||||||
|
|
||||||
|
var frame = cefWebBrowser.GetMainFrame();
|
||||||
|
if (await IsAftersaleJsInstalledAsync(frame) != true)
|
||||||
|
{
|
||||||
|
BindBuyerOrderReadInfo(buyer, "售后单读取预加载失败!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastCefReadOrderTime = DateTime.Now;
|
||||||
|
string tempNextQueryCreatedAt = "";
|
||||||
|
while (currentReadBuyer == readBuyer)
|
||||||
|
{
|
||||||
|
if (isSkipNext)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (tokenSource.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
BindBuyerOrderReadInfo(buyer, "已取消读取");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30))
|
||||||
|
{
|
||||||
|
PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
|
||||||
|
if (buyer.status != "在线")
|
||||||
|
{
|
||||||
|
BindBuyerOrderReadInfo(buyer, "店铺掉线");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BindBuyerOrderReadInfo(buyer, "停滞时间超过30秒,跳过");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dicPddAftersaleNextQueryCreatedAt.ContainsKey(buyer))
|
||||||
|
dicPddAftersaleNextQueryCreatedAt[buyer] = "";
|
||||||
|
if (dicPddAftersaleNextQueryCreatedAt[buyer] == tempNextQueryCreatedAt)
|
||||||
|
{
|
||||||
|
await Task.Delay(500);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
tempNextQueryCreatedAt = dicPddAftersaleNextQueryCreatedAt[buyer];
|
||||||
|
|
||||||
|
//1789123589
|
||||||
|
//string jsStr = $"PDDOrders.trigger({{offset:'MO-01-{lastOrderSN}',type:0,size:10,mode:'store'}})";
|
||||||
|
string jsStr = "PDAfterSale.trigger({cursor:'" + dicPddAftersaleNextQueryCreatedAt[buyer] + "',tab:'all'})";
|
||||||
|
await client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||||
|
await Task.Delay(Randomx.GetId(1000, 3000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollGetPddOrder()
|
void ScrollGetPddOrder()
|
||||||
{
|
{
|
||||||
isReadBuyerOrder = true;
|
isReadBuyerOrder = true;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user