1店铺登录逻辑优化 2备货单查询显示

This commit is contained in:
wule committed 2025-07-01 18:58:51 +08:00
1 parent 89eb9ce9d4
commit 862ad088f5
216 files changed
+3481 -1543

No files matched your search

+42 -42
View File
@@ -5,8 +5,8 @@ using AllBase.Model.Param.CollectManage;
using AllBase.Model.Param.ProductManage;
using AllBase.Model.Param.ShopManage;
using AllBase.Model.Result;
using LittleRabbit.LittleRabbitForms.BaseForms;
using LittleRabbit.LittleRabbitForms.UploadForms;
using TemuKJD.KJDForms.BaseForms;
using TemuKJD.KJDForms.UploadForms;
using NaiBa.Util;
using NaiBa.Util.Extension;
using System;
@@ -21,7 +21,7 @@ using System.Threading.Tasks;
using Work;
using Work.DouyinApiClass;
namespace LittleRabbit
namespace TemuKJD
{
public class StartUp
{
@@ -67,28 +67,28 @@ namespace LittleRabbit
Thread.Sleep(100);
// 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。
GlobalConfig.DouShopLoginList = new ConcurrentList<DouShopLoginInfo>();
GlobalConfig.ShopLoginList = new ConcurrentList<DouShopLoginInfo>();
// 获取服务端店铺
var serverDouShopList = LittleRabbitForms.ShopForms.ShopListForm.GetServerDouShop();
//var localDouShopList = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<DouShopLoginInfo>>("dou_shop_login");
//if (localDouShopList == null)
// localDouShopList = new ConcurrentList<DouShopLoginInfo>();
//foreach (var serverShop in serverDouShopList)
//{
// var localShop = localDouShopList.FirstOrDefault(s => s.ShopAccountId == serverShop.ShopAccountId);
// if (localShop == null)
// {
// localDouShopList.Add(serverShop);
// }
//}
var localDouShopList = new ConcurrentList<DouShopLoginInfo>();
localDouShopList.AddRange(serverDouShopList);
var serverDouShopList = KJDForms.ShopForms.ShopListForm.GetServerDouShop();
var localDouShopList = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<DouShopLoginInfo>>("dou_shop_login");
if (localDouShopList == null)
localDouShopList = new ConcurrentList<DouShopLoginInfo>();
foreach (var serverShop in serverDouShopList)
{
var localShop = localDouShopList.FirstOrDefault(s => s.LoginName == serverShop.LoginName && s.ShopId == serverShop.ShopId);
if (localShop == null)
{
localDouShopList.Add(serverShop);
}
}
//var localDouShopList = new ConcurrentList<DouShopLoginInfo>();
//localDouShopList.AddRange(serverDouShopList);
foreach (var localShop in localDouShopList)
{
if (GlobalConfig.DouShopLoginList.Any(s => s.LoginName == localShop.LoginName && s.ShopAccountId == localShop.ShopAccountId))
if (GlobalConfig.ShopLoginList.Any(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId))
continue;
var serverShop = serverDouShopList.FirstOrDefault(s => s.LoginName == localShop.LoginName && s.ShopAccountId == localShop.ShopAccountId);
var serverShop = serverDouShopList.FirstOrDefault(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId);
if (serverShop != null)
{
localShop.ShopAccount = serverShop.ShopAccount;
@@ -107,23 +107,23 @@ namespace LittleRabbit
localShop.Group = serverShop.Group;
if (localShop.TrialUploadCount < 0)
localShop.TrialUploadCount = 0;
GlobalConfig.DouShopLoginList.Add(localShop);
GlobalConfig.ShopLoginList.Add(localShop);
}
}
GlobalConfig.DouShopLoginOtherAccountList = new ConcurrentList<DouShopLoginInfo>();
GlobalConfig.DouShopLoginOtherAccountList.AddRange(localDouShopList.Where(l => !GlobalConfig.DouShopLoginList.Any(s => s.LoginName == l.LoginName)));
GlobalConfig.DouShopLoginOtherUserShopList = new ConcurrentList<DouShopLoginInfo>();
GlobalConfig.DouShopLoginOtherUserShopList.AddRange(localDouShopList.Where(l => !GlobalConfig.ShopLoginList.Any(s => s.LoginName == l.LoginName)));
IsShopInit = true;
//while (true)
//{
// var needRefresh = GlobalConfig.DouShopLoginList.Where(s => s.LastRefreshDate != DateTime.Now.ToString("yyyyMMdd"));
// if (LittleRabbitForms.ShopForms.ShopListForm.Instance == null)
// LittleRabbitForms.ShopForms.ShopListForm.Instance = new LittleRabbitForms.ShopForms.ShopListForm();
// LittleRabbitForms.ShopForms.ShopListForm.Instance.CheckShopListLogin(needRefresh.Select(r => r.ShopAccount).ToArray(), false);
// IsShopInit = true;
while (true)
{
var needRefresh = GlobalConfig.DouShopLoginList.Where(s => s.LastRefreshDate != DateTime.Now.ToString("yyyyMMdd"));
if (LittleRabbitForms.ShopForms.ShopListForm.Instance == null)
LittleRabbitForms.ShopForms.ShopListForm.Instance = new LittleRabbitForms.ShopForms.ShopListForm();
LittleRabbitForms.ShopForms.ShopListForm.Instance.CheckShopLoginAsync(needRefresh.Select(r => r.ShopAccount).ToArray(), false);
IsShopInit = true;
Thread.Sleep(1000 * 3600 * 24); // 每天刷新下验证,如果没关闭软件的话
}
// Thread.Sleep(1000 * 3600 * 24); // 每天刷新下验证,如果没关闭软件的话
//}
}));
#endregion
@@ -162,17 +162,17 @@ namespace LittleRabbit
var tick = BaseClass.DateTimeToTimestampSeconds(new DateTime(2022, 4, 25));
while (true)
{
if (GlobalConfig.DouShopLoginList.All(shop => shop.ApiAuthStatus != "授权成功"
|| GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopAccountId && sp.IsGetSuccess)))
if (GlobalConfig.ShopLoginList.All(shop => shop.ApiAuthStatus != "授权成功"
|| GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess)))
{
Thread.Sleep(1000);
continue;
}
tList.Clear();
foreach (var shop in GlobalConfig.DouShopLoginList)
foreach (var shop in GlobalConfig.ShopLoginList)
{
if (GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopAccountId && sp.IsGetSuccess))
if (GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess))
continue;
if (shop.ApiAuthStatus != "授权成功")
@@ -183,12 +183,12 @@ namespace LittleRabbit
var shopTemp = shop;
try
{
var sameProductCheckParam = GlobalConfig.SameProductCheckParamList.FirstOrDefault(sp => sp.ShopId == shop.ShopAccountId);
var sameProductCheckParam = GlobalConfig.SameProductCheckParamList.FirstOrDefault(sp => sp.ShopId == shop.ShopId);
if (sameProductCheckParam == null)
{
sameProductCheckParam = new SameProductCheckParam()
{
ShopId = shopTemp.ShopAccountId,
ShopId = shopTemp.ShopId,
ShopName = shopTemp.ShopAccount,
ShopSamePrpductItemList = new List<ShopOurterProductItemParam>(),
};
@@ -262,7 +262,7 @@ namespace LittleRabbit
if (FileBase.Exists("temp/proxy.txt"))
{
string sAgentIpKey = FileBase.ReadAllText("temp/proxy.txt").Trim();
LittleRabbitForms.ToolForms.ProxyForm.InitProxyIp(sAgentIpKey, false);
KJDForms.ToolForms.ProxyForm.InitProxyIp(sAgentIpKey, false);
}
}
@@ -453,8 +453,8 @@ namespace LittleRabbit
public static void SaveLocalShopLoginInfo()
{
ConcurrentList<DouShopLoginInfo> shopLoginListCopy =
JsonHelper.DeserializeJsonToObject<ConcurrentList<DouShopLoginInfo>>(JsonHelper.SerializeObject(GlobalConfig.DouShopLoginList));
shopLoginListCopy.AddRange(GlobalConfig.DouShopLoginOtherAccountList);
JsonHelper.DeserializeJsonToObject<ConcurrentList<DouShopLoginInfo>>(JsonHelper.SerializeObject(GlobalConfig.ShopLoginList));
shopLoginListCopy.AddRange(GlobalConfig.DouShopLoginOtherUserShopList);
// 替换掉密码,cookie等敏感参数
foreach (var shop in shopLoginListCopy)
{