第三方库存上传功能
This commit is contained in:
1 parent
0740da277c
commit
7e71b08863
29 files changed
+5391
-178
No files matched your search
+9
-6
@@ -37,7 +37,8 @@
|
||||
System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("超级用户管理");
|
||||
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("选品数据库");
|
||||
System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("认领待上传");
|
||||
System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
|
||||
System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("库存上传");
|
||||
System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1,
|
||||
treeNode2,
|
||||
treeNode3,
|
||||
@@ -46,7 +47,8 @@
|
||||
treeNode6,
|
||||
treeNode7,
|
||||
treeNode8,
|
||||
treeNode9});
|
||||
treeNode9,
|
||||
treeNode10});
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -155,10 +157,12 @@
|
||||
treeNode8.Text = "选品数据库";
|
||||
treeNode9.Name = "认领待上传";
|
||||
treeNode9.Text = "认领待上传";
|
||||
treeNode10.Name = "店铺管理";
|
||||
treeNode10.Text = "店铺管理";
|
||||
treeNode10.Name = "库存上传";
|
||||
treeNode10.Text = "库存上传";
|
||||
treeNode11.Name = "店铺管理";
|
||||
treeNode11.Text = "店铺管理";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode10});
|
||||
treeNode11});
|
||||
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
|
||||
this.tv.Size = new System.Drawing.Size(140, 461);
|
||||
this.tv.TabIndex = 1;
|
||||
@@ -166,7 +170,6 @@
|
||||
//
|
||||
// ShopForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(933, 461);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Windows.Forms;
|
||||
using TemuKJD.KJDForms.AdminForms;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using TemuKJD.KJDForms.ProductSelectForms;
|
||||
using TemuKJD.KJDForms.ProductThirdSelectForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.ShopForms
|
||||
{
|
||||
@@ -26,6 +27,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
public Lazy<AdminShopForm> adminShopForm = new Lazy<AdminShopForm>();
|
||||
public Lazy<DbProductListForm> dbProductListForm = new Lazy<DbProductListForm>();
|
||||
public Lazy<DbProductSelectListManageForm> dbProductSelectListManageForm = new Lazy<DbProductSelectListManageForm>();
|
||||
public Lazy<ProductThirdSelectListManageForm> productThirdSelectListManageForm = new Lazy<ProductThirdSelectListManageForm>();
|
||||
|
||||
public ShopForm()
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
tv.SelectedNode = tv.Nodes[0].Nodes[0];
|
||||
tv.ExpandGroup(tv.Nodes[0].Name);
|
||||
|
||||
List<string> hideName = new List<string>() { "用户管理", "高级运费模板", "运费模板", "素材库管理", "超级用户管理", "超级店铺管理", "选品数据库", "认领待上传" };
|
||||
List<string> hideName = new List<string>() { "用户管理", "高级运费模板", "运费模板", "素材库管理", "超级用户管理", "超级店铺管理", "选品数据库", "认领待上传", "库存上传" };
|
||||
|
||||
if (BaseClass.GroupId == 3)
|
||||
{
|
||||
@@ -48,11 +50,13 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
hideName.Remove("超级店铺管理");
|
||||
hideName.Remove("选品数据库");
|
||||
hideName.Remove("认领待上传");
|
||||
hideName.Remove("库存上传");
|
||||
}
|
||||
if (BaseClass.SaLevel==2)
|
||||
{
|
||||
hideName.Remove("超级店铺管理");
|
||||
hideName.Remove("认领待上传");
|
||||
hideName.Remove("库存上传");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +110,9 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
case "认领待上传":
|
||||
SetForm(dbProductSelectListManageForm.Value);
|
||||
break;
|
||||
case "库存上传":
|
||||
SetForm(productThirdSelectListManageForm.Value);
|
||||
break;
|
||||
}
|
||||
}));
|
||||
}).Start();
|
||||
|
||||
@@ -89,26 +89,26 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
// 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。
|
||||
GlobalConfig.ShopLoginList = new ConcurrentList<ShopLoginInfo>();
|
||||
// 获取服务端店铺
|
||||
var serverDouShopList = KJDForms.ShopForms.ShopListForm.GetServerShop();
|
||||
var localDouShopList = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<ShopLoginInfo>>("dou_shop_login");
|
||||
if (localDouShopList == null)
|
||||
localDouShopList = new ConcurrentList<ShopLoginInfo>();
|
||||
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)
|
||||
var serverShopList = ShopListForm.GetServerShop();
|
||||
//var localShopList = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<ShopLoginInfo>>("dou_shop_login");
|
||||
//if (localShopList == null)
|
||||
// localShopList = new ConcurrentList<ShopLoginInfo>();
|
||||
//foreach (var serverShop in serverShopList)
|
||||
//{
|
||||
// var localShop = localShopList.FirstOrDefault(s => s.LoginName == serverShop.LoginName && s.ShopId == serverShop.ShopId);
|
||||
// if (localShop == null)
|
||||
// {
|
||||
// localShopList.Add(serverShop);
|
||||
// }
|
||||
//}
|
||||
var localShopList = new ConcurrentList<ShopLoginInfo>();
|
||||
localShopList.AddRange(serverShopList);
|
||||
foreach (var localShop in localShopList)
|
||||
{
|
||||
if (GlobalConfig.ShopLoginList.Any(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId))
|
||||
continue;
|
||||
|
||||
var serverShop = serverDouShopList.FirstOrDefault(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId);
|
||||
var serverShop = serverShopList.FirstOrDefault(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId);
|
||||
if (serverShop != null)
|
||||
{
|
||||
localShop.ShopAccount = serverShop.ShopAccount;
|
||||
@@ -137,7 +137,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
}
|
||||
}
|
||||
GlobalConfig.DouShopLoginOtherUserShopList = new ConcurrentList<ShopLoginInfo>();
|
||||
GlobalConfig.DouShopLoginOtherUserShopList.AddRange(localDouShopList.Where(l => !GlobalConfig.ShopLoginList.Any(s => s.LoginName == l.LoginName)));
|
||||
GlobalConfig.DouShopLoginOtherUserShopList.AddRange(localShopList.Where(l => !GlobalConfig.ShopLoginList.Any(s => s.LoginName == l.LoginName)));
|
||||
}
|
||||
|
||||
public static List<ShopLoginInfo> GetServerShop()
|
||||
@@ -381,17 +381,14 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Add(shopInfo);
|
||||
StartUp.SaveLocalShopLoginInfo();
|
||||
ShopListForm.AddServerDouShop(shopInfo);
|
||||
RefreshDataGridView(false);
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StartUp.SaveLocalShopLoginInfo();
|
||||
ShopListForm.MdyServerDouShop(shopInfo);
|
||||
RefreshDataGridView(false);
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,7 +398,6 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
Task.Run(() =>
|
||||
{
|
||||
//CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName });
|
||||
RefreshDataGridView(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -411,7 +407,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
{
|
||||
//CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName });
|
||||
StartUp.SaveLocalShopLoginInfo();
|
||||
RefreshDataGridView(false);
|
||||
btnRefreshCookie_Click(null, null);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -419,7 +415,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
{
|
||||
IsOperate = true;
|
||||
ImportShop();
|
||||
RefreshDataGridView();
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
|
||||
void ImportShop()
|
||||
@@ -906,6 +902,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
IsOperate = false;
|
||||
break;
|
||||
@@ -1057,6 +1054,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
shopLoginForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
ShopListForm.IsOperate = false;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.Web.Hosting;
|
||||
using System.Windows.Forms;
|
||||
using Work;
|
||||
using Work.BLL.Tools;
|
||||
using TemuKJD.KJDForms.AdminForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.ShopForms
|
||||
{
|
||||
@@ -46,6 +47,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
private ShopLoginInfo shop = null;
|
||||
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
|
||||
private string currentUrl = "";
|
||||
private long currentSupplierId = 0;
|
||||
|
||||
public ShopLoginForm(ShopLoginInfo shopInfo)
|
||||
{
|
||||
@@ -279,6 +281,18 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
cefWebBrowser.LoadError += CefWebBrowser_LoadError;
|
||||
cefWebBrowser.Dock = DockStyle.Fill;
|
||||
|
||||
//js绑定C#对象
|
||||
ShopBrowserObject shopObj = new ShopBrowserObject();
|
||||
shopObj.OnInfoReceived += ShopObj_OnInfoReceived;
|
||||
CefSharpSettings.WcfEnabled = true;
|
||||
cefWebBrowser.JavascriptObjectRepository.Register(
|
||||
name: "shopObj",
|
||||
objectToBind: shopObj,
|
||||
isAsync: false,
|
||||
options: new BindingOptions { Binder = BindingOptions.DefaultBinder.Binder /*CamelCaseJavascriptNames = false*/ /*cef79*/ }
|
||||
);
|
||||
|
||||
|
||||
if (shop.Cookies == null)
|
||||
shop.Cookies = "";
|
||||
|
||||
@@ -340,6 +354,12 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
});
|
||||
}
|
||||
}
|
||||
private void ShopObj_OnInfoReceived(string information)
|
||||
{
|
||||
//BaseMsgForm.ShowInfo(information);
|
||||
if (!string.IsNullOrEmpty(information))
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("alert('" + information + "');");
|
||||
}
|
||||
|
||||
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
|
||||
{
|
||||
@@ -371,10 +391,31 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
//
|
||||
// });
|
||||
//}
|
||||
|
||||
//js绑定C#对象 html页面内声明绑定的C#对象
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("(function(){");
|
||||
sb.Append("CefSharp.BindObjectAsync('shopObj');");
|
||||
sb.Append("})();");
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
|
||||
}
|
||||
|
||||
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var data = responseData;
|
||||
if (data.Contains("supplierId") && data.Contains("\"success\":true"))
|
||||
{
|
||||
var supplierIds = BaseRegex.GetMatchRegex(ref data, "\"supplierId\":\\d{5,20}");
|
||||
if (supplierIds.Count > 0 && supplierIds[0].Groups.Count > 0)
|
||||
{
|
||||
var supplierId = supplierIds[0].Groups[0].Value.Replace("\"supplierId\":", "").ParseToLong();
|
||||
if (supplierId > 0)
|
||||
this.currentSupplierId = supplierId;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (url.StartsWith("https://seller.kuajingmaihuo.com/settle/site-main"))
|
||||
{
|
||||
cefWebBrowser.Load(shopMainUrl);
|
||||
@@ -434,6 +475,44 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
// 库存上传按钮
|
||||
if (currentUrl.StartsWith("https://seller.kuajingmaihuo.com/goods/product/list"))
|
||||
{
|
||||
Task.Run(() => {
|
||||
string sAddInputJs = @"
|
||||
document.addEventListener('wheel', function(event) {
|
||||
// 检查滚动方向
|
||||
//if (event.deltaY < 0) {
|
||||
// console.log('向上滚动');
|
||||
//} else {
|
||||
// console.log('向下滚动');
|
||||
//}
|
||||
// 或者使用 event.deltaX 来检查水平滚动
|
||||
//if (event.deltaX < 0) {
|
||||
// console.log('向左滚动');
|
||||
//} else if (event.deltaX > 0) {
|
||||
// console.log('向右滚动');
|
||||
//}
|
||||
|
||||
// 阻止默认的滚动行为(如果有需要)
|
||||
//event.preventDefault();
|
||||
|
||||
addGetProdButton();
|
||||
});
|
||||
addGetProdButton();
|
||||
|
||||
function addGetProdButton() {
|
||||
var productLst = document.getElementsByClassName('product-info_idContent__iDukx');
|
||||
for(i=0; i<productLst.length; i++) {
|
||||
if (productLst[i].innerHTML.indexOf('库存上传') < 0 && productLst[i].innerHTML.indexOf('SPU ID') >= 0) {
|
||||
var sSpuId = productLst[i].innerText.replace('\r','').replace('\n','').replace('SPU ID:', '');
|
||||
productLst[i].innerHTML = productLst[i].innerHTML.replace(""></div>"", ""><input type=\""button\"" style=\""margin-left: 50px; width:60px; text-align:center\"" value=\""库存上传\"" onclick=\""shopObj.getThirdProduct('"" + sSpuId + ""'," + this.currentSupplierId + @")\""></div>"");
|
||||
}
|
||||
}
|
||||
}";
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sAddInputJs);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,17 +13,26 @@ using System.Windows.Forms;
|
||||
using AllBase;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Work;
|
||||
using TemuKJD.KJDForms.AdminForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.ShopForms
|
||||
{
|
||||
public enum SetCookieFromEnum
|
||||
{
|
||||
normal_user,
|
||||
sa,
|
||||
}
|
||||
public partial class ShopUpdateCookieForm : LRBaseForm
|
||||
{
|
||||
ShopLoginInfo shopLoginInfo = null;
|
||||
SetCookieFromEnum updateFrom;
|
||||
|
||||
public ShopUpdateCookieForm(ShopLoginInfo shop = null)
|
||||
public ShopUpdateCookieForm(ShopLoginInfo shop = null, SetCookieFromEnum from = SetCookieFromEnum.normal_user)
|
||||
{
|
||||
InitializeComponent();
|
||||
shopLoginInfo = shop;
|
||||
updateFrom = from;
|
||||
}
|
||||
|
||||
private void ShopUpdateCookieForm_Load(object sender, EventArgs e)
|
||||
@@ -32,32 +41,32 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
txtLoginName.Text = shopLoginInfo.LoginName + " " + shopLoginInfo.ShopAccount + " " + shopLoginInfo.Notes;
|
||||
}
|
||||
|
||||
/*
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
var cookieDate = new Date(2037, 01, 01);
|
||||
var cookieDateEnd = new Date(2000, 01, 01);
|
||||
document.cookie = "SUB_PASS_ID=; path='/'; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_nano_fp=; path='/'; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "api_uid=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_bee=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "ru2k=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_f77=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_a42=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "rckk=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "ru1k=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "api_uid=CmP1wGhwa64RUwBSBILCAg==; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_nano_fp=XpmyX5gbl09jlpdoXo_mijphq7nL0UmRaA77jyt3; domain=.kuajingmaihuo.com; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_bee=NkjhfozSFfDuGSJ2zBlOqjOh3KVvJam3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_f77=2f854ce8-8d0f-4a78-84a1-04e19842a1cb; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_a42=1e97ae4a-c357-4c22-a53f-db43655371e3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "rckk=NkjhfozSFfDuGSJ2zBlOqjOh3KVvJam3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "ru1k=2f854ce8-8d0f-4a78-84a1-04e19842a1cb; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "ru2k=1e97ae4a-c357-4c22-a53f-db43655371e3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "SUB_PASS_ID=eyJ0IjoiRDZZY1F2N2JjMnZNK1E0eEZjTm1GVmxsN20yN3N3Ymg2dnVjdmxiclZPQW5uRkJlendUOUtKTHRoWHJyZWlNUCIsInYiOjEsInMiOjEwMDAwLCJ1IjoyMzAxMjcwOTkwNDI5OH0=; domain=.kuajingmaihuo.com; path='/'; expires=" + cookieDate.toUTCString();
|
||||
location.reload();
|
||||
window.location.href = 'https://seller.kuajingmaihuo.com/goods/product/list';
|
||||
*/
|
||||
/*
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
var cookieDate = new Date(2037, 01, 01);
|
||||
var cookieDateEnd = new Date(2000, 01, 01);
|
||||
document.cookie = "SUB_PASS_ID=; path='/'; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_nano_fp=; path='/'; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "api_uid=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_bee=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "ru2k=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_f77=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "_a42=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "rckk=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "ru1k=; path='/'; domain=.kuajingmaihuo.com; expires=" + cookieDateEnd.toUTCString();
|
||||
document.cookie = "api_uid=CmP1wGhwa64RUwBSBILCAg==; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_nano_fp=XpmyX5gbl09jlpdoXo_mijphq7nL0UmRaA77jyt3; domain=.kuajingmaihuo.com; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_bee=NkjhfozSFfDuGSJ2zBlOqjOh3KVvJam3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_f77=2f854ce8-8d0f-4a78-84a1-04e19842a1cb; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "_a42=1e97ae4a-c357-4c22-a53f-db43655371e3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "rckk=NkjhfozSFfDuGSJ2zBlOqjOh3KVvJam3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "ru1k=2f854ce8-8d0f-4a78-84a1-04e19842a1cb; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "ru2k=1e97ae4a-c357-4c22-a53f-db43655371e3; path='/'; expires=" + cookieDate.toUTCString();
|
||||
document.cookie = "SUB_PASS_ID=eyJ0IjoiRDZZY1F2N2JjMnZNK1E0eEZjTm1GVmxsN20yN3N3Ymg2dnVjdmxiclZPQW5uRkJlendUOUtKTHRoWHJyZWlNUCIsInYiOjEsInMiOjEwMDAwLCJ1IjoyMzAxMjcwOTkwNDI5OH0=; domain=.kuajingmaihuo.com; path='/'; expires=" + cookieDate.toUTCString();
|
||||
location.reload();
|
||||
window.location.href = 'https://seller.kuajingmaihuo.com/goods/product/list';
|
||||
*/
|
||||
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -68,7 +77,7 @@ window.location.href = 'https://seller.kuajingmaihuo.com/goods/product/list';
|
||||
}
|
||||
|
||||
string txt = this.txtCookieJs.Text;
|
||||
txt = txt.Replace("SUB_PASS_ID=;", "").Replace("_nano_fp=;", "").Replace("api_uid=;","")
|
||||
txt = txt.Replace("SUB_PASS_ID=;", "").Replace("_nano_fp=;", "").Replace("api_uid=;", "")
|
||||
.Replace("_bee=;", "").Replace("ru2k=;", "").Replace("_f77=;", "")
|
||||
.Replace("_a42=;", "").Replace("rckk=;", "").Replace("ru1k=;", "");
|
||||
|
||||
@@ -95,53 +104,64 @@ window.location.href = 'https://seller.kuajingmaihuo.com/goods/product/list';
|
||||
{
|
||||
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var cookieShop = new ShopLoginInfo();
|
||||
cookieShop.Cookies = cookie;
|
||||
|
||||
var data = ShopListForm.GetShopStatus(cookieShop);
|
||||
if ( data.Contains("\"success\":true"))
|
||||
{
|
||||
var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
|
||||
if (shopLoginInfo.LoginName.EndsWith(maskMobile))
|
||||
{
|
||||
//如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
|
||||
GetShopFirstLogin(data);
|
||||
|
||||
shopLoginInfo.Cookies = cookie;
|
||||
var campanys = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopLoginInfo.LoginName).ToList();
|
||||
foreach (var sc in campanys)
|
||||
{
|
||||
sc.Cookies = cookie;
|
||||
sc.LoginStatus = "登录成功";
|
||||
}
|
||||
ShopListForm.UpdateServerShopCookies(shopLoginInfo, shopLoginInfo.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
this.OnSaveComplete(shopLoginInfo);
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseMsgForm.ShowError("cookie与店铺不匹配,请核对店铺!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!data.Contains("\"success\":true"))
|
||||
{
|
||||
BaseMsgForm.ShowError("cookie已失效!");
|
||||
return;
|
||||
}
|
||||
|
||||
var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
|
||||
if (!shopLoginInfo.LoginName.EndsWith(maskMobile))
|
||||
{
|
||||
BaseMsgForm.ShowError("cookie与店铺不匹配,请核对店铺!");
|
||||
return;
|
||||
}
|
||||
|
||||
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
|
||||
var rst = AdminGetServerShopListForSetCookie(shopLoginInfo, serverShopLst);
|
||||
|
||||
if (rst != "success")
|
||||
{
|
||||
BaseMsgForm.ShowError(rst);
|
||||
return;
|
||||
}
|
||||
|
||||
//如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
|
||||
GetShopFirstLogin(data, serverShopLst);
|
||||
|
||||
if (updateFrom == SetCookieFromEnum.normal_user) // 普通用户更新本地店铺
|
||||
{
|
||||
var localShop = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopLoginInfo.LoginName).ToList();
|
||||
foreach (var sc in localShop)
|
||||
{
|
||||
sc.Cookies = cookie;
|
||||
sc.LoginStatus = "登录成功";
|
||||
}
|
||||
}
|
||||
shopLoginInfo.Cookies = cookie;
|
||||
shopLoginInfo.LoginStatus = "登录成功";
|
||||
ShopListForm.UpdateServerShopCookies(shopLoginInfo, shopLoginInfo.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
this.OnSaveComplete(shopLoginInfo);
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
|
||||
/// </summary>
|
||||
/// <param name="loginData"></param>
|
||||
void GetShopFirstLogin(string loginData)
|
||||
void GetShopFirstLogin(string loginData, List<ShopLoginInfo> lstServerShop)
|
||||
{
|
||||
if (this.shopLoginInfo == null)
|
||||
return;
|
||||
if (lstServerShop == null)
|
||||
lstServerShop = new List<ShopLoginInfo>();
|
||||
|
||||
List<ShopCompany> lstShopCompany = new List<ShopCompany>();
|
||||
var jObj = JObject.Parse(loginData);
|
||||
@@ -168,6 +188,7 @@ window.location.href = 'https://seller.kuajingmaihuo.com/goods/product/list';
|
||||
{
|
||||
ShopLoginInfo newShop = new ShopLoginInfo()
|
||||
{
|
||||
UserName = shopLoginInfo.UserName,
|
||||
LoginName = shopLoginInfo.LoginName,
|
||||
Password = shopLoginInfo.Password,
|
||||
GroupName = shopLoginInfo.GroupName,
|
||||
@@ -177,14 +198,67 @@ window.location.href = 'https://seller.kuajingmaihuo.com/goods/product/list';
|
||||
Notes = shopLoginInfo.Notes,
|
||||
};
|
||||
|
||||
var oldShop = GlobalConfig.ShopLoginList.FirstOrDefault(l =>
|
||||
l.LoginName == newShop.LoginName && l.ShopId == newShop.ShopId);
|
||||
if (oldShop == null)
|
||||
var oldServerShop = lstServerShop.FirstOrDefault(s =>
|
||||
s.LoginName == newShop.LoginName && s.ShopId == newShop.ShopId);
|
||||
if (oldServerShop == null)
|
||||
{
|
||||
GlobalConfig.ShopLoginList.Add(newShop);
|
||||
ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端
|
||||
if (updateFrom != SetCookieFromEnum.normal_user)
|
||||
AdminShopForm.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
else
|
||||
ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string AdminGetServerShopListForSetCookie(ShopLoginInfo loginShop, List<ShopLoginInfo> lstRst)
|
||||
{
|
||||
if (lstRst == null)
|
||||
lstRst = new List<ShopLoginInfo>();
|
||||
|
||||
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&search_user_name=" + loginShop.UserName +
|
||||
"&search_login_name=" + loginShop.LoginName;
|
||||
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"))
|
||||
{
|
||||
return "获取失败:" + BaseRegex.GetStringJson(ref html, "msg");
|
||||
}
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return "获取失败:未获取到data数据";
|
||||
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
string shopStr = jObj.ToString();
|
||||
ShopLoginInfo shop = new ShopLoginInfo();
|
||||
shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id");
|
||||
if (shop.DbId == null)
|
||||
continue;
|
||||
|
||||
shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name");
|
||||
shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass");
|
||||
shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
|
||||
shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account");
|
||||
shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name");
|
||||
shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name");
|
||||
shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group");
|
||||
shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie");
|
||||
shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+");
|
||||
shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name");
|
||||
shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes");
|
||||
shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status");
|
||||
shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name");
|
||||
|
||||
lstRst.Add(shop);
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user