1096 lines
48 KiB
C#
1096 lines
48 KiB
C#
using AllBase.Helper;
|
|
using AllBase.Model.Result;
|
|
using CefSharp;
|
|
using CefSharp.WinForms;
|
|
using LittleRabbit.Extension;
|
|
using LittleRabbit.Helper;
|
|
using LittleRabbit.LittleRabbitForms.BaseForms;
|
|
using NaiBa.CefHelper;
|
|
using NaiBa.CefHelper.Handler;
|
|
using NaiBa.Util.Extension;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace LittleRabbit.LittleRabbitForms.UploadForms
|
|
{
|
|
public partial class CommissionForm : Form
|
|
{
|
|
ChromiumWebBrowser webBrowser = null;
|
|
int setPage = 99;
|
|
int currentPage = 0;
|
|
/// <summary>
|
|
/// 佣金比例
|
|
/// </summary>
|
|
int commissionRate = 10;
|
|
string sampleRule = "不支持申样";
|
|
/// <summary>
|
|
/// 指定佣金商品ID
|
|
/// </summary>
|
|
string commissionProductIds = "";
|
|
bool isRun = false;
|
|
public CommissionForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void CommissionForm_Load(object sender, EventArgs e)
|
|
{
|
|
LoadShops();
|
|
this.dgvShop.AddSelectorColumn("colSelect");
|
|
}
|
|
|
|
public void LoadShops()
|
|
{
|
|
for (int i = 0; i < GlobalConfig.DouShopLoginList.Count; i++)
|
|
{
|
|
var shop = GlobalConfig.DouShopLoginList[i];
|
|
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row == null)
|
|
dgvShop.Rows.Add(false, shop.ShopAccountId, shop.ShopAccount, shop.LoginStatus);
|
|
else
|
|
{
|
|
row.Cells["colLoginStatus"].Value = shop.LoginStatus;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void CommissionForm_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (Visible)
|
|
LoadShops();
|
|
}
|
|
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
LoadShops();
|
|
}
|
|
|
|
private void btnStart_Click(object sender, EventArgs e)
|
|
{
|
|
BaseMsgForm.ShowError("因抖店平台调整,本功能暂时不可用。");
|
|
return;
|
|
|
|
this.setPage = this.txtTotalPage.Text.ParseToInt();
|
|
this.commissionRate = this.txtRatio.Text.ParseToInt();
|
|
this.sampleRule = rbNoSample.Checked ? "不支持申样" : "免费申样";
|
|
var shopIds = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true && r.Cells["colLoginStatus"].Value?.ToString() == "登录成功")
|
|
.Select(r => r.Cells["colShopId"].Value?.ToString()).ToList();
|
|
var shops = GlobalConfig.DouShopLoginList.Where(s => shopIds.Contains(s.ShopAccountId)).ToList();
|
|
|
|
isRun = true;
|
|
btnStart.Enabled = false;
|
|
AddCommissionWithCef(shops);
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(8000);
|
|
Invoke(new Action(() => { btnStart.Enabled = true; }));
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改申样规则
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnEditSampleRule_Click(object sender, EventArgs e)
|
|
{
|
|
BaseMsgForm.ShowError("因抖店平台调整,本功能暂时不可用。");
|
|
return;
|
|
|
|
this.setPage = this.txtTotalPage.Text.ParseToInt();
|
|
this.commissionRate = this.txtRatio.Text.ParseToInt();
|
|
this.sampleRule = rbNoSample.Checked ? "不支持申样" : "免费申样";
|
|
var shopIds = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true && r.Cells["colLoginStatus"].Value?.ToString() == "登录成功")
|
|
.Select(r => r.Cells["colShopId"].Value?.ToString()).ToList();
|
|
var shops = GlobalConfig.DouShopLoginList.Where(s => shopIds.Contains(s.ShopAccountId)).ToList();
|
|
|
|
isRun = true;
|
|
btnStart.Enabled = false;
|
|
EditSampleRuleWithCef(shops);
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(8000);
|
|
Invoke(new Action(() => { btnStart.Enabled = true; }));
|
|
});
|
|
}
|
|
|
|
void InitWebBrowser()
|
|
{
|
|
webBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
|
|
webBrowser.KeyboardHandler = new KeyboardHandler();
|
|
webBrowser.Dock = DockStyle.Fill;
|
|
webBrowser.LifeSpanHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
|
|
webBrowser.AddressChanged += WebBrowser_AddressChanged;
|
|
webBrowser.FrameLoadEnd += webBrowser_FrameLoadEnd;
|
|
webBrowser.SendToBack();
|
|
this.panelEx1.Controls.Add(webBrowser);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 使用cef修改申样规则
|
|
/// </summary>
|
|
/// <param name="shops"></param>
|
|
public void EditSampleRuleWithCef(List<DouShopLoginInfo> shops)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
if (webBrowser == null)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
InitWebBrowser();
|
|
}));
|
|
}
|
|
|
|
while (!webBrowser.IsBrowserInitialized || webBrowser.IsLoading)
|
|
continue;
|
|
|
|
for (int i = 0; i < shops.Count; i++)
|
|
{
|
|
|
|
var shop = shops[i];
|
|
if (shop == null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (!isRun)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = "设置中断";
|
|
}));
|
|
break;
|
|
}
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.statusBar.pgbTaskProgress.Maximum = shops.Count;
|
|
this.statusBar.lblTaskStatus.Text = "正在设置店铺:" + shop.ShopAccount + " 页数:" + (currentPage + 1) + "/" + setPage;
|
|
this.statusBar.pgbTaskProgress.Value = (i + 1);
|
|
this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shops.Count;
|
|
}));
|
|
|
|
var loadResult = LoadShopCommissionPage(shop);
|
|
if (!string.IsNullOrEmpty(loadResult))
|
|
{
|
|
shop.Message = loadResult;
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = shop.Message;
|
|
}));
|
|
continue;
|
|
}
|
|
EditSampleRule(shop);
|
|
}
|
|
|
|
isRun = false;
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.statusBar.lblTaskStatus.Text = "设置完成";
|
|
btnStart.Enabled = true;
|
|
}));
|
|
});
|
|
}
|
|
|
|
void EditSampleRule(DouShopLoginInfo shop)
|
|
{
|
|
// 错误提示信息
|
|
string failMsg = "";
|
|
var productIds = commissionProductIds;
|
|
|
|
#region 选择要设置的申样选项
|
|
|
|
// 点击打开申样选择框
|
|
var jsStr = clickJsElementStr +
|
|
"function clickBtn2(txt1, txt2) {\r\n" +
|
|
" var elem = getElement(txt1);\r\n" +
|
|
" if(elem) {" +
|
|
" elem = elem.parentNode.parentNode;\r\n" +
|
|
" elem = getElement(txt2, elem);\r\n" +
|
|
" if (elem) {\r\n" +
|
|
" var e = document.createEvent('MouseEvents');\r\n" +
|
|
" e.initMouseEvent('mousedown', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\r\n" +
|
|
" elem.dispatchEvent(e); " +
|
|
" return 'success';\r\n" +
|
|
" }\r\n" +
|
|
" }\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"}\r\n" +
|
|
"clickBtn2('样品规则', '全部');\r\n";
|
|
|
|
var t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() == null || t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "编辑申样设置选项打开失败。";
|
|
goto showFail;
|
|
}
|
|
|
|
var selectSampleRule = "不支持申样";
|
|
// 选择申样设置
|
|
if (sampleRule == "不支持申样")
|
|
{
|
|
selectSampleRule = "免费申样";
|
|
}
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
jsStr = clickJsElementStr +
|
|
"function clickSelect() {\r\n" +
|
|
" var elem = getElement('>" + selectSampleRule + "<', document.getElementsByClassName('rc-virtual-list-holder-inner')[0]);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"}\r\n" +
|
|
"clickSelect();\r\n";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() == null || t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "编辑申样设置选项选择失败。";
|
|
goto showFail;
|
|
}
|
|
|
|
#endregion
|
|
|
|
while (currentPage < setPage)
|
|
{
|
|
if (!isRun)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = "编辑申样中断";
|
|
}));
|
|
break;
|
|
}
|
|
|
|
currentPage++;
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.statusBar.lblTaskStatus.Text = "正在编辑申样,店铺:" + shop.ShopAccount + " 页数:" + currentPage + "/" + setPage + "...";
|
|
}));
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
// 点击查询按钮
|
|
jsStr = clickJsElementStr +
|
|
"function clickSearch(){" +
|
|
" var elem = getElement('<span>查询 </span>');\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"} " +
|
|
"clickSearch();\r\n";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "查询申样设置商品失败。";
|
|
goto showFail;
|
|
}
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
// 获取页面上是否有数据
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("document.body.innerHTML.indexOf('暂无数据') >= 0");
|
|
t1.Wait();
|
|
// 如果暂无数据,说明已设置完成,跳转到设置完成。
|
|
if (t1.Result?.Result?.ToString()?.ToLower() == "true")
|
|
{
|
|
goto SetEnd;
|
|
}
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
// 全选要设置的商品
|
|
jsStr = "function selectAllProduct() { document.getElementsByClassName('auxo-checkbox-input')[0].click(); return 'success'; }" +
|
|
"selectAllProduct();";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "全选申样设置商品失败。";
|
|
goto showFail;
|
|
}
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
// 点击设置申样门槛按钮
|
|
jsStr = clickJsElementStr +
|
|
"function clickSetSample(){" +
|
|
" var elem = getElement('设置申样门槛');\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"} " +
|
|
"clickSetSample();\r\n";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "点击设置申样门槛按钮失败";
|
|
goto showFail;
|
|
}
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
// 选择申样规则
|
|
if (sampleRule == "不支持申样")
|
|
{
|
|
// 系统默认选择 不支持申样,不做操作;
|
|
}
|
|
else
|
|
{
|
|
jsStr = clickJsElementStr +
|
|
"function checkSampleRule(){" +
|
|
" var elem = getElement('" + sampleRule + "', document.getElementsByClassName('auxo-drawer-wrapper-body')[0]);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"} " +
|
|
"checkSampleRule();\r\n";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "选择申样设置门槛失败。";
|
|
goto showFail;
|
|
}
|
|
}
|
|
|
|
Thread.Sleep(AllBase.Randomx.GetId(1500, 2500));
|
|
|
|
jsStr = clickJsElementStr +
|
|
"function checkSampleRule(){" +
|
|
" var elem = getElement('确定', document.getElementsByClassName('auxo-drawer-wrapper-body')[0]);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"} " +
|
|
"checkSampleRule();\r\n";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "点击确定设置申样门槛失败。";
|
|
goto showFail;
|
|
}
|
|
for (int k = 0; k < 5; k++)
|
|
{
|
|
Thread.Sleep(1000);
|
|
}
|
|
}
|
|
|
|
SetEnd:
|
|
Invoke(new Action(() =>
|
|
{
|
|
shop.Message = "设置完成";
|
|
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row != null)
|
|
row.Cells["colMessage"].Value = "设置完成";
|
|
}));
|
|
|
|
showFail:
|
|
if (!string.IsNullOrEmpty(failMsg))
|
|
{
|
|
if (failMsg.Contains("设置新增佣金商品不存在") || failMsg.Contains("佣金金额设置失败"))
|
|
{
|
|
shop.Message = "设置完成";
|
|
}
|
|
else
|
|
{
|
|
shop.Message = failMsg;
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
pnlShowError.Visible = true;
|
|
pnlShowError.Text = " 设置佣金部分失败:" + failMsg + " " + productIds.Trim(',') + " ";
|
|
this.pnlShowError.BringToFront();
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(8000);
|
|
if (this.Created)
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.pnlShowError.Visible = false;
|
|
}));
|
|
});
|
|
}));
|
|
}
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = shop.Message;
|
|
}));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加普通佣金
|
|
/// </summary>
|
|
/// <param name="shops"></param>
|
|
/// <param name="type"></param>
|
|
public void AddCommissionWithCef(List<DouShopLoginInfo> shops)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
if (webBrowser == null)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
InitWebBrowser();
|
|
}));
|
|
}
|
|
|
|
while (!webBrowser.IsBrowserInitialized || webBrowser.IsLoading)
|
|
continue;
|
|
|
|
for (int i = 0; i < shops.Count; i++)
|
|
{
|
|
|
|
var shop = shops[i];
|
|
if (shop == null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (!isRun)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = "设置中断";
|
|
}));
|
|
break;
|
|
}
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.statusBar.pgbTaskProgress.Maximum = shops.Count;
|
|
this.statusBar.lblTaskStatus.Text = "正在设置店铺:" + shop.ShopAccount + " 页数:" + (currentPage + 1) + "/" + setPage;
|
|
this.statusBar.pgbTaskProgress.Value = (i + 1);
|
|
this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shops.Count;
|
|
}));
|
|
|
|
var loadResult = LoadShopCommissionPage(shop);
|
|
if (!string.IsNullOrEmpty(loadResult))
|
|
{
|
|
shop.Message = loadResult;
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = shop.Message;
|
|
}));
|
|
continue;
|
|
}
|
|
SetNewCommission(shop);
|
|
}
|
|
|
|
isRun = false;
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.statusBar.lblTaskStatus.Text = "设置完成";
|
|
btnStart.Enabled = true;
|
|
}));
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 登录店铺佣金页面
|
|
/// </summary>
|
|
/// <param name="shop"></param>
|
|
private string LoadShopCommissionPage(DouShopLoginInfo shop)
|
|
{
|
|
Thread.Sleep(1000);
|
|
|
|
// 错误提示信息
|
|
string failMsg = "";
|
|
currentPage = 0;
|
|
var cookie = shop.Cookies;
|
|
CEFBrowser.DeleteCookie(webBrowser.RequestContext.GetCookieManager(null));
|
|
var t = CEFBrowser.SetCookieAsync("jinritemai.com", cookie, webBrowser.RequestContext.GetCookieManager(null));
|
|
t.Wait(8000);
|
|
|
|
for (int j = 0; j < 50; j++)
|
|
{
|
|
Thread.Sleep(1500);
|
|
//webBrowser.Load("https://buyin.jinritemai.com/dashboard/activity/common-plan");
|
|
var jsStr = "window.location.href='https://fxg.jinritemai.com/ffa/mshop/homepage/index';";
|
|
var t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait(8000);
|
|
do
|
|
{
|
|
Thread.Sleep(1000);
|
|
}
|
|
while (webBrowser.IsLoading);
|
|
Thread.Sleep(AllBase.Randomx.GetId(2000, 3000));
|
|
|
|
jsStr = clickJsElementStr + "getElement('精选联盟').click();";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait(8000);
|
|
do
|
|
{
|
|
Thread.Sleep(1000);
|
|
}
|
|
while (webBrowser.IsLoading);
|
|
Thread.Sleep(AllBase.Randomx.GetId(2000, 3000));
|
|
|
|
jsStr = "window.location.href='https://buyin.jinritemai.com/dashboard/activity/common-plan';";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait(8000);
|
|
do
|
|
{
|
|
Thread.Sleep(1000);
|
|
}
|
|
while (webBrowser.IsLoading);
|
|
Thread.Sleep(AllBase.Randomx.GetId(4000, 5000));
|
|
|
|
jsStr = clickJsElementStr +
|
|
"function clickBtn(txt) {\r\n" +
|
|
" var elem = getElement(txt);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"}\r\n" +
|
|
"clickBtn('添加商品');\r\n";
|
|
|
|
// 先判断页面是否加载失败
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("document.body.innerHTML.indexOf('加载失败') >= 0");
|
|
t1.Wait();
|
|
// 如果加载失败,通过点击计划按钮尝试再次加载
|
|
if (t1.Result?.Result?.ToString()?.ToLower() == "true")
|
|
{
|
|
Thread.Sleep(1500 + AllBase.Randomx.GetId(1000));
|
|
var jsStrx = jsStr.Replace("clickBtn('添加商品');", "clickBtn('定向计划');");
|
|
var t1x = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStrx);
|
|
t1x.Wait();
|
|
if (t1x.Result?.Result?.ToString() == "success")
|
|
{
|
|
Thread.Sleep(1500 + AllBase.Randomx.GetId(1000));
|
|
jsStrx = jsStr.Replace("clickBtn('添加商品');", "clickBtn('普通计划');");
|
|
t1x = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStrx);
|
|
t1x.Wait();
|
|
}
|
|
// 二次判断页面是否仍加载失败,如果加载仍失败,则重新load网页。
|
|
Thread.Sleep(1500 + AllBase.Randomx.GetId(1000));
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("document.body.innerHTML.indexOf('加载失败') >= 0");
|
|
t1.Wait();
|
|
// 如果加载失败
|
|
if (t1.Result?.Result?.ToString()?.ToLower() == "true")
|
|
continue;
|
|
else
|
|
break;
|
|
}
|
|
else
|
|
break;
|
|
}
|
|
Thread.Sleep(2000);
|
|
|
|
for (int j = 0; j < 10; j++)
|
|
{
|
|
var jsCode = "function closeMask() {" +
|
|
"if (document.body.innerHTML.indexOf('普通计划') < 0) return;" +
|
|
"var mask1 = document.getElementsByClassName('ant-modal-root')[0];" +
|
|
"if (mask1) mask1.parentNode.removeChild(mask1);" +
|
|
"var mask2 = document.getElementsByClassName('y-guide')[0];" +
|
|
"if (mask2) mask2.parentNode.removeChild(mask2);" +
|
|
"var mask3 = document.getElementById('browser-support-tip');" +
|
|
"if (mask3) mask3.parentNode.removeChild(mask3);" +
|
|
"}" +
|
|
"closeMask();";
|
|
t = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsCode);
|
|
t.Wait(3000);
|
|
Thread.Sleep(300);
|
|
}
|
|
|
|
return failMsg;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置新佣金
|
|
/// </summary>
|
|
/// <param name="shop"></param>
|
|
private void SetNewCommission(DouShopLoginInfo shop)
|
|
{
|
|
// 错误提示信息
|
|
string failMsg = "";
|
|
var rate = commissionRate;
|
|
var productIds = commissionProductIds;
|
|
|
|
//var jsStr = clickJsElementStr +
|
|
// "function clickBtn(txt) {\r\n" +
|
|
// " var elem = getElement(txt);\r\n" +
|
|
// " if (elem) elem.click(); return 'success';\r\n" +
|
|
// " return 'no_element';\r\n" +
|
|
// "}\r\n" +
|
|
// "clickBtn('添加商品');\r\n";
|
|
|
|
//// 打开新增佣金商品列表
|
|
//var t0 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
//t0.Wait();
|
|
|
|
//if (t0.Result?.Result?.ToString() != "success")
|
|
//{
|
|
// failMsg = "新增佣金商品列表打开失败。";
|
|
// return failMsg;
|
|
//}
|
|
|
|
while (currentPage < setPage)
|
|
{
|
|
if (!isRun)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = "设置中断";
|
|
}));
|
|
break;
|
|
}
|
|
|
|
currentPage++;
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.statusBar.lblTaskStatus.Text = "正在设置店铺:" + shop.ShopAccount + " 页数:" + currentPage + "/" + setPage + "...";
|
|
}));
|
|
|
|
var jsStr = clickJsElementStr +
|
|
"function clickBtn2(txt) {\r\n" +
|
|
" if (document.body.innerHTML.indexOf('添加推广商品') >= 0)\r\n" +
|
|
" return 'success';\r\n" +
|
|
" var elem = getElement(txt);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"}\r\n" +
|
|
"clickBtn2('添加商品');\r\n";
|
|
var t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() == "加载失败" || t1.Result?.Result?.ToString() == null)
|
|
continue;
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "新增佣金商品列表打开失败。";
|
|
goto showFail;
|
|
}
|
|
|
|
int x = 0, y = 0;
|
|
string jsStr1 = "", result = "";
|
|
Task<JavascriptResponse> task = null;
|
|
var host = webBrowser.GetBrowser().GetHost();
|
|
#region 选择批量查询选项
|
|
if (!string.IsNullOrEmpty(productIds))
|
|
{
|
|
x = 0;
|
|
y = 0;
|
|
jsStr1 = "function getPos() { var box = document.getElementsByClassName('search-product-select');" +
|
|
"if (box[0] == null) return '-|-';" +
|
|
"var actualLeft = box[0].offsetLeft;" +
|
|
"var actualTop = box[0].offsetTop;" +
|
|
"var current = box[0].offsetParent;" +
|
|
"while (current !== null) { actualLeft += current.offsetLeft; actualTop += current.offsetTop; current = current.offsetParent; }" +
|
|
"return '' + actualLeft + '|' + actualTop;}" +
|
|
"getPos();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
result = task.Result?.Result?.ToString();
|
|
|
|
if (result != null && result != "-|-")
|
|
{
|
|
var arr = result.Split('|');
|
|
if (arr.Length == 2)
|
|
{
|
|
x = Convert.ToInt32(arr[0]);
|
|
y = Convert.ToInt32(arr[1]);
|
|
}
|
|
int x1 = x + new Random(DateTime.Now.Millisecond).Next(6, 30);
|
|
int y1 = y + new Random(DateTime.Now.Millisecond).Next(6, 16);
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, false, 1, CefEventFlags.None); // 按下鼠标左键
|
|
Thread.Sleep(70 + new Random(DateTime.Now.Millisecond).Next(50));
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, true, 1, CefEventFlags.None); // 松开鼠标左键
|
|
Thread.Sleep(500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
|
|
x1 = x + new Random(DateTime.Now.Millisecond).Next(6, 30);
|
|
y1 = y + new Random(DateTime.Now.Millisecond).Next(84, 94);
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, false, 1, CefEventFlags.None); // 按下鼠标左键
|
|
Thread.Sleep(70 + new Random(DateTime.Now.Millisecond).Next(50));
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, true, 1, CefEventFlags.None); // 松开鼠标左键
|
|
Thread.Sleep(1500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
}
|
|
else
|
|
{
|
|
failMsg = "佣金商品列表获取失败。";
|
|
goto showFail;
|
|
}
|
|
#endregion
|
|
|
|
#region 输入商品编号并查询
|
|
|
|
jsStr1 = "function getPos() { var box = document.getElementsByClassName('ant-select-show-search');" +
|
|
"if (box[0] == null) return '-|-';" +
|
|
"var actualLeft = box[0].offsetLeft;" +
|
|
"var actualTop = box[0].offsetTop;" +
|
|
"var current = box[0].offsetParent;" +
|
|
"while (current !== null) { actualLeft += current.offsetLeft; actualTop += current.offsetTop; current = current.offsetParent; }" +
|
|
"return '' + actualLeft + '|' + actualTop;}" +
|
|
"getPos();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
result = task.Result?.Result?.ToString();
|
|
|
|
if (result != null && result != "-|-")
|
|
{
|
|
var arr = result.Split('|');
|
|
if (arr.Length == 2)
|
|
{
|
|
x = Convert.ToInt32(arr[0]);
|
|
y = Convert.ToInt32(arr[1]);
|
|
}
|
|
int x1 = x + new Random(DateTime.Now.Millisecond).Next(6, 30);
|
|
int y1 = y + new Random(DateTime.Now.Millisecond).Next(6, 16);
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, false, 1, CefEventFlags.None); // 按下鼠标左键
|
|
Thread.Sleep(70 + new Random(DateTime.Now.Millisecond).Next(50));
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, true, 1, CefEventFlags.None); // 松开鼠标左键
|
|
Thread.Sleep(500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
Clipboard.Clear();
|
|
Clipboard.SetDataObject("" + productIds.TrimEnd(',')); // 复制要搜索的商品ID到剪贴板
|
|
}));
|
|
|
|
// 黏贴 ctrl + v
|
|
host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 86, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.ControlDown });
|
|
Thread.Sleep(1250 + new Random(DateTime.Now.Millisecond).Next(250));
|
|
}
|
|
else
|
|
{
|
|
failMsg = "查询新增佣金商品失败。";
|
|
goto showFail;
|
|
}
|
|
}
|
|
|
|
// 点击查询按钮
|
|
jsStr1 = "document.getElementsByClassName('search-btns-item-first')[0].click();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
Thread.Sleep(2500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
|
|
// 获取页面上是否有数据
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("document.getElementsByClassName('auxo-drawer-wrapper-body')[0].innerHTML.indexOf('暂无数据') >= 0");
|
|
task.Wait();
|
|
// 如果暂无数据,说明已设置完成,跳转到设置完成。
|
|
if (task.Result?.Result?.ToString()?.ToLower() == "true")
|
|
{
|
|
goto SetEnd;
|
|
}
|
|
#endregion
|
|
|
|
#region 勾选商品信息
|
|
jsStr1 = getFirstElementJsStr +
|
|
"\r\nfunction getInnerHtml() {\r\n" +
|
|
" var item = document.getElementsByClassName('ant-table-wrapper activity-list-table')[0];\r\n" +
|
|
" if (item) {\r\n" +
|
|
" return item.innerHTML;\r\n" +
|
|
" }\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"}\r\n" +
|
|
"getInnerHtml();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
Thread.Sleep(1500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
var idArray = productIds.TrimEnd(',').Split(',');
|
|
if (task.Result?.Result?.ToString() == null || !idArray.Any(a => task.Result.Result.ToString().Contains(a)))
|
|
{
|
|
failMsg = "设置新增佣金商品不存在。";
|
|
goto showFail;
|
|
}
|
|
|
|
jsStr1 = getFirstElementJsStr +
|
|
"\r\nfunction clickCheckBox() {\r\n" +
|
|
" var item = document.getElementsByClassName('auxo-table-wrapper activity-list-table')[0];\r\n" +
|
|
" if (item) {\r\n" +
|
|
" var tHead = getFirstElement('THEAD', item)\r\n" +
|
|
" var tagItem = getFirstElement('INPUT', tHead)\r\n" +
|
|
" if (tagItem) tagItem.click(); return 'success';\r\n" +
|
|
" }\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"}\r\n" +
|
|
"clickCheckBox();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
Thread.Sleep(1500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
if (task.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "设置新增佣金商品选择失败。";
|
|
goto showFail;
|
|
}
|
|
#endregion
|
|
|
|
#region 点击确定设置佣金
|
|
jsStr1 = "const originalPush = Router.prototype.push;" +
|
|
"Router.prototype.push = function push(location) {" +
|
|
" return originalPush.call(this, location).catch(err => err) " +
|
|
"}" +
|
|
|
|
"function clickSetCommMulti() {" +
|
|
" var btn = document.getElementsByClassName('exclusive_commodity-filter-drawer-footer-operations__operation ant-btn-primary')[0];" +
|
|
" if (btn) { btn.click(); return; }" +
|
|
" btn = document.getElementsByClassName('auxo-btn-primary exclusive_commodity-filter-drawer-footer-operations__operation')[0];" +
|
|
" if (btn) { btn.click(); return; }" +
|
|
"}" +
|
|
"clickSetCommMulti();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
Thread.Sleep(1500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
#endregion
|
|
|
|
for (int i = 0; i < 9999; i++)
|
|
{
|
|
Thread.Sleep(1000);
|
|
}
|
|
|
|
#region 设置申样
|
|
if (sampleRule == "不支持申样")
|
|
{
|
|
jsStr = clickJsElementStr +
|
|
"function checkSampleRule(){" +
|
|
" var elem = getElement('" + sampleRule + "', document.getElementsByClassName('auxo-drawer-wrapper-body')[0]);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"} " +
|
|
"checkSampleRule();\r\n";
|
|
t1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
|
t1.Wait();
|
|
if (t1.Result?.Result?.ToString() != "success")
|
|
{
|
|
failMsg = "选择申样设置门槛失败。";
|
|
goto showFail;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设置佣金金额
|
|
jsStr1 = "function getPos() { var box = document.getElementsByClassName('auxo-input-number-input');" +
|
|
"if (box[0] == null) return '-|-';" +
|
|
"var actualLeft = box[0].offsetLeft;" +
|
|
"var actualTop = box[0].offsetTop;" +
|
|
"var current = box[0].offsetParent;" +
|
|
"while (current !== null) { actualLeft += current.offsetLeft; actualTop += current.offsetTop; current = current.offsetParent; }" +
|
|
"return '' + actualLeft + '|' + actualTop;}" +
|
|
"getPos();";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
result = task.Result?.Result?.ToString();
|
|
|
|
if (result != null && result != "-|-")
|
|
{
|
|
var arr = result.Split('|');
|
|
if (arr.Length == 2)
|
|
{
|
|
x = Convert.ToInt32(arr[0]);
|
|
y = Convert.ToInt32(arr[1]);
|
|
}
|
|
int x1 = x + new Random(DateTime.Now.Millisecond).Next(30, 60);
|
|
int y1 = y + new Random(DateTime.Now.Millisecond).Next(6, 16);
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, false, 1, CefEventFlags.None); // 按下鼠标左键
|
|
Thread.Sleep(70 + new Random(DateTime.Now.Millisecond).Next(50));
|
|
host.SendMouseClickEvent(x1, y1, MouseButtonType.Left, true, 1, CefEventFlags.None); // 松开鼠标左键
|
|
Thread.Sleep(150 + new Random(DateTime.Now.Millisecond).Next(150));
|
|
|
|
// 模拟输入退格键
|
|
host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 8, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.None });
|
|
Thread.Sleep(250 + new Random(DateTime.Now.Millisecond).Next(250));
|
|
// 模拟输入退格键
|
|
host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 8, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.None });
|
|
Thread.Sleep(250 + new Random(DateTime.Now.Millisecond).Next(250));
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
Clipboard.Clear();
|
|
Clipboard.SetDataObject("" + rate); // 复制要搜索的商品ID到剪贴板
|
|
}));
|
|
|
|
// 黏贴 ctrl + v
|
|
host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 86, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.ControlDown });
|
|
Thread.Sleep(1500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
}
|
|
else
|
|
{
|
|
failMsg = "佣金金额设置失败。";
|
|
goto showFail;
|
|
}
|
|
#endregion
|
|
|
|
#region 最后点击确定按钮设置佣金
|
|
//apply-sample-modal-footer
|
|
jsStr1 = clickJsElementStr +
|
|
"function clickOkBtn(){" +
|
|
" var elem = getElement('确定', document.getElementsByClassName('auxo-drawer-wrapper-body')[0]);\r\n" +
|
|
" if (elem) elem.click(); return 'success';\r\n" +
|
|
" return 'no_element';\r\n" +
|
|
"} " +
|
|
"clickOkBtn();\r\n";
|
|
task = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
|
task.Wait();
|
|
Thread.Sleep(500 + new Random(DateTime.Now.Millisecond).Next(500));
|
|
#endregion
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
//bool isRetry = false;
|
|
//Retry:
|
|
//var url = "https://buyin.jinritemai.com/api/promotion/createXdPromotions";
|
|
////if (!string.IsNullOrEmpty(sign))
|
|
//// url += "?_signature=" + sign;
|
|
//var request = new CommonSimRequest();
|
|
//var referer = "https://buyin.jinritemai.com/dashboard/activity/common-plan";
|
|
//var data = "cos_ratio=" + rate + "&apply_style=1&product_ids=" + productIds.Trim(',');
|
|
//Dictionary<string, string> headers = new Dictionary<string, string>();
|
|
//headers.Add("Origin", @"https://buyin.jinritemai.com");
|
|
//var html = request.Request_Post(url, referer, headers, shop.Cookies, data);
|
|
//if (html.Contains("\"msg\":\"success\"") && html.Contains("\"failed_ids\":{}"))
|
|
//{
|
|
//}
|
|
//else
|
|
//{
|
|
// if (!isRetry)
|
|
// {
|
|
// isRetry = true;
|
|
// goto Retry;
|
|
// }
|
|
|
|
//}
|
|
|
|
var html = "";
|
|
//lock (lstCommissionAddResult)
|
|
//{
|
|
// try
|
|
// {
|
|
// //if (html.Contains("\"msg\":\"success\"") && html.Contains("\"failed_ids\":{}"))
|
|
// {
|
|
// lstCommissionAddResult.RemoveAll(s => productIds.Contains(s.ProductId.ToString()) || s.ProductId == 0);
|
|
// NaiBa.Util.ConfigHelper.SaveConfig("upload_commission_list", lstCommissionAddResult);
|
|
// }
|
|
// }
|
|
// catch (Exception ex) { }
|
|
//}
|
|
for (int k = 0; k < 5; k++)
|
|
{
|
|
Thread.Sleep(1000);
|
|
//if (lstCommissionAddResult.Count > 10 || Work.BLL.Upload.UploadProductBLL.ProductStock.Count < 1)
|
|
// break;
|
|
}
|
|
}
|
|
|
|
SetEnd:
|
|
Invoke(new Action(() =>
|
|
{
|
|
shop.Message = "设置完成";
|
|
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row != null)
|
|
row.Cells["colMessage"].Value = "设置完成";
|
|
}));
|
|
|
|
showFail:
|
|
if (!string.IsNullOrEmpty(failMsg))
|
|
{
|
|
if (failMsg.Contains("设置新增佣金商品不存在") || failMsg.Contains("佣金金额设置失败"))
|
|
{
|
|
shop.Message = "设置完成";
|
|
}
|
|
else
|
|
{
|
|
shop.Message = failMsg;
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
pnlShowError.Visible = true;
|
|
pnlShowError.Text = " 设置佣金部分失败:" + failMsg + " " + productIds.Trim(',') + " ";
|
|
this.pnlShowError.BringToFront();
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(8000);
|
|
if (this.Created)
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.pnlShowError.Visible = false;
|
|
}));
|
|
});
|
|
}));
|
|
}
|
|
Invoke(new Action(() =>
|
|
{
|
|
var row1 = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopAccountId);
|
|
if (row1 != null)
|
|
row1.Cells["colMessage"].Value = shop.Message;
|
|
}));
|
|
}
|
|
}
|
|
|
|
private void WebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e)
|
|
{
|
|
}
|
|
|
|
private void webBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
|
|
{
|
|
}
|
|
|
|
public static string clickJsElementStr = "function getElement(txt, elem) {\r\n" +
|
|
" var child = document.body.firstElementChild;\r\n" +
|
|
" if (elem) child = elem\r\n" +
|
|
" var element1 = null;\r\n" +
|
|
" while (child) {\r\n" +
|
|
" if (child.innerHTML.indexOf(txt) >= 0) {\r\n" +
|
|
" element1 = child;\r\n" +
|
|
" if (child.firstElementChild) {\r\n" +
|
|
" child = child.firstElementChild; continue;\r\n" +
|
|
" } else break;\r\n" +
|
|
" }\r\n" +
|
|
" child = child.nextElementSibling;\r\n" +
|
|
" }\r\n" +
|
|
" if (element1) {\r\n" +
|
|
" return element1;\r\n" +
|
|
" } else return error;\r\n" +
|
|
"}\r\n";
|
|
|
|
public static string getFirstElementJsStr = "function getFirstElement(tag_name, elem) {\r\n" +
|
|
" var nodes = [];\r\n" +
|
|
" var child = document.body.firstElementChild;\r\n" +
|
|
" if (elem) child = elem\r\n" +
|
|
" nodes.push(child);\r\n" +
|
|
" for (i = 0; i < nodes.length; i++) {\r\n" +
|
|
" if (nodes[i].tagName === tag_name) return nodes[i];\r\n" +
|
|
" for (j = 0; j < nodes[i].childNodes.length; j++) {\r\n" +
|
|
" var node = nodes[i].childNodes[j];\r\n" +
|
|
" if ((node.nodeType != 3) && (node.nodeName != 'SCRIPT')) {\r\n" +
|
|
" nodes.push(node);\r\n" +
|
|
" }\r\n" +
|
|
" }\r\n" +
|
|
" }\r\n" +
|
|
" return error;\r\n" +
|
|
"}\r\n";
|
|
|
|
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
|
return;
|
|
string colId = dgvShop.Columns[e.ColumnIndex].Name;
|
|
if (colId == "colSelect")
|
|
{
|
|
dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = !dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value.ParseToBool();
|
|
}
|
|
}
|
|
|
|
private void btnStop_Click(object sender, EventArgs e)
|
|
{
|
|
isRun = false;
|
|
}
|
|
}
|
|
}
|