拍单功能继续优化
This commit is contained in:
1 parent
29042424dc
commit
34c51c6fcd
64 files changed
+7138
-305
No files matched your search
+188
-55
@@ -6,6 +6,7 @@ using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model;
|
||||
using AllBase.Model.Result;
|
||||
using CefSharp;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -71,7 +72,51 @@ namespace _29WxOrderWpf
|
||||
{
|
||||
GetServerShop();
|
||||
});
|
||||
Task.Run(() =>
|
||||
{
|
||||
GetPddBuyer();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//CefSharp.Wpf.ChromiumWebBrowser browser = new CefSharp.Wpf.ChromiumWebBrowser();
|
||||
//browser.Address = "https://www.baidu.com";
|
||||
//Grid.SetRow(browser, 1);
|
||||
//this.mainGrid.Children.Add(browser);
|
||||
//Task. Run(() => {
|
||||
|
||||
// Thread.Sleep(2000);
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
// browser.Visibility = Visibility.Hidden;
|
||||
// }));
|
||||
// Thread.Sleep(1000);
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
|
||||
// browser.Address = "https://www.sina.com.cn";
|
||||
|
||||
|
||||
// }));
|
||||
// Thread.Sleep(3000);
|
||||
// var jsStr = @"window.scrollTo(0, document.body.scrollHeight);";
|
||||
// var client = browser.GetDevToolsClient();
|
||||
// if (client != null)
|
||||
// {
|
||||
// var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||
// //result.Wait(5000);
|
||||
// //string resultStr = result.Result.Result.Value.ParseToString();
|
||||
// ////if (resultStr.ParseToInt() > 0)
|
||||
// //{
|
||||
// // CEFBrowser.DeleteCookie(browser.GetCookieManager(null));
|
||||
// // //return;
|
||||
// //}
|
||||
// }
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
// }));
|
||||
// Thread.Sleep(3000);
|
||||
// Dispatcher.Invoke(new Action(() => {
|
||||
// browser.Visibility = Visibility.Visible;
|
||||
// }));
|
||||
//});
|
||||
}
|
||||
|
||||
#region 反抓包功能
|
||||
@@ -194,72 +239,160 @@ namespace _29WxOrderWpf
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
public bool readShop { get; set; } = false;
|
||||
#region 读取微信店铺
|
||||
public bool isReadShop { get; set; } = false;
|
||||
public bool hasReadShop { get; set; } = false;
|
||||
public void GetServerShop()
|
||||
{
|
||||
if (readShop == false)
|
||||
if (isReadShop)
|
||||
return;
|
||||
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
}));
|
||||
isReadShop = true;
|
||||
int page = 0;
|
||||
while (true)
|
||||
{
|
||||
page++;
|
||||
var url = BaseClass.Build29WxObjString("shop/get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() + "&page=" + page;
|
||||
data += "&is_get_erp_shop_id=true";
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html)
|
||||
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
|
||||
{
|
||||
}));
|
||||
readShop = true;
|
||||
int page = 0;
|
||||
while (true)
|
||||
{
|
||||
page++;
|
||||
var url = BaseClass.Build29WxObjString("shop/get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() + "&page=" + page;
|
||||
data += "&is_get_erp_shop_id=true";
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html)
|
||||
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
break;
|
||||
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
var shop = ShopBLL.DeserializationShop(jObj);
|
||||
|
||||
var shopExist = list.Where(l => l.ShopId == shop.ShopId).ToList();
|
||||
if (shopExist != null)
|
||||
shopExist.Remove(shop);
|
||||
|
||||
list.Add(shop);
|
||||
if (!GlobalConfig.ShopLoginList.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Add(shop);
|
||||
}));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
break;
|
||||
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => !list.Any(ss => ss.ShopId == s.ShopId)).ToList())
|
||||
var shop = ShopBLL.DeserializationShop(jObj);
|
||||
|
||||
var shopExist = list.Where(l => l.ShopId == shop.ShopId).ToList();
|
||||
if (shopExist != null)
|
||||
shopExist.Remove(shop);
|
||||
|
||||
list.Add(shop);
|
||||
if (!GlobalConfig.ShopLoginList.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire))
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Remove(shop);
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Add(shop);
|
||||
}));
|
||||
}
|
||||
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => s.is_point_shop_expire).ToList())
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Remove(shop);
|
||||
}
|
||||
}));
|
||||
readShop = false;
|
||||
hasReadShop = true;
|
||||
}
|
||||
}
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => !list.Any(ss => ss.ShopId == s.ShopId)).ToList())
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Remove(shop);
|
||||
}
|
||||
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => s.is_point_shop_expire).ToList())
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Remove(shop);
|
||||
}
|
||||
}));
|
||||
isReadShop = false;
|
||||
hasReadShop = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 读取拼多多买手号
|
||||
public bool isGetPddBuyer = false;
|
||||
public bool hasGetPddBuyer = false;
|
||||
/// <summary>
|
||||
/// 读取拼多多买手
|
||||
/// </summary>
|
||||
public void GetPddBuyer()
|
||||
{
|
||||
if (isGetPddBuyer)
|
||||
return;
|
||||
|
||||
isGetPddBuyer = true;
|
||||
//var ids = dgvBuyer.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).Select(s => s.Cells["colBuyerId"].Value.ParseToString()).ToList();
|
||||
//Invoke(new Action(() => { pbLoading.Visible = true; }));
|
||||
|
||||
try
|
||||
{
|
||||
var url = BaseClass.Build29PDDObjString("user/get_buyer");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&page_size=200";
|
||||
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
|
||||
result = GetHtml.PostUtf8(url, data);
|
||||
|
||||
if (result.Contains("\"code\":200"))
|
||||
{
|
||||
List<BuyerLoginInfo> loginInfoLst = JsonHelper.DeserializeJsonToList<BuyerLoginInfo>(JsonHelper.JObjectParse(result)["data"].ParseToString());
|
||||
|
||||
foreach (var buyer in GlobalConfig.PDDBuyerLoginList.Where(bu => !loginInfoLst.Any(b => b.buyer_id == bu.buyer_id)).ToList())
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() => { GlobalConfig.PDDBuyerLoginList.Remove(buyer); }));
|
||||
}
|
||||
|
||||
foreach (var b in loginInfoLst)
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(bu => bu.buyer_id == b.buyer_id);
|
||||
if (buyer == null)
|
||||
GlobalConfig.PDDBuyerLoginList.Add(b);
|
||||
else
|
||||
{
|
||||
buyer.add_time = b.add_time;
|
||||
buyer.buyer_id = b.buyer_id;
|
||||
buyer.buyer_name = b.buyer_name;
|
||||
buyer.buyer_nick = b.buyer_nick;
|
||||
buyer.cookie = b.cookie;
|
||||
buyer.mdy_time = b.mdy_time;
|
||||
buyer.notes = b.notes;
|
||||
buyer.status = b.status;
|
||||
buyer.user_name = b.user_name;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
//dgvBuyer.Rows.Clear();
|
||||
//cmbBuyer.Items.Clear();
|
||||
//}));
|
||||
|
||||
foreach (var buyer in GlobalConfig.PDDBuyerLoginList)
|
||||
{
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
//BindBuyer(buyer, "", ids);
|
||||
//cmbBuyer.Items.Add(buyer.buyer_nick);
|
||||
//}));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
// pbLoading.Visible = false;
|
||||
//}));
|
||||
|
||||
isGetPddBuyer = false;
|
||||
hasGetPddBuyer = true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user