temu客户端程序
This commit is contained in:
commit
4aaf264e89
694 files changed
+263780
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,737 @@
|
||||
using AllBase;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Result;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using LittleRabbit.DashBoardForms;
|
||||
using LittleRabbit.Extension;
|
||||
using LittleRabbit.Helper;
|
||||
using LittleRabbit.LittleRabbitForms.BaseForms;
|
||||
using NaiBa.CefHelper;
|
||||
using NaiBa.CefHelper.Handler;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
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;
|
||||
using Work.DouyinApiClass;
|
||||
|
||||
namespace LittleRabbit.LittleRabbitForms.ShopOptimizeForms
|
||||
{
|
||||
public partial class ClearNoVisitorForm : Form
|
||||
{
|
||||
private CheckBox chkSelectAll = null;
|
||||
public ChromiumWebBrowser webBrowser = null;
|
||||
private List<string> lstShopId = new List<string>();
|
||||
public List<string> keywords = null;
|
||||
public CancellationTokenSource cancellationTokenSource = null;
|
||||
bool onSale = true;
|
||||
|
||||
public ClearNoVisitorForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ClearNoVisitorForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.ucTabControl1.TabPages.Clear();
|
||||
|
||||
chkSelectAll = dgvShop.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false);
|
||||
dgvShop.Columns["colSelect"].HeaderText = "";
|
||||
chkSelectAll.Width = chkSelectAll.Height = 13;
|
||||
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
|
||||
}
|
||||
|
||||
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!chkSelectAll.Checked)
|
||||
{
|
||||
lstShopId.Clear();
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lstShopId.Clear();
|
||||
var list = GlobalConfig.DouShopLoginList.Where(s => s.ApiAuthStatus == "授权成功" && s.LoginStatus == "登录成功").Select(ss => ss.ShopAccountId);
|
||||
lstShopId.AddRange(list);
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (list.Any(l => l == row.Cells["colShopId"]?.Value?.ToString()))
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearNoVisitorForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible == true)
|
||||
RefreshShop();
|
||||
}
|
||||
|
||||
private void btnRefreshShop_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshShop();
|
||||
}
|
||||
|
||||
private void RefreshShop()
|
||||
{
|
||||
// 更新选中的上货店铺Id
|
||||
lstShopId = lstShopId.Where(id => GlobalConfig.DouShopLoginList.Any(s => s.ShopAccountId == id && s.LoginStatus == "已授权")).ToList();
|
||||
// 获取被删除的店铺
|
||||
List<DataGridViewRow> dgvRowList = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> !GlobalConfig.DouShopLoginList.Any(s => s.ShopAccountId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
|
||||
// 更新被删除的店铺列表
|
||||
foreach (var row in dgvRowList)
|
||||
{
|
||||
dgvShop.Rows.Remove(row);
|
||||
}
|
||||
// 绑定其他店铺(含新导入的店铺)
|
||||
foreach (DouShopLoginInfo shopEntity in GlobalConfig.DouShopLoginList)
|
||||
{
|
||||
BindShop(shopEntity);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindShop(DouShopLoginInfo shopEntity)
|
||||
{
|
||||
if (shopEntity == null)
|
||||
return;
|
||||
|
||||
bool canUse = shopEntity.ApiAuthStatus == "授权成功" && shopEntity.LoginStatus == "登录成功";
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopAccountId);
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
lstShopId.Contains(shopEntity.ShopAccountId) && canUse,
|
||||
shopEntity.ShopAccountId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.ApiAuthStatus,
|
||||
shopEntity.LoginStatus,
|
||||
canUse,
|
||||
string.Empty
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = lstShopId.Contains(shopEntity.ShopAccountId) && canUse;
|
||||
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colAuthStatus"].Value = shopEntity.ApiAuthStatus;
|
||||
row.Cells["colLoginStatus"].Value = shopEntity.LoginStatus;
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
|
||||
string columnName = dgvShop.Columns[e.ColumnIndex].Name;
|
||||
long shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToLong();
|
||||
string shopName = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ToString();
|
||||
var shop = GlobalConfig.DouShopLoginList.FirstOrDefault(s => s.ShopAccountId == shopId.ToString());
|
||||
var row = dgvShop.Rows[e.RowIndex];
|
||||
switch (columnName)
|
||||
{
|
||||
case "colSelect":
|
||||
if (row.Cells["colCanUse"].Value.ParseToBool())
|
||||
{
|
||||
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
if (dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value.ParseToBool())
|
||||
lstShopId.Add(shopId.ToString());
|
||||
else
|
||||
lstShopId.Remove(shopId.ToString());
|
||||
if (dgvShop.Rows.Cast<DataGridViewRow>().All(r => r.Cells["colSelect"].Value.ParseToBool()))
|
||||
chkSelectAll.Checked = true;
|
||||
else
|
||||
chkSelectAll.Checked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseMsgForm.ShowInfo("店铺未授权或未登录!");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnGetProduct_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lstShopId.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowInfo("请选择店铺!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
this.keywords = txtProductName.Text.Split(new string[] { ",", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (var shopId in lstShopId)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var shop = GlobalConfig.DouShopLoginList.FirstOrDefault(s => s.ShopAccountId == shopId);
|
||||
if (shop == null)
|
||||
continue;
|
||||
|
||||
ClearNoVisitorShopForm clearForm = null;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var tab = this.ucTabControl1.TabPages.Cast<TabPage>().FirstOrDefault(t => t.Text == shop.ShopAccount && t.Name == "tab" + shop.ShopAccountId);
|
||||
if (tab == null)
|
||||
{
|
||||
tab = new TabPage();
|
||||
tab.Name = "tab" + shop.ShopAccountId;
|
||||
tab.Text = shop.ShopAccount;
|
||||
this.ucTabControl1.TabPages.Add(tab);
|
||||
|
||||
var clearNoVisitorShopForm = new ClearNoVisitorShopForm(shop);
|
||||
clearNoVisitorShopForm.clearNoVisitorForm = this;
|
||||
clearNoVisitorShopForm.TopLevel = false;
|
||||
clearNoVisitorShopForm.Left = 0;
|
||||
clearNoVisitorShopForm.Top = 0;
|
||||
clearNoVisitorShopForm.FormBorderStyle = FormBorderStyle.None;
|
||||
clearNoVisitorShopForm.AutoSize = true;
|
||||
clearNoVisitorShopForm.Dock = DockStyle.Fill;
|
||||
clearNoVisitorShopForm.Show();
|
||||
tab.Controls.Add(clearNoVisitorShopForm);
|
||||
}
|
||||
|
||||
if (tab.Controls.Count > 0)
|
||||
clearForm = tab.Controls[0] as ClearNoVisitorShopForm;
|
||||
}));
|
||||
|
||||
if (clearForm != null)
|
||||
{
|
||||
clearForm.productTradeIndexList.Clear();
|
||||
clearForm.GetProduct(onSale, txtPriceMin.Text.ParseToDecimal(), txtPriceMax.Text.ParseToDecimal(),
|
||||
txtSaleMin.Text.ParseToInt(), txtSaleMax.Text.ParseToInt(),
|
||||
txtProductName.Text.Trim().Split(new string[] { "\r", "\n", "," }, StringSplitOptions.RemoveEmptyEntries).ToList());
|
||||
}
|
||||
}
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
public void GetSalesOrVisitor(DouShopLoginInfo shop, bool isSales = true)
|
||||
{
|
||||
if (webBrowser == null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
webBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
|
||||
webBrowser.KeyboardHandler = new KeyboardHandler();
|
||||
webBrowser.Dock = DockStyle.Fill;
|
||||
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
|
||||
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadCompleteEvent;
|
||||
webBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
|
||||
webBrowser.LifeSpanHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
|
||||
webBrowser.SendToBack();
|
||||
this.splitContainer1.Panel2.Controls.Add(webBrowser);
|
||||
}));
|
||||
}
|
||||
|
||||
while (webBrowser.Tag != null)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(50, 100));
|
||||
}
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
webBrowser.Tag = shop;
|
||||
|
||||
while (!webBrowser.IsBrowserInitialized || webBrowser.IsLoading)
|
||||
continue;
|
||||
|
||||
var cookie = shop.Cookies;
|
||||
CEFBrowser.DeleteCookie(webBrowser.RequestContext.GetCookieManager(null));
|
||||
var t = CEFBrowser.SetCookieAsync("jinritemai.com", cookie, webBrowser.RequestContext.GetCookieManager(null));
|
||||
t.Wait(2000);
|
||||
Thread.Sleep(500);
|
||||
|
||||
var targetUrl = "https://fxg.jinritemai.com/ffa/g/list";
|
||||
if (!isSales)
|
||||
targetUrl = "https://fxg.jinritemai.com/ffa/mshop/homepage/index";
|
||||
webBrowser.Load(targetUrl);
|
||||
|
||||
while (webBrowser.IsLoading)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
Thread.Sleep(3000);
|
||||
|
||||
if (!isSales)
|
||||
{
|
||||
Thread.Sleep(3000);
|
||||
var jsStrBase = "function clickProductAnalysis(txt) {\r\n"
|
||||
+ "var child = document.body.firstElementChild;\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"
|
||||
+ " element1.click(); return 'success';\r\n"
|
||||
+ " } else return 'no_element';\r\n"
|
||||
+ "}\r\n";
|
||||
var jsStr = jsStrBase + "clickProductAnalysis('电商罗盘');\r\n";
|
||||
t = webBrowser.GetMainFrame().EvaluateScriptAsync(jsStr);
|
||||
t.Wait();
|
||||
|
||||
while (webBrowser.IsLoading)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(1500, 2500));
|
||||
|
||||
jsStr = jsStrBase + "clickProductAnalysis('商品概览');\r\n";
|
||||
t = webBrowser.GetMainFrame().EvaluateScriptAsync(jsStr);
|
||||
t.Wait();
|
||||
while (webBrowser.IsLoading)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(1500, 2500));
|
||||
}
|
||||
while (webBrowser.Tag != null)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(50, 100));
|
||||
}
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
|
||||
private void RequestHandler_ResourceLoadCompleteEvent(object sender, string url, string postData, string responseData, CefSharp.IRequest iRequest)
|
||||
{
|
||||
if (url.StartsWith("https://fxg.jinritemai.com/product/tproduct/list?page=0") && url.Contains("&pay_type="))
|
||||
{
|
||||
//HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://fxg.jinritemai.com/product/tproduct/list?page=0&pageSize=20&draft_status=0&comment_percent=&group_id=&pay_type=&business_type=4&is_online=1&check_status=3&status=0&supply_status=&order_field=audit_time&sort=desc&appid=1&__token=d08f30493d071fd0e9897298c524375c&_bid=ffa_goods&_lid=711798986796&msToken=r9mNuOXDYvbtInAwLzMATC3-yIiWLcZs25f-Jt5shVW8LdugFOlMdPFOYS3_UVXhRuB7RMC4LmK-pvyBrDfSopZsXXC8yQoEGVlat6UUrxINeKzsHyLW614=&X-Bogus=DFSzsdVLBvbANcMUSU8IvKXAIQRU&_signature=_02B4Z6wo000015pLnBgAAIDC-UFcc3lE05uaT5iAAIT9acBVIU6ij4-5DpO00qPB80yCit9yg5fMFBGG9MpPGrriZuj0AXpdbbUerWeM9eMoD3aCNPK8iJeLeNxDBbAP4e3pFFOcMuEX84BO85");
|
||||
//HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://fxg.jinritemai.com/product/tproduct/list?page=0&pageSize=20&group_id=&offline_type=&pay_type=&business_type=4&is_online=1&status=1&supply_status=&order_field=offline_time&sort=desc&appid=1&__token=d08f30493d071fd0e9897298c524375c&_bid=ffa_goods&_lid=711769550666&msToken=79CxZTCGdJBocG27LuxPm9gT0QBCKI1GNci1u0AerFDnmLK0qMkau2ARZcFJx03cw2o5D5CySkojV6UCZ_riv2N36usyvdjsS2jvfE_6Z7k2sUsC2U7hJwo=&X-Bogus=DFSzsdVL5HiANcMUSU8IvVXAIQRG&_signature=_02B4Z6wo00001fJb96wAAIDAkVE3xAcLXS3yX.MAAB7zacBVIU6ij4-5DpO00qPB80yCit9yg5fMFBGG9MpPGrriZuj0AXpdbbUerWeM9eMoD3aCNPK8iJeLeNxDBbAP4e3pFFOcMuEX84BO1e");
|
||||
|
||||
var listUrl = url;
|
||||
var referrerUrl = iRequest.ReferrerUrl;
|
||||
var result = responseData;
|
||||
Dictionary<string, string> Headers = new Dictionary<string, string>();
|
||||
foreach (var hk in iRequest.Headers.AllKeys)
|
||||
{
|
||||
Headers[hk] = iRequest.Headers[hk];
|
||||
}
|
||||
if (webBrowser.Tag != null)
|
||||
{
|
||||
var shop = webBrowser.Tag as DouShopLoginInfo;
|
||||
var tab = this.ucTabControl1.TabPages.Cast<TabPage>().FirstOrDefault(t => t.Text == shop.ShopAccount && t.Name == "tab" + shop.ShopAccountId);
|
||||
var clearForm = tab.Controls[0] as ClearNoVisitorShopForm;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
int total = -1;
|
||||
int number = 0;
|
||||
for (int i = 0; i < 10000; i++)
|
||||
{
|
||||
number += 20;
|
||||
result = "";
|
||||
for (int j = 0; j < 3 && !result.Contains("\"st\":0"); j++)
|
||||
{
|
||||
CommonSimRequest simRequest = new CommonSimRequest();
|
||||
simRequest.Accept = "application/json, text/plain, */*";
|
||||
if (Headers.ContainsKey("Accept"))
|
||||
simRequest.Accept = Headers["Accept"];
|
||||
if (Headers.ContainsKey("UserAgent"))
|
||||
simRequest.UserAgent = Headers["UserAgent"];
|
||||
var cookie = shop.Cookies;
|
||||
|
||||
//"https://fxg.jinritemai.com/product/tproduct/list?page=0&pageSize=20&group_id=&offline_type=&pay_type=&business_type=4&is_online=1&status=0&supply_status=&order_field=audit_time&sort=desc&appid=1&__token=d08f30493d071fd0e9897298c524375c&_bid=ffa_goods&_lid=711798986796&msToken=r9mNuOXDYvbtInAwLzMATC3-yIiWLcZs25f-Jt5shVW8LdugFOlMdPFOYS3_UVXhRuB7RMC4LmK-pvyBrDfSopZsXXC8yQoEGVlat6UUrxINeKzsHyLW614=&X-Bogus=DFSzsdVLBvbANcMUSU8IvKXAIQRU&_signature=_02B4Z6wo000015pLnBgAAIDC-UFcc3lE05uaT5iAAIT9acBVIU6ij4-5DpO00qPB80yCit9yg5fMFBGG9MpPGrriZuj0AXpdbbUerWeM9eMoD3aCNPK8iJeLeNxDBbAP4e3pFFOcMuEX84BO85");
|
||||
//"https://fxg.jinritemai.com/product/tproduct/list?page=0&pageSize=20&group_id=&offline_type=&pay_type=&business_type=4&is_online=1&status=1&supply_status=&order_field=offline_time&sort=desc&appid=1&__token=d08f30493d071fd0e9897298c524375c&_bid=ffa_goods&_lid=711769550666&msToken=79CxZTCGdJBocG27LuxPm9gT0QBCKI1GNci1u0AerFDnmLK0qMkau2ARZcFJx03cw2o5D5CySkojV6UCZ_riv2N36usyvdjsS2jvfE_6Z7k2sUsC2U7hJwo=&X-Bogus=DFSzsdVL5HiANcMUSU8IvVXAIQRG&_signature=_02B4Z6wo00001fJb96wAAIDAkVE3xAcLXS3yX.MAAB7zacBVIU6ij4-5DpO00qPB80yCit9yg5fMFBGG9MpPGrriZuj0AXpdbbUerWeM9eMoD3aCNPK8iJeLeNxDBbAP4e3pFFOcMuEX84BO1e");
|
||||
|
||||
var rUrl = listUrl.Replace("page=0", "page=" + i)
|
||||
.Replace("&pay_type=", "&pay_type=&sell_num_min=1");
|
||||
if (!onSale)
|
||||
rUrl = rUrl.Replace("&draft_status=0&comment_percent=", "")
|
||||
.Replace("&group_id=", "&group_id=&offline_type=")
|
||||
.Replace("&check_status=3", "")
|
||||
.Replace("&status=0", "&status=1")
|
||||
.Replace("&order_field=audit_time", "&order_field=offline_time");
|
||||
result = simRequest.Request_Get(rUrl, referrerUrl, new Dictionary<string, string>(), cookie);
|
||||
if (j > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||
}
|
||||
}
|
||||
|
||||
if (result.Contains("\"st\":0") && !cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
clearForm.isGetProductSalesSuccess = true;
|
||||
|
||||
if (total == -1)
|
||||
{
|
||||
total = BaseRegex.GetIntJson(ref result, "total");
|
||||
}
|
||||
var jObj = JObject.Parse(result);
|
||||
var jArr = jObj["data"] as JArray;
|
||||
foreach (var productObj in jArr)
|
||||
{
|
||||
var prod = JsonHelper.SerializeObject(productObj);
|
||||
var pId = BaseRegex.GetStringJson(ref prod, "product_id");
|
||||
var sales = BaseRegex.GetIntJson(ref prod, "sell_num");
|
||||
if (sales == 0)
|
||||
{
|
||||
number = 99999999;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
clearForm.dicProductSales[pId] = sales;
|
||||
}
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||
}
|
||||
else
|
||||
{
|
||||
clearForm.isGetProductSalesSuccess = false;
|
||||
webBrowser.Tag = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (number >= total)
|
||||
break;
|
||||
}
|
||||
|
||||
webBrowser.Tag = null;
|
||||
Thread.Sleep(1000);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
webBrowser.Tag = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (url.StartsWith("https://compass.jinritemai.com/compass_api/shop/product/product_overview/all_rank"))
|
||||
{
|
||||
var listUrl = url;
|
||||
var referrerUrl = iRequest.ReferrerUrl;
|
||||
var result = responseData;
|
||||
Dictionary<string, string> Headers = new Dictionary<string, string>();
|
||||
foreach (var hk in iRequest.Headers.AllKeys)
|
||||
{
|
||||
Headers[hk] = iRequest.Headers[hk];
|
||||
}
|
||||
if (webBrowser.Tag != null)
|
||||
{
|
||||
var shop = webBrowser.Tag as DouShopLoginInfo;
|
||||
var tab = this.ucTabControl1.TabPages.Cast<TabPage>().FirstOrDefault(t => t.Text == shop.ShopAccount && t.Name == "tab" + shop.ShopAccountId);
|
||||
var clearForm = tab.Controls[0] as ClearNoVisitorShopForm;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var cookies = CEFBrowser.GetCookie("", webBrowser.RequestContext.GetCookieManager(null));
|
||||
int total = -1;
|
||||
int number = 0;
|
||||
for (int i = 1; i < 10000; i++)
|
||||
{
|
||||
number += 50;
|
||||
result = "";
|
||||
for (int j = 0; j < 5 && !result.Contains("\"st\":0"); j++)
|
||||
{
|
||||
CommonSimRequest simRequest = new CommonSimRequest();
|
||||
simRequest.Accept = "application/json, text/plain, */*";
|
||||
if (Headers.ContainsKey("Accept"))
|
||||
simRequest.Accept = Headers["Accept"];
|
||||
if (Headers.ContainsKey("UserAgent"))
|
||||
simRequest.UserAgent = Headers["UserAgent"];
|
||||
var cookie = cookies;
|
||||
|
||||
//https://compass.jinritemai.com/compass_api/shop/product/product_overview/all_rank?end_date=1650931200&begin_date=1648425600&date_type=23&page_no=1&page_size=10&begin_date_format=2022-03-28T08%3A00%3A00%2B08%3A00&_lid=290001084171
|
||||
//https://compass.jinritemai.com/compass_api/shop/product/product_overview/all_rank?end_date=1650818094&begin_date=1648312494&date_type=23&page_no=2&page_size=50&index_selected=dh_product_click_pv%2Cdh_product_click_uv%2Cdh_product_show_pv%2Cdh_product_show_uv%2Cpay_cnt&begin_date_format=2022-03-27T00%3A34%3A54%2B08%3A00&_lid=909805182404");
|
||||
|
||||
var rUrl = listUrl.Replace("page_no=1", "page_no=" + i)
|
||||
.Replace("page_size=10", "page_size=50&index_selected=dh_product_click_pv%2Cdh_product_click_uv%2Cdh_product_show_pv%2Cdh_product_show_uv%2Cpay_cnt");
|
||||
|
||||
var endTime = BaseRegex.GetMatchRegexString(ref listUrl, "end_date=(\\d{2,30})");
|
||||
var beginTime = BaseRegex.GetMatchRegexString(ref listUrl, "begin_date=(\\d{2,30})");
|
||||
var beginTimeFormat = BaseRegex.GetMatchRegexString(ref listUrl, "begin_date_format=([\\s\\S]+?)&");
|
||||
if (!string.IsNullOrEmpty(endTime) && !string.IsNullOrEmpty(beginTime) && !string.IsNullOrEmpty(beginTimeFormat))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (cmbSource.Text == "近7天")
|
||||
{
|
||||
var newBeginTime = (endTime.ParseToInt() - 60 * 60 * 24 * 6).ToString();
|
||||
var beginDatetime = BaseClass.StampToDateTime(newBeginTime.ParseToInt());
|
||||
var newBeginTimeFormat = beginDatetime.ToString("s") + beginDatetime.ToString("zzz");
|
||||
rUrl = rUrl.Replace("date_type=23", "date_type=21").Replace(beginTime, newBeginTime)
|
||||
.Replace(beginTimeFormat, GetHtml.UrlEncodeUtf8(newBeginTimeFormat));
|
||||
}
|
||||
else if (cmbSource.Text == "近1天")
|
||||
{
|
||||
var newBeginTime = endTime;
|
||||
var beginDatetime = BaseClass.StampToDateTime(newBeginTime.ParseToInt());
|
||||
var newBeginTimeFormat = beginDatetime.ToString("s") + beginDatetime.ToString("zzz");
|
||||
rUrl = rUrl.Replace("date_type=23", "date_type=2").Replace(beginTime, newBeginTime)
|
||||
.Replace(beginTimeFormat, GetHtml.UrlEncodeUtf8(newBeginTimeFormat));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
result = simRequest.Request_Get(rUrl, referrerUrl, new Dictionary<string, string>(), cookie);
|
||||
if (j > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||
}
|
||||
}
|
||||
|
||||
if (result.Contains("\"st\":0") && result.Contains("\"data\"") && result.Contains("\"data_result\"") && !cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
clearForm.isGetProductVisitorSuccess = true;
|
||||
|
||||
if (total == -1)
|
||||
{
|
||||
total = BaseRegex.GetIntJson(ref result, "total");
|
||||
if (total > 10000)
|
||||
total = 10000;
|
||||
}
|
||||
var jObj = JObject.Parse(result);
|
||||
var data_result = jObj["data"]["data_result"].ToString();
|
||||
var listTemp = JsonHelper.DeserializeJsonToList<DouTradeIndexListInfo>(data_result);
|
||||
clearForm.productTradeIndexList.AddRange(listTemp);
|
||||
clearForm.productTradeIndexList = clearForm.productTradeIndexList.DistinctBy(p => p.product_id).ToList();
|
||||
|
||||
clearForm.ShowVisitorMessage("流量数据获取中:" + i + "/" + Math.Ceiling(total / 50M));
|
||||
|
||||
Thread.Sleep(Randomx.GetId(2000, 3000));
|
||||
}
|
||||
else
|
||||
{
|
||||
clearForm.isGetProductVisitorSuccess = false;
|
||||
webBrowser.Tag = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (number >= total)
|
||||
break;
|
||||
}
|
||||
|
||||
webBrowser.Tag = null;
|
||||
Thread.Sleep(1000);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
webBrowser.Tag = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStopGetProduct_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
private void rbOnSale_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.onSale = rbOnSale.Checked;
|
||||
}
|
||||
|
||||
private void lblProductName_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.webBrowser != null)
|
||||
{
|
||||
webBrowser.BringToFront();
|
||||
}
|
||||
}
|
||||
|
||||
private void lblProductName_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.webBrowser != null)
|
||||
{
|
||||
webBrowser.SendToBack();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOffLine_Click(object sender, EventArgs e)
|
||||
{
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
int i = 0;
|
||||
List<Task> tList = new List<Task>();
|
||||
foreach (TabPage tp in ucTabControl1.TabPages)
|
||||
{
|
||||
i++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在下架";
|
||||
this.statusBar.pgbTaskProgress.Value = i;
|
||||
this.statusBar.pgbTaskProgress.Text = i + "/" + ucTabControl1.TabPages.Count;
|
||||
this.statusBar.pgbTaskProgress.Maximum = ucTabControl1.TabPages.Count;
|
||||
}));
|
||||
|
||||
if (tp.Controls.Count > 0)
|
||||
{
|
||||
var clearForm = tp.Controls[0] as ClearNoVisitorShopForm;
|
||||
if (clearForm != null)
|
||||
{
|
||||
int days = this.txtUploadDays.Text.ParseToInt();
|
||||
if (days < 0 || chkUploadDays.Checked == false)
|
||||
days = 0;
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
clearForm.OffLineProduct(chkSkipHasSale.Checked, days, txtShowCount.Text.ParseToInt(), txtShowPeopleCount.Text.ParseToInt(),
|
||||
txtOrderCount.Text.ParseToInt(), txtClickTime.Text.ParseToInt(), txtClickPeople.Text.ParseToInt(), txtOperateCount.Text.ParseToInt());
|
||||
});
|
||||
tList.Add(t);
|
||||
if (tList.Count >= 10)
|
||||
Task.WaitAny(tList.ToArray());
|
||||
|
||||
var ts = tList.Where(t1 => t1.IsCompleted || t1.IsCanceled || t1.IsFaulted);
|
||||
foreach (var t1 in ts)
|
||||
{
|
||||
tList.Remove(t1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Task.WaitAll(tList.ToArray());
|
||||
tList.Clear();
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "下架中断";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "下架完成";
|
||||
}
|
||||
this.statusBar.pgbTaskProgress.Value = 0;
|
||||
this.statusBar.pgbTaskProgress.Text = 0 + "/" + 0;
|
||||
this.statusBar.pgbTaskProgress.Maximum = 0;
|
||||
}));
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
int i = 0;
|
||||
List<Task> tList = new List<Task>();
|
||||
foreach (TabPage tp in ucTabControl1.TabPages)
|
||||
{
|
||||
i++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在删除";
|
||||
this.statusBar.pgbTaskProgress.Value = i;
|
||||
this.statusBar.pgbTaskProgress.Text = i + "/" + ucTabControl1.TabPages.Count;
|
||||
this.statusBar.pgbTaskProgress.Maximum = ucTabControl1.TabPages.Count;
|
||||
}));
|
||||
|
||||
if (tp.Controls.Count > 0)
|
||||
{
|
||||
var clearForm = tp.Controls[0] as ClearNoVisitorShopForm;
|
||||
if (clearForm != null)
|
||||
{
|
||||
int days = this.txtUploadDays.Text.ParseToInt();
|
||||
if (days < 0 || chkUploadDays.Checked == false)
|
||||
days = 0;
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
clearForm.DeleteProduct(chkSkipHasSale.Checked, days, txtShowCount.Text.ParseToInt(), txtShowPeopleCount.Text.ParseToInt(),
|
||||
txtOrderCount.Text.ParseToInt(), txtClickTime.Text.ParseToInt(), txtClickPeople.Text.ParseToInt(), txtOperateCount.Text.ParseToInt());
|
||||
});
|
||||
tList.Add(t);
|
||||
if (tList.Count >= 10)
|
||||
Task.WaitAny(tList.ToArray());
|
||||
|
||||
var ts = tList.Where(t1 => t1.IsCompleted || t1.IsCanceled || t1.IsFaulted);
|
||||
foreach (var t1 in ts)
|
||||
{
|
||||
tList.Remove(t1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Task.WaitAll(tList.ToArray());
|
||||
tList.Clear();
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "删除中断";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "删除完成";
|
||||
}
|
||||
this.statusBar.pgbTaskProgress.Value = 0;
|
||||
this.statusBar.pgbTaskProgress.Text = 0 + "/" + 0;
|
||||
this.statusBar.pgbTaskProgress.Maximum = 0;
|
||||
}));
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
private void btnStopOperate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
private void btnClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (BaseMsgForm.ShowConfirm("确定要清空结果吗?清空后需要重新获取!").DialogResult == DialogResult.OK)
|
||||
{
|
||||
foreach (TabPage tp in ucTabControl1.TabPages)
|
||||
{
|
||||
if (tp.Controls.Count > 0)
|
||||
{
|
||||
var clearForm = tp.Controls[0] as ClearNoVisitorShopForm;
|
||||
if (clearForm != null)
|
||||
{
|
||||
clearForm.ClearData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void panelEx2_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var shopId in lstShopId)
|
||||
{
|
||||
var shop = GlobalConfig.DouShopLoginList.FirstOrDefault(s => s.ShopAccountId == shopId);
|
||||
if (shop == null)
|
||||
continue;
|
||||
|
||||
DouyinApi api = new DouyinApi(shop);
|
||||
var html = api.GetStatData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colAuthStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colCanUse.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,265 @@
|
||||
namespace LittleRabbit.LittleRabbitForms.ShopOptimizeForms
|
||||
{
|
||||
partial class ClearNoVisitorShopForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.dgvProduct = new LittleRabbit.UserComponent.DataGridViewEx();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.statusBar = new LittleRabbit.UserControls.StatusBarUserControl();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colProductId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colCreateTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colOrderCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShowCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShowPeopleCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colClickCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colClickPeopleCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
this.splitContainer2.Panel1.SuspendLayout();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.dgvProduct);
|
||||
this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 0);
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.label1);
|
||||
this.splitContainer2.Panel2.Controls.Add(this.statusBar);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1101, 503);
|
||||
this.splitContainer2.SplitterDistance = 473;
|
||||
this.splitContainer2.TabIndex = 8;
|
||||
//
|
||||
// dgvProduct
|
||||
//
|
||||
this.dgvProduct.AllowUserToAddRows = false;
|
||||
this.dgvProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgvProduct.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colSelect,
|
||||
this.colProductId,
|
||||
this.colProductName,
|
||||
this.colSales,
|
||||
this.colPrice,
|
||||
this.colCreateTime,
|
||||
this.colOrderCount,
|
||||
this.colShowCount,
|
||||
this.colShowPeopleCount,
|
||||
this.colClickCount,
|
||||
this.colClickPeopleCount,
|
||||
this.colMessage});
|
||||
this.dgvProduct.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgvProduct.Location = new System.Drawing.Point(4, 4);
|
||||
this.dgvProduct.Name = "dgvProduct";
|
||||
this.dgvProduct.ReadOnly = true;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.dgvProduct.RowsDefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dgvProduct.RowTemplate.Height = 23;
|
||||
this.dgvProduct.Size = new System.Drawing.Size(1093, 469);
|
||||
this.dgvProduct.TabIndex = 6;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.ForeColor = System.Drawing.Color.MidnightBlue;
|
||||
this.label1.Location = new System.Drawing.Point(656, 2);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(43, 17);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "label1";
|
||||
//
|
||||
// statusBar
|
||||
//
|
||||
this.statusBar.BackColor = System.Drawing.Color.White;
|
||||
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.statusBar.Location = new System.Drawing.Point(0, 0);
|
||||
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.statusBar.Name = "statusBar";
|
||||
this.statusBar.Size = new System.Drawing.Size(1101, 26);
|
||||
this.statusBar.TabIndex = 2;
|
||||
//
|
||||
// colSelect
|
||||
//
|
||||
this.colSelect.FillWeight = 50F;
|
||||
this.colSelect.HeaderText = "选";
|
||||
this.colSelect.Name = "colSelect";
|
||||
this.colSelect.ReadOnly = true;
|
||||
this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colSelect.Visible = false;
|
||||
this.colSelect.Width = 41;
|
||||
//
|
||||
// colProductId
|
||||
//
|
||||
this.colProductId.HeaderText = "商品Id";
|
||||
this.colProductId.Name = "colProductId";
|
||||
this.colProductId.ReadOnly = true;
|
||||
this.colProductId.Width = 150;
|
||||
//
|
||||
// colProductName
|
||||
//
|
||||
this.colProductName.HeaderText = "商品名称";
|
||||
this.colProductName.Name = "colProductName";
|
||||
this.colProductName.ReadOnly = true;
|
||||
this.colProductName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colProductName.Width = 250;
|
||||
//
|
||||
// colSales
|
||||
//
|
||||
this.colSales.HeaderText = "销量";
|
||||
this.colSales.Name = "colSales";
|
||||
this.colSales.ReadOnly = true;
|
||||
this.colSales.Width = 60;
|
||||
//
|
||||
// colPrice
|
||||
//
|
||||
this.colPrice.HeaderText = "价格";
|
||||
this.colPrice.Name = "colPrice";
|
||||
this.colPrice.ReadOnly = true;
|
||||
this.colPrice.Width = 60;
|
||||
//
|
||||
// colCreateTime
|
||||
//
|
||||
this.colCreateTime.HeaderText = "创建时间";
|
||||
this.colCreateTime.Name = "colCreateTime";
|
||||
this.colCreateTime.ReadOnly = true;
|
||||
//
|
||||
// colOrderCount
|
||||
//
|
||||
this.colOrderCount.HeaderText = "成交订单数";
|
||||
this.colOrderCount.Name = "colOrderCount";
|
||||
this.colOrderCount.ReadOnly = true;
|
||||
this.colOrderCount.Width = 90;
|
||||
//
|
||||
// colShowCount
|
||||
//
|
||||
this.colShowCount.HeaderText = "商品曝光次数";
|
||||
this.colShowCount.Name = "colShowCount";
|
||||
this.colShowCount.ReadOnly = true;
|
||||
this.colShowCount.Width = 90;
|
||||
//
|
||||
// colShowPeopleCount
|
||||
//
|
||||
this.colShowPeopleCount.HeaderText = "商品曝光人数";
|
||||
this.colShowPeopleCount.Name = "colShowPeopleCount";
|
||||
this.colShowPeopleCount.ReadOnly = true;
|
||||
this.colShowPeopleCount.Width = 90;
|
||||
//
|
||||
// colClickCount
|
||||
//
|
||||
this.colClickCount.HeaderText = "商品点击次数";
|
||||
this.colClickCount.Name = "colClickCount";
|
||||
this.colClickCount.ReadOnly = true;
|
||||
this.colClickCount.Width = 90;
|
||||
//
|
||||
// colClickPeopleCount
|
||||
//
|
||||
this.colClickPeopleCount.HeaderText = "商品点击人数";
|
||||
this.colClickPeopleCount.Name = "colClickPeopleCount";
|
||||
this.colClickPeopleCount.ReadOnly = true;
|
||||
this.colClickPeopleCount.Width = 90;
|
||||
//
|
||||
// colMessage
|
||||
//
|
||||
this.colMessage.HeaderText = "消息";
|
||||
this.colMessage.Name = "colMessage";
|
||||
this.colMessage.ReadOnly = true;
|
||||
this.colMessage.Width = 200;
|
||||
//
|
||||
// ClearNoVisitorShopForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(1101, 503);
|
||||
this.Controls.Add(this.splitContainer2);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Name = "ClearNoVisitorShopForm";
|
||||
this.Text = "ClearNoVisitorShopForm";
|
||||
this.splitContainer2.Panel1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UserControls.StatusBarUserControl statusBar;
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private UserComponent.DataGridViewEx dgvProduct;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colProductId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colCreateTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colOrderCount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShowCount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShowPeopleCount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colClickCount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colClickPeopleCount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
using AllBase;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Result;
|
||||
using LittleRabbit.LittleRabbitForms.BaseForms;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
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;
|
||||
using Work.BLL.Product;
|
||||
|
||||
namespace LittleRabbit.LittleRabbitForms.ShopOptimizeForms
|
||||
{
|
||||
public partial class ClearNoVisitorShopForm : Form
|
||||
{
|
||||
DouShopLoginInfo shop;
|
||||
public ClearNoVisitorForm clearNoVisitorForm = null;
|
||||
public bool isGetProductSalesSuccess = false;
|
||||
public bool isGetProductVisitorSuccess = false;
|
||||
public Dictionary<string, int> dicProductSales = new Dictionary<string, int>();
|
||||
public List<DouTradeIndexListInfo> productTradeIndexList = new List<DouTradeIndexListInfo>();
|
||||
List<DouProductWithSalesListInfo> productList = new List<DouProductWithSalesListInfo>();
|
||||
|
||||
public ClearNoVisitorShopForm(DouShopLoginInfo _shop)
|
||||
{
|
||||
InitializeComponent();
|
||||
shop = _shop;
|
||||
label1.Text = "";
|
||||
}
|
||||
|
||||
public void GetProduct(bool isOnline = true, decimal priceMin = 0, decimal priceMax = 99999, int salesMin = 0, int salesMax = 99999, List<string> productName = null)
|
||||
{
|
||||
if (shop == null)
|
||||
return;
|
||||
|
||||
ShowVisitorMessage("");
|
||||
foreach (DataGridViewRow r in this.dgvProduct.Rows)
|
||||
{
|
||||
r.Cells["colSales"].Value = "获取中";
|
||||
r.Cells["colOrderCount"].Value = "获取中";
|
||||
r.Cells["colShowCount"].Value = "获取中";
|
||||
r.Cells["colShowPeopleCount"].Value = "获取中";
|
||||
r.Cells["colClickCount"].Value = "获取中";
|
||||
r.Cells["colClickPeopleCount"].Value = "获取中";
|
||||
r.Cells["colMessage"].Value = "";
|
||||
}
|
||||
foreach (var p in productList)
|
||||
{
|
||||
p.sell_num = null;
|
||||
p.order_count = null;
|
||||
p.show_count = null;
|
||||
p.show_people_count = null;
|
||||
p.click_count = null;
|
||||
p.click_people_count = null;
|
||||
}
|
||||
|
||||
List<Task> tList = new List<Task>();
|
||||
|
||||
var t1 = Task.Run(() =>
|
||||
{
|
||||
int page = 0;
|
||||
int pageSize = 100;
|
||||
int totalNum = 99999;
|
||||
while (page < 100)
|
||||
{
|
||||
if (clearNoVisitorForm.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
page++;
|
||||
var html = new ShopProductBLL().GetShopProductListData(shop, isOnline ? 0 : 1, page, pageSize);
|
||||
while (!html.Contains("\"code\":10000"))
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
html = new ShopProductBLL().GetShopProductListData(shop, isOnline ? 0 : 1, page, pageSize);
|
||||
}
|
||||
totalNum = BaseRegex.GetIntJson(ref html, "total");
|
||||
|
||||
try
|
||||
{
|
||||
JObject jObj = JObject.Parse(html);
|
||||
var jObjDataStr = jObj["data"]?["data"]?.ToString();
|
||||
if (!string.IsNullOrEmpty(jObjDataStr))
|
||||
{
|
||||
var addList = JsonHelper.DeserializeJsonToList<DouProductWithSalesListInfo>(jObjDataStr);
|
||||
if (addList != null)
|
||||
{
|
||||
// 有关键词的过滤符合关键词
|
||||
if (productName != null && productName.Any())
|
||||
addList = addList.Where(p => productName.Any(key => p.name.Contains(key))).ToList();
|
||||
|
||||
productList.AddRange(addList);
|
||||
productList = productList.DistinctBy(p => p.product_id).ToList();
|
||||
}
|
||||
foreach (var prod in addList)
|
||||
{
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colProductId"].Value.ToString() == prod.product_id.ToString());
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (row == null)
|
||||
{
|
||||
|
||||
dgvProduct.Rows.Add(
|
||||
false,
|
||||
prod.product_id,
|
||||
prod.name,
|
||||
"获取中",
|
||||
prod.discount_price / 100,
|
||||
BaseClass.StampToDateTime((int)prod.create_time),
|
||||
"获取中",
|
||||
"获取中",
|
||||
"获取中",
|
||||
"获取中",
|
||||
"获取中");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSales"].Value = "获取中";
|
||||
row.Cells["colPrice"].Value = prod.discount_price / 100;
|
||||
row.Cells["colCreateTime"].Value = BaseClass.StampToDateTime((int)prod.create_time);
|
||||
row.Cells["colOrderCount"].Value = "获取中";
|
||||
row.Cells["colShowCount"].Value = "获取中";
|
||||
row.Cells["colShowPeopleCount"].Value = "获取中";
|
||||
row.Cells["colClickCount"].Value = "获取中";
|
||||
row.Cells["colClickPeopleCount"].Value = "获取中";
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
var totalPage = Math.Ceiling(totalNum / (pageSize * 1M));
|
||||
var message = "已获取:" + page + "页,共" + Math.Ceiling(totalNum / (pageSize * 1M)) + "页,在售商品获取中...";
|
||||
if (!isOnline)
|
||||
message = message.Replace("在售商品获取中", "仓库商品获取中");
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = message;
|
||||
this.statusBar.pgbTaskProgress.Value = page;
|
||||
this.statusBar.pgbTaskProgress.Text = page + "/" + totalPage;
|
||||
this.statusBar.pgbTaskProgress.Maximum = (int)totalPage;
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError("获取商品发生错误:" + ex.Message);
|
||||
}
|
||||
|
||||
if (page * pageSize >= totalNum)
|
||||
break;
|
||||
}
|
||||
});
|
||||
tList.Add(t1);
|
||||
|
||||
if (LittleRabbitForms.ShopForms.ShopListForm.Instance == null)
|
||||
LittleRabbitForms.ShopForms.ShopListForm.Instance = new LittleRabbitForms.ShopForms.ShopListForm();
|
||||
LittleRabbitForms.ShopForms.ShopListForm.Instance.CheckShopLogin(new string[] { shop.ShopAccount }, false);
|
||||
|
||||
var t2 = Task.Run(() =>
|
||||
{
|
||||
if (shop.LoginStatus == "登录成功")
|
||||
clearNoVisitorForm.GetSalesOrVisitor(this.shop);
|
||||
|
||||
var rowsTemp = dgvProduct.Rows.Cast<DataGridViewRow>().ToList();
|
||||
rowsTemp.Reverse();
|
||||
foreach (var r in rowsTemp)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (r.Cells["colPrice"].Value.ParseToDecimal() < priceMin || r.Cells["colPrice"].Value.ParseToDecimal() > priceMax
|
||||
|| r.Cells["colSales"].Value.ParseToDecimal() < salesMin || r.Cells["colSales"].Value.ParseToDecimal() > salesMax
|
||||
|| (productName?.Count > 0 && !productName.Any(n => r.Cells["colProductName"].Value.ToString().Contains(n))))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
dgvProduct.Rows.Remove(r);
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
});
|
||||
tList.Add(t2);
|
||||
t2.Wait();
|
||||
|
||||
var t3 = Task.Run(() =>
|
||||
{
|
||||
if (shop.LoginStatus == "登录成功")
|
||||
clearNoVisitorForm.GetSalesOrVisitor(this.shop, false);
|
||||
});
|
||||
tList.Add(t3);
|
||||
Task.WaitAll(tList.ToArray());
|
||||
|
||||
SetSalesCount();
|
||||
SetVisitorCount();
|
||||
|
||||
productList = productList.Where(p => p.discount_price / 100M >= priceMin && p.discount_price / 100M <= priceMax && p.sell_num >= salesMin && p.sell_num <= salesMax
|
||||
&& (productName?.Count > 0 == false || productName.Any(n => p.name.Contains(n)))).ToList();
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (clearNoVisitorForm.cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "获取中断";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "获取完成";
|
||||
}
|
||||
this.statusBar.pgbTaskProgress.Value = 0;
|
||||
this.statusBar.pgbTaskProgress.Text = 0 + "/" + 0;
|
||||
this.statusBar.pgbTaskProgress.Maximum = 0;
|
||||
}));
|
||||
var errMsg = "";
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
errMsg += " 店铺掉线,请重新登录!";
|
||||
if (shop.ApiAuthStatus != "授权成功")
|
||||
errMsg += " 授权过期,请重新授权!";
|
||||
ShowVisitorMessage(errMsg);
|
||||
}
|
||||
|
||||
public void SetSalesCount()
|
||||
{
|
||||
foreach (var key in dicProductSales.Keys)
|
||||
{
|
||||
var row = this.dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colProductId"].Value.ToString() == key);
|
||||
if (row != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colSales"].Value = dicProductSales[key];
|
||||
}));
|
||||
}
|
||||
var product = this.productList.Find(p => p.product_id.ToString() == key);
|
||||
if (product != null)
|
||||
product.sell_num = dicProductSales[key];
|
||||
}
|
||||
|
||||
foreach (DataGridViewRow row in dgvProduct.Rows)
|
||||
{
|
||||
if (row.Cells["colSales"].Value.ToString() == "获取中")
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (isGetProductSalesSuccess)
|
||||
{
|
||||
row.Cells["colSales"].Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSales"].Value = "获取失败";
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
if (isGetProductSalesSuccess)
|
||||
{
|
||||
foreach (var prod in this.productList)
|
||||
{
|
||||
if (prod.sell_num == null)
|
||||
prod.sell_num = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVisitorCount()
|
||||
{
|
||||
foreach (DouTradeIndexListInfo indexList in this.productTradeIndexList)
|
||||
{
|
||||
var row = this.dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colProductId"].Value.ToString() == indexList.product_id);
|
||||
if (row != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colOrderCount"].Value = indexList.pay_cnt.Replace(",", "").ParseToInt();
|
||||
row.Cells["colShowCount"].Value = indexList.dh_product_show_pv.Replace(",", "").ParseToInt();
|
||||
row.Cells["colShowPeopleCount"].Value = indexList.dh_product_show_uv.Replace(",", "").ParseToInt();
|
||||
row.Cells["colClickCount"].Value = indexList.dh_product_click_pv.Replace(",", "").ParseToInt();
|
||||
row.Cells["colClickPeopleCount"].Value = indexList.dh_product_click_uv.Replace(",", "").ParseToInt();
|
||||
}));
|
||||
}
|
||||
|
||||
var product = this.productList.Find(p => p.product_id.ToString() == indexList.product_id);
|
||||
if (product != null)
|
||||
{
|
||||
product.order_count = indexList.pay_cnt.Replace(",", "").ParseToInt();
|
||||
product.show_count = indexList.dh_product_show_pv.Replace(",", "").ParseToInt();
|
||||
product.show_people_count = indexList.dh_product_show_uv.Replace(",", "").ParseToInt();
|
||||
product.click_count = indexList.dh_product_click_pv.Replace(",", "").ParseToInt();
|
||||
product.click_people_count = indexList.dh_product_click_uv.Replace(",", "").ParseToInt();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (DataGridViewRow row in dgvProduct.Rows)
|
||||
{
|
||||
if (row.Cells["colOrderCount"].Value.ToString() == "获取中")
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (isGetProductVisitorSuccess)
|
||||
{
|
||||
row.Cells["colOrderCount"].Value = 0;
|
||||
row.Cells["colShowCount"].Value = 0;
|
||||
row.Cells["colShowPeopleCount"].Value = 0;
|
||||
row.Cells["colClickCount"].Value = 0;
|
||||
row.Cells["colClickPeopleCount"].Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colOrderCount"].Value = "获取失败";
|
||||
row.Cells["colShowCount"].Value = "获取失败";
|
||||
row.Cells["colShowPeopleCount"].Value = "获取失败";
|
||||
row.Cells["colClickCount"].Value = "获取失败";
|
||||
row.Cells["colClickPeopleCount"].Value = "获取失败";
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
if (isGetProductVisitorSuccess)
|
||||
{
|
||||
foreach (var prod in this.productList)
|
||||
{
|
||||
if (prod.order_count == null)
|
||||
{
|
||||
prod.order_count = 0;
|
||||
prod.show_count = 0;
|
||||
prod.show_people_count = 0;
|
||||
prod.click_count = 0;
|
||||
prod.click_people_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowVisitorMessage(string msg)
|
||||
{
|
||||
Invoke(new Action(() => { this.label1.Text = msg; }));
|
||||
}
|
||||
|
||||
public void OffLineProduct(bool skipSale = true, int days = 0, int minShowCount = 1, int minShowPeopleCount = 1, int minOrderCount = 1,
|
||||
int minClickCount = 1, int minClickPeopleTime = 1, int operateCount = 500)
|
||||
{
|
||||
int i = 0;
|
||||
var rows = this.dgvProduct.Rows.Cast<DataGridViewRow>().ToList();
|
||||
foreach (DataGridViewRow row in rows)
|
||||
{
|
||||
if (clearNoVisitorForm.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var product = productList.FirstOrDefault(p => p.product_id.ToString() == row.Cells["colProductId"].Value.ToString());
|
||||
if (product == null)
|
||||
continue;
|
||||
|
||||
bool isContinue = false;
|
||||
if (skipSale && product.sell_num > 0)
|
||||
isContinue = true;
|
||||
if (days > 0 && product.create_time > BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(0 - days)))
|
||||
isContinue = true;
|
||||
if (product.order_count >= minOrderCount)
|
||||
isContinue = true;
|
||||
if (product.show_count >= minShowCount || product.show_people_count >= minShowPeopleCount)
|
||||
isContinue = true;
|
||||
if (product.click_count >= minClickCount || product.click_people_count >= minClickPeopleTime)
|
||||
isContinue = true;
|
||||
if (product.sell_num == null || product.order_count == null || product.click_count == null)
|
||||
isContinue = true;
|
||||
|
||||
if (isContinue)
|
||||
{
|
||||
Invoke(new Action(() => { row.Cells["colMessage"].Value = "跳过"; }));
|
||||
continue;
|
||||
}
|
||||
|
||||
i++;
|
||||
if (i > operateCount)
|
||||
break;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在下架商品";
|
||||
this.statusBar.pgbTaskProgress.Value = operateCount;
|
||||
this.statusBar.pgbTaskProgress.Text = i + "/" + operateCount;
|
||||
this.statusBar.pgbTaskProgress.Maximum = operateCount;
|
||||
}));
|
||||
|
||||
var result = new ShopProductBLL().OffSaleProduct(shop, product.product_id.ToString());
|
||||
if (result.Contains("\"code\":10000"))
|
||||
Invoke(new Action(() => { row.Cells["colMessage"].Value = "下架成功"; }));
|
||||
else
|
||||
Invoke(new Action(() => { row.Cells["colMessage"].Value = "下架失败:" + BaseRegex.GetStringJson(ref result, "sub_msg"); }));
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (clearNoVisitorForm.cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "下架中断";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "下架完成";
|
||||
}
|
||||
this.statusBar.pgbTaskProgress.Value = 0;
|
||||
this.statusBar.pgbTaskProgress.Text = 0 + "/" + 0;
|
||||
this.statusBar.pgbTaskProgress.Maximum = 0;
|
||||
}));
|
||||
}
|
||||
|
||||
public void DeleteProduct(bool skipSale = true, int days = 0, int minShowCount = 1, int minShowPeopleCount = 1, int minOrderCount = 1,
|
||||
int minClickCount = 1, int minClickPeopleTime = 1, int operateCount = 500)
|
||||
{
|
||||
int i = 0;
|
||||
var rows = this.dgvProduct.Rows.Cast<DataGridViewRow>().ToList();
|
||||
foreach (DataGridViewRow row in rows)
|
||||
{
|
||||
if (clearNoVisitorForm.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var product = productList.FirstOrDefault(p => p.product_id.ToString() == row.Cells["colProductId"].Value.ToString());
|
||||
if (product == null)
|
||||
continue;
|
||||
|
||||
bool isContinue = false;
|
||||
if (skipSale && product.sell_num > 0)
|
||||
isContinue = true;
|
||||
if (days > 0 && product.create_time > BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(0 - days)))
|
||||
isContinue = true;
|
||||
if (product.order_count >= minOrderCount)
|
||||
isContinue = true;
|
||||
if (product.show_count >= minShowCount || product.show_people_count >= minShowPeopleCount)
|
||||
isContinue = true;
|
||||
if (product.click_count >= minClickCount || product.click_people_count >= minClickPeopleTime)
|
||||
isContinue = true;
|
||||
if (product.sell_num == null || product.order_count == null || product.click_count == null)
|
||||
isContinue = true;
|
||||
|
||||
if (isContinue)
|
||||
{
|
||||
Invoke(new Action(() => { row.Cells["colMessage"].Value = "跳过"; }));
|
||||
continue;
|
||||
}
|
||||
|
||||
i++;
|
||||
if (i > operateCount)
|
||||
break;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在删除商品";
|
||||
this.statusBar.pgbTaskProgress.Value = operateCount;
|
||||
this.statusBar.pgbTaskProgress.Text = i + "/" + operateCount;
|
||||
this.statusBar.pgbTaskProgress.Maximum = operateCount;
|
||||
}));
|
||||
|
||||
var result = new ShopProductBLL().DeleteProduct(shop, product.product_id.ToString());
|
||||
if (result.Contains("\"code\":10000"))
|
||||
Invoke(new Action(() => { row.Cells["colMessage"].Value = "删除成功"; }));
|
||||
else
|
||||
Invoke(new Action(() => { row.Cells["colMessage"].Value = "删除失败:" + BaseRegex.GetStringJson(ref result, "sub_msg"); }));
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (clearNoVisitorForm.cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "删除中断";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "删除完成";
|
||||
}
|
||||
this.statusBar.pgbTaskProgress.Value = 0;
|
||||
this.statusBar.pgbTaskProgress.Text = 0 + "/" + 0;
|
||||
this.statusBar.pgbTaskProgress.Maximum = 0;
|
||||
}));
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
this.productList.Clear();
|
||||
this.productTradeIndexList.Clear();
|
||||
this.dicProductSales.Clear();
|
||||
this.dgvProduct.Rows.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colProductId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSales.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colCreateTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colOrderCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShowCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShowPeopleCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colClickCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colClickPeopleCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,164 @@
|
||||
namespace LittleRabbit.LittleRabbitForms.ShopOptimizeForms
|
||||
{
|
||||
partial class OptimizeForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("清理无流量");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("店铺优化", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1});
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tv = new LittleRabbit.UserComponent.UcTreeView();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.lblName = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tv);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.panel1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(934, 561);
|
||||
this.splitContainer1.SplitterDistance = 140;
|
||||
this.splitContainer1.SplitterWidth = 1;
|
||||
this.splitContainer1.TabIndex = 7;
|
||||
//
|
||||
// tv
|
||||
//
|
||||
this.tv.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
|
||||
this.tv.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.tv.ChildNodeSelectedBgColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.tv.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.tv.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tv.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll;
|
||||
this.tv.ExpandButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.tv.FullRowSelect = true;
|
||||
this.tv.GroupBgColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(249)))), ((int)(((byte)(249)))));
|
||||
this.tv.GroupFont = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tv.GroupTitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||
this.tv.HideCollapsedGroup = false;
|
||||
this.tv.ItemHeight = 32;
|
||||
this.tv.Location = new System.Drawing.Point(0, 0);
|
||||
this.tv.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.tv.Name = "tv";
|
||||
treeNode1.Name = "清理无流量";
|
||||
treeNode1.Text = "清理无流量";
|
||||
treeNode2.Name = "店铺优化";
|
||||
treeNode2.Text = "店铺优化";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode2});
|
||||
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
|
||||
this.tv.Size = new System.Drawing.Size(140, 561);
|
||||
this.tv.TabIndex = 4;
|
||||
this.tv.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterSelect);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.White;
|
||||
this.panel1.Controls.Add(this.panel3);
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(793, 561);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel3.Location = new System.Drawing.Point(0, 28);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(793, 533);
|
||||
this.panel3.TabIndex = 1;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.panel2.Controls.Add(this.lblName);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(793, 28);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// lblName
|
||||
//
|
||||
this.lblName.AutoSize = true;
|
||||
this.lblName.Location = new System.Drawing.Point(5, 6);
|
||||
this.lblName.Name = "lblName";
|
||||
this.lblName.Size = new System.Drawing.Size(57, 17);
|
||||
this.lblName.TabIndex = 0;
|
||||
this.lblName.Text = "lblName";
|
||||
//
|
||||
// OptimizeForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(934, 561);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Name = "OptimizeForm";
|
||||
this.Text = "OptimizeForm";
|
||||
this.Load += new System.EventHandler(this.OptimizeForm_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private UserComponent.UcTreeView tv;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label lblName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
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.ShopOptimizeForms
|
||||
{
|
||||
public partial class OptimizeForm : Form
|
||||
{
|
||||
public Lazy<ClearNoVisitorForm> clearNoVisitorForm = new Lazy<ClearNoVisitorForm>();
|
||||
public OptimizeForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OptimizeForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
tv.SelectedNode = tv.Nodes[0].Nodes[0];
|
||||
tv.ExpandGroup(tv.Nodes[0].Name);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 显示隐藏层
|
||||
/// </summary>
|
||||
/// <param name="f"></param>
|
||||
private void SetForm(Form f)
|
||||
{
|
||||
if (f == null)
|
||||
{
|
||||
foreach (Control form in panel3.Controls)
|
||||
{
|
||||
form.Visible = false;
|
||||
if (form is Form)
|
||||
{
|
||||
panel3.Controls.Remove(form as Form);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool had = false;
|
||||
string sCurrentFormName = f.Name;
|
||||
for (int i = 0; i < panel3.Controls.Count; i++)
|
||||
{
|
||||
if (sCurrentFormName == panel3.Controls[i].Name)
|
||||
{
|
||||
had = true;
|
||||
panel3.Controls[i].Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
panel3.Controls[i].Visible = false;
|
||||
}
|
||||
}
|
||||
if (had)
|
||||
{
|
||||
f = null;
|
||||
return;
|
||||
}
|
||||
f.TopLevel = false;
|
||||
f.Left = 0;
|
||||
f.Top = 0;
|
||||
f.FormBorderStyle = FormBorderStyle.None;
|
||||
panel3.Controls.Add(f);
|
||||
f.AutoSize = true;
|
||||
f.Dock = DockStyle.Fill;
|
||||
f.Show();
|
||||
}
|
||||
|
||||
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
MainForm.sCurrentModule = e.Node.Name;
|
||||
this.lblName.Text = e.Node.Text;
|
||||
// 如果是一级菜单,不做任何动作
|
||||
if (e.Node.Parent == null) return;
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
switch (e.Node.Name)
|
||||
{
|
||||
case "解除限制":
|
||||
SetForm(clearNoVisitorForm.Value);
|
||||
break;
|
||||
//case "商品管理":
|
||||
// SetForm(shopProductForm.Value);
|
||||
// break;
|
||||
}
|
||||
}));
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in new issue
Block a user