优化店铺读取
This commit is contained in:
1 parent
707efc1723
commit
7380763c1d
1 file changed
+13
-9
@@ -254,16 +254,19 @@ namespace _29WxOrderWpf
|
||||
|
||||
var tList = new ConcurrentList<Task>();
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
}));
|
||||
List<ShopLoginInfo> listTmp = new List<ShopLoginInfo>();
|
||||
//Dispatcher.Invoke(new Action(() =>
|
||||
//{
|
||||
//}));
|
||||
isReadShop = true;
|
||||
int page = 0;
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
|
||||
page++;
|
||||
var url = BaseClass.Build29WxObjString("shop/get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() + "&page=" + page;
|
||||
var data = UserLogin.GetSignaturex() + "&page=" + page + "&page_size=100";
|
||||
data += "&is_get_erp_shop_id=true";
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
@@ -295,12 +298,9 @@ namespace _29WxOrderWpf
|
||||
}
|
||||
list.Add(shop);
|
||||
|
||||
if (!GlobalConfig.ShopLoginList.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire))
|
||||
if (!listTmp.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Add(shop);
|
||||
}));
|
||||
listTmp.Add(shop);
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
@@ -352,8 +352,12 @@ namespace _29WxOrderWpf
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
GlobalConfig.ShopLoginList = new AllBase.Util.ObservableCollectionThreadSafe<ShopLoginInfo>(list);
|
||||
shopListCtrl.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
|
||||
|
||||
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => !list.Any(ss => ss.ShopId == s.ShopId)).ToList())
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Remove(shop);
|
||||
|
||||
Reference in new issue
Block a user