1活动逻辑调整 2拼多多买手号存储

This commit is contained in:
wule committed 2026-04-09 21:58:20 +08:00
1 parent 2df3769153
commit fa96cc1444
22 files changed
+3251 -1167

No files matched your search

+142
View File
@@ -0,0 +1,142 @@
using AllBase;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace TemuKJD.BLL
{
public class YkdHttpResponseBLL
{
public static string YangkeduoPostResponse(BuyerLoginInfo buyer, string _url, string _data, string referer)
{
string cookies = "";
try
{
var cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(buyer?.cookie.ParseToString());
if (cookieLst == null)
cookieLst = new List<CefSharp.Cookie>();
foreach (var cook in cookieLst)
{
cookies += cook.Name + "=" + cook.Value + ";";
}
}
catch { }
HttpWebResponse response = null;
string result;
try
{
string url = _url;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Accept = "application/json, text/plain, */*";
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
//request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = _data;
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = GetProxyHtml.ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = GetProxyHtml.ReadResponse(response);
return result;
}
public static string YangkeduoGetResponse(BuyerLoginInfo buyer, string _url, string referer = "")
{
string cookies = "";
try
{
var cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(buyer?.cookie.ParseToString());
if (cookieLst == null)
cookieLst = new List<CefSharp.Cookie>();
foreach (var cook in cookieLst)
{
cookies += cook.Name + "=" + cook.Value + ";";
}
}
catch { }
HttpWebResponse response = null;
string result;
try
{
string url = _url;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Accept = "application/json, text/plain, */*";
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
//request.Referer = "https://mobile.yangkeduo.com/goods.html?goods_id=668777537796&_oak_rcto=YWKWG77VXtDidZlaaAew84Hjoi0WMIkr6Sb3iSrTsNPiwhxdCIE-1DEr&_oc_trace_mark=199&_oc_adinfo=eyJwYWdlX3NuIjoxMDAwMiwic2NlbmVfaWQiOjUwNn0%3D&_oak_gallery_token=49fa7eda1bcf57d32ea05e34565ca727&_oak_gallery=https%3A%2F%2Fimg.pddpic.com%2Fmms-material-img%2F2025-08-19%2F74364405-4d67-4d13-ad64-1712f70865db.jpeg.a.jpeg&_oc_refer_ad=1&page_from=35&thumb_url=https%3A%2F%2Fimg.pddpic.com%2Fmms-material-img%2F2025-08-19%2F74364405-4d67-4d13-ad64-1712f70865db.jpeg.a.jpeg%3FimageMogr2%2Fthumbnail%2F400x%257CimageView2%2F2%2Fw%2F400%2Fq%2F80%2Fformat%2Fwebp&refer_page_name=index&refer_page_id=10002_1775730536937_hocm3gfy6j&refer_page_sn=10002&uin=CFS2K7V47GEISCE6TLYY6HRWPI_GEXDA";
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = GetProxyHtml.ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = GetProxyHtml.ReadResponse(response);
return result;
}
}
}
+16 -5
View File
@@ -130,6 +130,7 @@
<Compile Include="BLL\ProductSelectBLL.cs" />
<Compile Include="BLL\Tools\DownloadBLL.cs" />
<Compile Include="BLL\WxApiBLL.cs" />
<Compile Include="BLL\YkdHttpResponseBLL.cs" />
<Compile Include="BLL\WXHttpResponseBLL.cs" />
<Compile Include="BLL\WxProdFormConverter.cs" />
<Compile Include="BLL\_1688HttpResponseBLL.cs" />
@@ -154,6 +155,7 @@
<Compile Include="PDDForms\ProductForms\ActivityForms\PDDAddActivityForm.Designer.cs">
<DependentUpon>PDDAddActivityForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ProductForms\WXProdViolationManage.cs" />
<Compile Include="PDDForms\ProductSelectForms\PDDGetChanceProdByImgForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -195,6 +197,12 @@
<Compile Include="ToolForms\ImgToolForm.Designer.cs">
<DependentUpon>ImgToolForm.cs</DependentUpon>
</Compile>
<Compile Include="ToolForms\PddMobileLoginForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ToolForms\PddMobileLoginForm.Designer.cs">
<DependentUpon>PddMobileLoginForm.cs</DependentUpon>
</Compile>
<Compile Include="ToolForms\WebForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -1157,11 +1165,11 @@
<Compile Include="WXForms\TalkForms\WxTalkForm.Designer.cs">
<DependentUpon>WxTalkForm.cs</DependentUpon>
</Compile>
<Compile Include="WXForms\TalkForms\WxOrderListForm.cs">
<Compile Include="WXForms\TalkForms\BuyerOrderListForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WXForms\TalkForms\WxOrderListForm.Designer.cs">
<DependentUpon>WxOrderListForm.cs</DependentUpon>
<Compile Include="WXForms\TalkForms\BuyerOrderListForm.Designer.cs">
<DependentUpon>BuyerOrderListForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="BaseForms\BaseTalkForm.resx">
<DependentUpon>BaseTalkForm.cs</DependentUpon>
@@ -1193,6 +1201,9 @@
<EmbeddedResource Include="ToolForms\ImgToolForm.resx">
<DependentUpon>ImgToolForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ToolForms\PddMobileLoginForm.resx">
<DependentUpon>PddMobileLoginForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ToolForms\WebForm.resx">
<DependentUpon>WebForm.cs</DependentUpon>
</EmbeddedResource>
@@ -1645,8 +1656,8 @@
<EmbeddedResource Include="WXForms\TalkForms\WxTalkForm.resx">
<DependentUpon>WxTalkForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="WXForms\TalkForms\WxOrderListForm.resx">
<DependentUpon>WxOrderListForm.cs</DependentUpon>
<EmbeddedResource Include="WXForms\TalkForms\BuyerOrderListForm.resx">
<DependentUpon>BuyerOrderListForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<ProjectView>ShowAllFiles</ProjectView>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
@@ -32,16 +32,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtSleepTime = new System.Windows.Forms.TextBox();
this.chk23456 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chk23730 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkDownNoPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -103,6 +106,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.chk23513 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chk15996 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtTest20981 = new System.Windows.Forms.TextBox();
this.btnTest20981 = new DevComponents.DotNetBar.PanelEx();
@@ -185,6 +189,9 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
| System.Windows.Forms.AnchorStyles.Right)));
this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx2.Controls.Add(this.label5);
this.ucGroupBoxEx2.Controls.Add(this.label3);
this.ucGroupBoxEx2.Controls.Add(this.txtSleepTime);
this.ucGroupBoxEx2.Controls.Add(this.chk23456);
this.ucGroupBoxEx2.Controls.Add(this.chk23730);
this.ucGroupBoxEx2.Controls.Add(this.chkDownNoPrice);
@@ -220,6 +227,38 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "活动价格配置";
//
// label5
//
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(831, 18);
this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(20, 17);
this.label5.TabIndex = 893;
this.label5.Text = "秒";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(713, 18);
this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 17);
this.label3.TabIndex = 892;
this.label3.Text = "报名休眠间隔";
//
// txtSleepTime
//
this.txtSleepTime.Location = new System.Drawing.Point(793, 15);
this.txtSleepTime.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtSleepTime.Name = "txtSleepTime";
this.txtSleepTime.Size = new System.Drawing.Size(38, 23);
this.txtSleepTime.TabIndex = 891;
this.txtSleepTime.Text = "5";
this.txtSleepTime.TextChanged += new System.EventHandler(this.txtSleepTime_TextChanged);
//
// chk23456
//
this.chk23456.AutoSize = true;
@@ -947,6 +986,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.chk23513);
this.splitContainer2.Panel2.Controls.Add(this.chk15996);
this.splitContainer2.Panel2.Controls.Add(this.txtTest20981);
this.splitContainer2.Panel2.Controls.Add(this.btnTest20981);
@@ -974,19 +1014,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1100,6 +1140,18 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.colMessage.Name = "colMessage";
this.colMessage.ReadOnly = true;
//
// chk23513
//
this.chk23513.AutoSize = true;
this.chk23513.Location = new System.Drawing.Point(234, 38);
this.chk23513.Name = "chk23513";
this.chk23513.Size = new System.Drawing.Size(62, 21);
this.chk23513.TabIndex = 891;
this.chk23513.Text = "23513";
this.chk23513.UseVisualStyleBackColor = true;
this.chk23513.Visible = false;
this.chk23513.CheckedChanged += new System.EventHandler(this.chkActivityDetail_CheckedChanged);
//
// chk15996
//
this.chk15996.AutoSize = true;
@@ -1179,19 +1231,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
this.dgvActProduct.AllowUserToAddRows = false;
this.dgvActProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvActProduct.AutoRowNumber = true;
this.dgvActProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvActProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvActProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvActProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1240,8 +1292,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colSupplierName
//
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1296,8 +1348,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colProductName
//
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -1324,8 +1376,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colUpdateTime
//
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colUpdateTime.FillWeight = 80F;
this.colUpdateTime.HeaderText = "上架时间";
this.colUpdateTime.Name = "colUpdateTime";
@@ -1341,8 +1393,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colOpResult
//
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8;
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
@@ -1580,5 +1632,9 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private UserComponent.UcCheckBox chk23730;
private UserComponent.UcCheckBox chk23456;
private UserComponent.UcCheckBox chk23513;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtSleepTime;
}
}
@@ -39,7 +39,6 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
bool isChanceApi = true;
bool isStepAddPrice = false;
CheckBox chkSelectAll = null;
Dictionary<ShopLoginInfo, int> dicShopGetCount = new Dictionary<ShopLoginInfo, int>();
@@ -116,10 +115,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
pddActivityRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<PddAddActivityRule>("pdd_add_activity_rule");
if (pddActivityRule == null)
pddActivityRule = new PddAddActivityRule();
this.chk20981.Checked = pddActivityRule.sign20981;
this.chk15996.Checked = pddActivityRule.sign15996;
this.chk21365.Checked = pddActivityRule.sign21365;
this.chk22347.Checked = pddActivityRule.sign22347;
this.chk20981.Checked = pddActivityRule.sign20981;
this.chk21365.Checked = pddActivityRule.sign21365;
this.chk15996.Checked = pddActivityRule.sign15996;
this.chk23513.Checked = pddActivityRule.sign23513;
this.chk23730.Checked = pddActivityRule.sign23730;
this.chk23456.Checked = pddActivityRule.sign23456;
this.chkUseExtCodePrice.Checked = pddActivityRule.IsUseExtCodePrice;
@@ -376,8 +376,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
/// <param name="shop"></param>
/// <param name="prodParam"></param>
/// <returns></returns>
public string SignActivity(ShopLoginInfo shop, PDDProductUploadParam prodParam, bool sign22347 = true, bool sign20981 = true, bool sign21365 = true, bool sign15996 = true,
bool sign23730 = true, bool sign23456 = true)
public string SignActivity(ShopLoginInfo shop, PDDProductUploadParam prodParam, bool sign22347 = true, bool sign20981 = true, bool sign21365 = true,
bool sign15996 = true, bool sign23513 = true, bool sign23730 = true, bool sign23456 = true)
{
string activityErr = "";
@@ -405,6 +405,12 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
activityErr += SignActivity22347(shop, prodParam);
}
// 23513 补贴多人团频道 需要设置营销电话,暂时作废
if (1==2 && sign23513)
{
activityErr += SignActivity23513(shop, prodParam);
}
// 超级晚8 单件折扣
if (1 == 1 && sign23730)
{
@@ -436,10 +442,16 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
{
string activityErr = "";
var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && !activityRst2.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst2.Contains("\"success\":true"))
{
@@ -553,12 +565,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string CheckActivity20981(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && !activityRst1.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst1.Contains("\"success\":true"))
{
@@ -619,12 +633,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity20981(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && !activityRst1.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst1.Contains("\"success\":true"))
{
@@ -731,6 +747,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 20981, 27);
}
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
@@ -758,8 +775,9 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity15996(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst3 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 15996, 18);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
if (!activityRst3.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref activityRst3, "error_msg");
@@ -861,12 +879,17 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity22347(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
if (!activityRst2.Contains("\"success\":true"))
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst2.Contains("\"success\":true"))
{
@@ -968,6 +991,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 22347, 27);
}
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
@@ -992,18 +1016,166 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
return activityErr;
}
string SignActivity23513(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 23513, 414);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
if (!activityRst2.Contains("\"success\":true"))
{
activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 23513, 414);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst2.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref activityRst2, "error_msg");
if (string.IsNullOrEmpty(error))
error = activityRst2;
activityErr += "\r\n报名错误 513查询失败 " + error;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
try
{
var jObj = JObject.Parse(activityRst2);
var jStr = JsonHelper.SerializeObject(jObj["result"]);
var pddActivitiPriceInfo = JsonHelper.DeserializeJsonToObject<PDDActivitySuggestPriceInfo>(jStr);
var pddActivitiPriceProd = pddActivitiPriceInfo.enroll_goods_rule_vos.FirstOrDefault();
if (pddActivitiPriceProd == null)
{
activityErr += "\r\n报名错误 513查询/新建失败 商品未提交成功或不满足参加活动条件";
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
foreach (var activitySkuInfo in pddActivitiPriceProd.enroll_rule_param.enroll_goods_resource_price.sku_info_list)
{
//var sku = prodParam.skus.FirstOrDefault(s => s.sku_id == activitySku.sku_id);
var sku = prodParam.skus.FirstOrDefault(sk => string.Join(",", sk.spec.Select(s => s.spec_name)) == activitySkuInfo.spec_info_str);
if (sku == null || sku.multi_price > activitySkuInfo.require_price)
{
activityErr += "\r\n报名错误 513价格低于产品价 " + activitySkuInfo.require_price + " < " + sku.multi_price;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
}
PDDActivitySubmitParam actSubmitParam = new PDDActivitySubmitParam();
actSubmitParam.activity_id = pddActivitiPriceInfo.activity_id;
actSubmitParam.enroll_source_ctx.enroll_type = 3;
actSubmitParam.enroll_source_ctx.scene_full_coverage = "mmsActBatchEnrollV1";
actSubmitParam.enroll_source_ctx.source_type = null;
actSubmitParam.enroll_source_ctx.scene_type = null;
var goods_vo_item = new goods_vo_param();
goods_vo_item.goods_id = prodParam.goods_id;
var skuSamePrice = prodParam.skus.Max(s => s.multi_price);
foreach (var activitySkuInfo in pddActivitiPriceProd.enroll_rule_param.enroll_goods_resource_price.sku_info_list)
{
//var sku = prodParam.skus.FirstOrDefault(s => s.sku_id == activitySku.sku_id);
var sku = prodParam.skus.FirstOrDefault(sk => string.Join(",", sk.spec.Select(s => s.spec_name)) == activitySkuInfo.spec_info_str);
if (sku == null)
{
activityErr += "\r\n报名错误 513价格sku未找到";
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
create_sku_vo_param sku_vo_item = new create_sku_vo_param();
sku_vo_item.sku_id = activitySkuInfo.sku_id;
sku_vo_item.sku_activity_price = sku.multi_price; //skuSamePrice; //sku.multi_price; //activitySku.suggest_price;
sku_vo_item.sku_front_ctx_vo = new sku_front_ctx_vo_param()
{
filling_sku_price = sku.multi_price,
gear_rule = activitySkuInfo.gear_rule,
require_price = sku.multi_price,
filling_sku_price_gear_rule = activitySkuInfo.filling_sku_price_gear_rule,
};
goods_vo_item.create_activity_price_vo.create_sku_vos.Add(sku_vo_item);
}
actSubmitParam.goods_volist.Add(goods_vo_item);
// 设置活动库存
goods_vo_item.create_activity_price_vo.create_quantity_vo.goods_activity_quantity =
pddActivitiPriceInfo.enroll_goods_rule_vos.FirstOrDefault().enroll_rule_param.enroll_goods_resource_price.goods_on_sale_quantity;
// 活动列表图
goods_vo_item.create_material_vo.create_goods_image_vo.raw_activity_image_url = prodParam.gallery.FirstOrDefault(g => g.type == 1).url;
actSubmitParam.create_protocol_vo.need_create_cost_template = true;
//if (pddActivitiInfo.need_goods_activity_price == true)
actSubmitParam.goods_volist.FirstOrDefault().view_confirmed_goods_protocol_vo.confirm_hit_cut_price = true;
var addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 23513, 414);
var err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (err_msg.ParseToString().Contains("报名该活动需要签署降价补差协议,立即前往链接签署"))
{
Invoke(new Action(() =>
{
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm.openType = EnumOpenType.manage;
loginForm.InitUrl = err_msg.Substring(err_msg.IndexOf("https://")); //"https://mms.pinduoduo.com/mallcenter/signProtocol/21";
loginForm.ShowDialog();
}));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 23513, 414);
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
}
for (int i = 0; i < 3 && !addActivityRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 23513, 414);
}
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = addActivityRst;
activityErr += "\r\n报名错误 513新建失败 " + error;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
} // 活动1
catch (Exception ex)
{
activityErr += "\r\n报名错误 513查询/新建失败 " + ex.Message;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
activityErr = "\r\n513报名成功";
return activityErr;
}
/// <summary>
/// 超级晚8 单件折扣
/// </summary>
string SignActivity23730(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst3 = activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23730, 424);
if (!activityRst3.Contains("\"success\":true"))
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && activityRst3.Contains("频繁"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23730, 424);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst3.Contains("\"success\":true"))
{
@@ -1037,7 +1209,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
if (mmsEnrollParamsInfo.max_discount_threshold.ParseToInt() < 98)
{
activityErr += "\r\n放弃报名 730最大折扣 " + mmsEnrollParamsInfo.max_discount_threshold + " 折低于 98 折 ";
activityErr += "\r\n放弃报名 730 最大折扣 " + mmsEnrollParamsInfo.max_discount_threshold + " 折低于 98 折 ";
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
return activityErr;
@@ -1086,7 +1258,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParamV2, prodParam.goods_id.ParseToString(), 23730, 424);
}
if (!addActivityRst.Contains("\"success\":true"))
var err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (string.IsNullOrEmpty(error))
@@ -1117,12 +1290,17 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity23456(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst3 = activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23456, 422);
if (!activityRst3.Contains("\"success\":true"))
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 1; i < 5 && activityRst3.Contains("频繁"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23456, 422);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst3.Contains("\"success\":true"))
{
@@ -1205,7 +1383,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParamV2, prodParam.goods_id.ParseToString(), 23456, 422);
}
if (!addActivityRst.Contains("\"success\":true"))
var err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (string.IsNullOrEmpty(error))
@@ -2155,10 +2334,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
// chkActivity.Checked = false;
if (IsLoadComplate)
{
pddActivityRule.sign20981 = chk20981.Checked;
pddActivityRule.sign15996 = chk15996.Checked;
pddActivityRule.sign21365 = chk21365.Checked;
pddActivityRule.sign22347 = chk22347.Checked;
pddActivityRule.sign20981 = chk20981.Checked;
pddActivityRule.sign21365 = chk21365.Checked;
pddActivityRule.sign15996 = chk15996.Checked;
pddActivityRule.sign23513 = chk23513.Checked;
pddActivityRule.sign23730 = chk23730.Checked;
pddActivityRule.sign23456 = chk23456.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_add_activity_rule", pddActivityRule);
@@ -2301,6 +2481,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
try
{
prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
actProd.productInfo = prodInfo;
}
catch (Exception ex)
{
@@ -2482,6 +2663,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
PDDProductUploadParam prodParam = new PDDProductUploadParam();
prodParam.goods_id = actProd.goods_id;
prodParam.gallery = JsonHelper.DeserializeJsonToList<gallery_param>(JsonHelper.SerializeObject(actProd.productInfo.detail.galleries));
// 生成正常加价的sku列表
int index = -1;
@@ -2520,14 +2702,15 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
prodParam.skus.Add(skuParam);
}
bool sign20981 = chk20981.Checked && chk20981.Visible;
bool sign22347 = chk22347.Checked && chk22347.Visible;
bool sign15996 = chk15996.Checked && chk15996.Visible;
bool sign20981 = chk20981.Checked && chk20981.Visible;
bool sign21365 = chk21365.Checked && chk21365.Visible;
bool sign15996 = chk15996.Checked && chk15996.Visible;
bool sign23513 = chk23513.Checked && chk23513.Visible;
bool sign23730 = chk23730.Checked && chk23730.Visible;
bool sign23456 = chk23456.Checked && chk23456.Visible;
if ((sign20981 || sign22347 || sign15996 || sign21365 || sign23730 || sign23456) == false)
if ((sign22347 || sign20981 || sign21365 || sign15996 || sign23513 || sign23730 || sign23456) == false)
{
Invoke(new Action(() =>
{
@@ -2620,10 +2803,20 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}
}
string activityErr = SignActivity(shop, prodParam, sign22347, sign20981, sign21365, sign15996, sign23730, sign23456);
string activityRsts = SignActivity(shop, prodParam, sign22347, sign20981, sign21365, sign15996, sign23513, sign23730, sign23456);
var activityRstArr = activityRsts.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
var actSuccessStr = "";
var actFailStr = "";
foreach (var actRst in activityRstArr)
{
if (actRst.Contains("报名成功"))
actSuccessStr += " " + actRst;
else
actFailStr += "\r\n" + actRst;
}
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = activityErr.Trim('\r', '\n');
row.Cells["colOpResult"].Value = (actSuccessStr + actFailStr).Trim('\r', '\n', ' ');
}));
}
catch (Exception ex)
@@ -2730,6 +2923,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}
}
}
public decimal moreSleepTime = 5;
private void txtSleepTime_TextChanged(object sender, EventArgs e)
{
moreSleepTime = txtSleepTime.Text.Trim().ParseToDecimal();
if (moreSleepTime < 5)
moreSleepTime = 5;
}
}
public class PddAddActivityRule
@@ -2746,11 +2947,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
public bool IsUseExtCodePrice { get; set; }
public bool sign20981 { get; set; }
public bool sign22347 { get; set; }
public bool sign15996 { get; set; }
public bool sign20981 { get; set; }
public bool sign21365 { get; set; }
public bool sign15996 { get; set; }
public bool sign23513 { get; set; }
/// <summary>
/// 折扣活动1
/// </summary>
public bool sign23730 { get; set; }
/// <summary>
/// 折扣活动2
/// </summary>
public bool sign23456 { get; set; }
}
}
@@ -0,0 +1,172 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TemuKJD.BLL;
using TemuKJD.WXForms.ProductForms;
using Work;
namespace TemuKJD.PDDForms.ProductForms
{
public class WXProdViolationManage
{
public static void GetShopProdViolation()
{
Task.Run(() =>
{
if (!Directory.Exists("wxProdViolation"))
Directory.CreateDirectory("wxProdViolation");
while (true)
{
//break;
foreach (var shop in GlobalConfig.ShopLoginList)
{
if (shop.LoginStatus != "登录成功")
continue;
Thread.Sleep(Randomx.GetId(500, 1500));
WXProdViolationGetInfo info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
try
{
info = NaiBa.Util.Helper.ConfigHelper.LoadConfig<WXProdViolationGetInfo>("wxProdViolation\\" + shop.ShopId);
if (info == null)
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.MinValue.ToString("yyMMdd") };
if (info.updateDay == DateTime.Now.ToString("yyMMdd"))
{
// 今日同步过,跳过
continue;
}
info.failReason = "";
var result = getShopiolationProd(shop);
Thread.Sleep(Randomx.GetId(1000, 2000));
if (!result.Contains("\"code\":0"))
{
WXForms.ShopForms.WXShopListForm.CheckShopLogin(shop);
info.failReason = "读取失败";
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
continue;
}
JObject recordObj = JsonHelper.JObjectParse(result)["record"] as JObject;
JArray jArr = JsonHelper.JObjectParse(result)["record"]["items"] as JArray;
if (recordObj != null && jArr == null)
{
jArr = new JArray();
}
foreach(var jObj in jArr)
{
string sVioInfo = JsonHelper.SerializeObject(jObj);
var punishUuid = BaseRegex.GetStringJson(ref sVioInfo, "punishUuid");
var punishReason = BaseRegex.GetStringJson(ref sVioInfo, "punishReason");
var productId = BaseRegex.GetStringJson(ref sVioInfo, "productId");
var productDesc = BaseRegex.GetStringJson(ref sVioInfo, "productDesc");
//相似同款低质商品 品牌资质问题 不当使用他人权利
if (!punishReason.Contains("发布违禁信息") && !punishReason.Contains("材质夸大宣传") &&
!punishReason.Contains("价格违规") && !punishReason.Contains("售假"))
continue;
if (!string.IsNullOrWhiteSpace(productDesc) && !string.IsNullOrWhiteSpace(productId))
{
var url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
var data = UserLogin.GetSignaturex();
data += "&wx_safe_status=违规商品";
data += "&notes=" + ("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason).Trim();
data += "&product_name=" + productDesc;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
info.failReason = "更新商品状态失败";
break;
}
if(html.Contains("商品不存在"))
{
var getProdRst = WXUpload.searchProductWithTitle(shop, GetHtml.UrlEncodeUtf8(productDesc));
var spuCode = BaseRegex.GetStringJson(ref getProdRst, "spuCode");
var secrec_spu_id = "";
var spu_id = "";
if (string.IsNullOrEmpty(spuCode) || spuCode.Length < 10)
{
continue;
}
if (spuCode.StartsWith("EC1") && spuCode.EndsWith("A"))
{
spu_id = spuCode.Substring(3, spuCode.Length - 4);
}
else
{
secrec_spu_id = spuCode;
}
url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
data = UserLogin.GetSignaturex();
data += "&wx_safe_status=违规商品";
data += "&notes=" + ("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason).Trim();
data += "&secret_spu_id=" + secrec_spu_id;
data += "&spu_id=" + spu_id;
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
info.failReason = "更新商品状态失败";
break;
}
}
}
}
if (string.IsNullOrEmpty(info.failReason))
info.updateDay = DateTime.Now.ToString("yyMMdd");
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
Thread.Sleep(5000);
}
catch (Exception ex)
{
try
{
if (info == null)
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
info.failReason = ex.Message;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
}
catch { }
}
}
// 休眠一小时
Thread.Sleep(1000 * 60 * 60);
}
});
}
public static string getShopiolationProd(ShopLoginInfo shop)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeviolationsec/violation/cgi/get?token=&lang=zh_CN&violationType=finder&shopId=";
string referer = "https://store.weixin.qq.com/shop/violation/home";
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
return result;
}
}
public class WXProdViolationGetInfo
{
public string shopId { get; set; }
public string updateDay { get; set; } // yyMMdd
public string failReason { get; set; } // "", "掉线"...
}
}
@@ -30,13 +30,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle49 = new System.Windows.Forms.DataGridViewCellStyle();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkChance = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -109,7 +110,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtIdFilter = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.cmbCateFilter1 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
this.panelEx2 = new DevComponents.DotNetBar.PanelEx();
this.btnRandomAdd = new DevComponents.DotNetBar.PanelEx();
this.label2 = new System.Windows.Forms.Label();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
@@ -1041,7 +1042,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx4.Controls.Add(this.txtIdFilter);
this.ucGroupBoxEx4.Controls.Add(this.label1);
this.ucGroupBoxEx4.Controls.Add(this.cmbCateFilter1);
this.ucGroupBoxEx4.Controls.Add(this.panelEx2);
this.ucGroupBoxEx4.Controls.Add(this.btnRandomAdd);
this.ucGroupBoxEx4.Controls.Add(this.label2);
this.ucGroupBoxEx4.Controls.Add(this.cmbGroupFilter);
this.ucGroupBoxEx4.Controls.Add(this.label20);
@@ -1253,30 +1254,30 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbCateFilter1.SelectedIndexChanged += new System.EventHandler(this.cmbCateFilter1_SelectedIndexChanged);
this.cmbCateFilter1.TextChanged += new System.EventHandler(this.cmbCateFilter1_TextChanged);
//
// panelEx2
// btnRandomAdd
//
this.panelEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.panelEx2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx2.Cursor = System.Windows.Forms.Cursors.Hand;
this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panelEx2.Location = new System.Drawing.Point(274, 105);
this.panelEx2.Name = "panelEx2";
this.panelEx2.Size = new System.Drawing.Size(62, 23);
this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx2.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.panelEx2.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.panelEx2.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.panelEx2.Style.ForeColor.Color = System.Drawing.Color.White;
this.panelEx2.Style.GradientAngle = 90;
this.panelEx2.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx2.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.panelEx2.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.panelEx2.TabIndex = 431;
this.panelEx2.Text = "随机添加";
this.panelEx2.Click += new System.EventHandler(this.btnRandomAdd_Click);
this.btnRandomAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRandomAdd.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnRandomAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRandomAdd.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRandomAdd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRandomAdd.Location = new System.Drawing.Point(274, 105);
this.btnRandomAdd.Name = "btnRandomAdd";
this.btnRandomAdd.Size = new System.Drawing.Size(62, 23);
this.btnRandomAdd.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnRandomAdd.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRandomAdd.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRandomAdd.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnRandomAdd.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnRandomAdd.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnRandomAdd.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnRandomAdd.Style.GradientAngle = 90;
this.btnRandomAdd.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnRandomAdd.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRandomAdd.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRandomAdd.TabIndex = 431;
this.btnRandomAdd.Text = "随机添加";
this.btnRandomAdd.Click += new System.EventHandler(this.btnRandomAdd_Click);
//
// label2
//
@@ -1597,19 +1598,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle43.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle43;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle44.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle44;
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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1835,19 +1836,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle45.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle45;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvSelectProduct.AutoRowNumber = true;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle46.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle46.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle46.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle46.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle46.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle46.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle46;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1909,8 +1910,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colSupplierName
//
dataGridViewCellStyle47.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle47;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1988,8 +1989,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle48.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle48;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -2049,8 +2050,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colAddTime
//
dataGridViewCellStyle49.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle49;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colAddTime.FillWeight = 80F;
this.colAddTime.HeaderText = "上传时间";
this.colAddTime.Name = "colAddTime";
@@ -2058,6 +2059,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colOpResult
//
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8;
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
@@ -2229,7 +2232,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.Label label4;
private DevComponents.DotNetBar.PanelEx btnStop;
private UserComponent.UcCheckBox chkChance;
private DevComponents.DotNetBar.PanelEx panelEx2;
private DevComponents.DotNetBar.PanelEx btnRandomAdd;
private System.Windows.Forms.TextBox txtAddCount;
private System.Windows.Forms.Label lblGoodsCount;
private DevComponents.DotNetBar.PanelEx btnClearUpload;
@@ -2293,28 +2296,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private UserComponent.UcCheckBox chkSkipQualification;
private DevComponents.DotNetBar.PanelEx btnApiUpload;
private DevComponents.DotNetBar.PanelEx btnRefreshApi;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colLogin;
private System.Windows.Forms.DataGridViewLinkColumn colInShop;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId;
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewLinkColumn colUserNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.TextBox txtAddShippingFeeTimes;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.PictureBox pbShopLoading;
@@ -2349,5 +2330,27 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private UserComponent.UcComboBoxMutiSelect cmbCateFilter1;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter3;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter2;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colLogin;
private System.Windows.Forms.DataGridViewLinkColumn colInShop;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId;
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewLinkColumn colUserNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -46,7 +46,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"跑步鞋", "棉鞋", "高帮休闲鞋", "网面鞋", "勃肯鞋/软木鞋", "包头拖", "足部磨砂", "老爹鞋", "工装鞋", "豆豆鞋", "汉服鞋", "雨鞋" };
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public CancellationTokenSource cancelAddProd { get; set; } = null;
public CancellationTokenSource getProdTokenSource { get; set; } = null;
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
@@ -5912,38 +5912,66 @@ Content-Type: image/jpeg
private void btnRandomAdd_Click(object sender, EventArgs e)
{
int addCount = txtAddCount.Text.Trim().ParseToInt();
pictureBox1.Visible = true;
if (cancelAddProd != null)
cancelAddProd.Cancel();
cancelAddProd = new CancellationTokenSource();
btnRandomAdd.Enabled = false;
Task.Run(() =>
{
int prodCount = 0;
List<KJDDBProduct> list = new List<KJDDBProduct>();
Thread.Sleep(5000);
Invoke(new Action(() =>
{
btnRandomAdd.Enabled = true;
}));
});
pictureBox1.Visible = true;
int addCount = txtAddCount.Text.Trim().ParseToInt();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
getProdTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
List<KJDDBProduct> prodLst = new List<KJDDBProduct>();
int index = 0;
int pageSize = 50;
int prodCount = 99999999;
while (addCount > 0)
{
if (cancelAddProd.IsCancellationRequested)
if (getProdTokenSource.IsCancellationRequested)
break;
// 等于50说明还有更多,不足50就不用再查了
if (list.Count == 0 || list.Count == 50)
index++;
// 如果产品数量在0到50之间,说明数据库商品数量不足,无需再重复筛选,直接随机打乱
if (prodLst.Count == 0 || prodCount > pageSize)
{
list = GetRandomProductList(out prodCount, 1, 50);
Thread.Sleep(Randomx.GetId(50,100));
if (prodCount != 99999999)
{
//不重复筛选
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount), true, prodCount);
}
else
{
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount));
}
//Thread.Sleep(Randomx.GetId(50, 100));
Thread.Sleep(Randomx.GetId(250, 500));
}
else
{
prodLst = prodLst.OrderBy(x => Guid.NewGuid()).ToList();
Thread.Sleep(Randomx.GetId(10, 30));
}
if (list.Count == 0) // 等于0要么库里没数据要么出错了,跳出
break;
Invoke(new Action(() =>
{
lblGoodsCount.Text = "产品库 " + prodCount + " 件";
}));
foreach (var prod in list)
if (prodLst.Count == 0) // 等于0要么库里没数据要么出错了,跳出
break;
foreach (var prod in prodLst)
{
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
selectProd.out_product_Id = prod.id.ToString();
selectProd.id = 1;
if (lstTemuDBProductSelect.Count > 0)
selectProd.id = lstTemuDBProductSelect.Max(p => p.id).ParseToInt() + 1;
selectProd.id = lstTemuDBProductSelect.Max(p => p.id) + 1;
this.lstTemuDBProductSelect.Add(selectProd);
Invoke(new Action(() =>
@@ -5957,10 +5985,10 @@ Content-Type: image/jpeg
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
}
Invoke(new Action(() => { pictureBox1.Visible = false; }));
}, cancelAddProd.Token);
}, getProdTokenSource.Token);
}
public List<KJDDBProduct> GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50)
public List<KJDDBProduct> GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50, bool isNotCount = false, int totalProdCount = 0)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
@@ -5980,36 +6008,32 @@ Content-Type: image/jpeg
data += "&in_spu_ids=" + txtIdFilter.Text;
data += "&in_groups=" + cmbGroupFilter.Text;
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
{
data += "&in_cates=" + (cmbCateFilter1.Text == "全部" ? "" : cmbCateFilter1.Text);
}
else
{
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (selectCate1?.Count == 0 && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
if (!string.IsNullOrEmpty(cmbCateFilter1.Text) && selectCate1?.Count > 0)
data += "&wx_cat_1=" + string.Join(",", selectCate1.Select(c => c.cat_id).ToList());
//else if (chkSkipQualification.Checked)
//{
// // 厂商直采普通店铺不要随特殊商品
// data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
// .Select(c => c.cat_id));
//}
if (!string.IsNullOrEmpty(cmbCateFilter2.Text) && selectCate2?.Count > 0)
data += "&wx_cat_2=" + string.Join(",", selectCate2.Select(c => c.cat_id).ToList());
if (!string.IsNullOrEmpty(cmbCateFilter3.Text) && selectCate3?.Count > 0)
data += "&wx_cat_3=" + string.Join(",", selectCate3.Select(c => c.cat_id).ToList());
}
if (selectCate1.Count == 0 && cmbSourceType.Text == "厂商直采" && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
data += "&product_get_type=" + cmbSourceType.Text.Trim();
if (cmbSourceType.Text.Trim() == "厂商直采")
@@ -6438,8 +6462,8 @@ Content-Type: image/jpeg
private void pictureBox1_Click(object sender, EventArgs e)
{
if (cancelAddProd != null)
cancelAddProd.Cancel();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
}
private void btnTest20981_Click(object sender, EventArgs e)
+19 -1
View File
@@ -23,6 +23,7 @@ using AllBase.Model.Param.TemuProductManage;
using TemuKJD.KJDForms.ShopForms;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.BLL.PddApi;
using TemuKJD.PDDForms.ProductForms;
namespace TemuKJD
{
@@ -182,7 +183,24 @@ namespace TemuKJD
}
}
});
#endregion
#endregion
#region Pdd读取违规商品信息
Task.Run(() =>
{
while (!IsShopInit)
{
Thread.Sleep(1000);
}
if (BaseClass.MainPath != "weixin") // 跨境达才读取库存
return;
WXProdViolationManage.GetShopProdViolation();
});
#endregion
}
public static void InitProxy()
+320
View File
@@ -0,0 +1,320 @@
namespace TemuKJD.ToolForms
{
partial class PddMobileLoginForm
{
/// <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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PddMobileLoginForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnLoginAgain = new TemuKJD.UserControls.ButtonEx();
this.label2 = new System.Windows.Forms.Label();
this.btnCopyPassword = new TemuKJD.UserControls.ButtonEx();
this.btnCopyUserName = new TemuKJD.UserControls.ButtonEx();
this.txtPassWord = new System.Windows.Forms.TextBox();
this.txtUserName = new System.Windows.Forms.TextBox();
this.btnStop = new TemuKJD.UserControls.ButtonEx();
this.btnReload = new TemuKJD.UserControls.ButtonEx();
this.chkCloseAfterLogin = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.txtAddress = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
this.splitContainer1.Panel2.Controls.Add(this.label3);
this.splitContainer1.Panel2.Controls.Add(this.panel2);
this.splitContainer1.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.splitContainer1_Panel2_Paint);
this.splitContainer1.Size = new System.Drawing.Size(1022, 704);
this.splitContainer1.SplitterDistance = 484;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
// btnLoginAgain
//
this.btnLoginAgain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnLoginAgain.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnLoginAgain.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLoginAgain.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLoginAgain.ForeColor = System.Drawing.Color.White;
this.btnLoginAgain.Location = new System.Drawing.Point(56, 163);
this.btnLoginAgain.Margin = new System.Windows.Forms.Padding(2);
this.btnLoginAgain.Name = "btnLoginAgain";
this.btnLoginAgain.Size = new System.Drawing.Size(91, 25);
this.btnLoginAgain.TabIndex = 462;
this.btnLoginAgain.Text = "重新登录";
this.btnLoginAgain.UseVisualStyleBackColor = false;
this.btnLoginAgain.Click += new System.EventHandler(this.btnLoginAgain_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(73, 67);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 378;
this.label2.Text = "密码";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnCopyPassword
//
this.btnCopyPassword.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCopyPassword.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCopyPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCopyPassword.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCopyPassword.ForeColor = System.Drawing.Color.White;
this.btnCopyPassword.Location = new System.Drawing.Point(255, 63);
this.btnCopyPassword.Margin = new System.Windows.Forms.Padding(2);
this.btnCopyPassword.Name = "btnCopyPassword";
this.btnCopyPassword.Size = new System.Drawing.Size(57, 25);
this.btnCopyPassword.TabIndex = 376;
this.btnCopyPassword.Text = "复制";
this.btnCopyPassword.UseVisualStyleBackColor = false;
this.btnCopyPassword.Click += new System.EventHandler(this.btnCopyPassword_Click);
//
// btnCopyUserName
//
this.btnCopyUserName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCopyUserName.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCopyUserName.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCopyUserName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCopyUserName.ForeColor = System.Drawing.Color.White;
this.btnCopyUserName.Location = new System.Drawing.Point(255, 36);
this.btnCopyUserName.Margin = new System.Windows.Forms.Padding(2);
this.btnCopyUserName.Name = "btnCopyUserName";
this.btnCopyUserName.Size = new System.Drawing.Size(57, 25);
this.btnCopyUserName.TabIndex = 375;
this.btnCopyUserName.Text = "复制";
this.btnCopyUserName.UseVisualStyleBackColor = false;
this.btnCopyUserName.Click += new System.EventHandler(this.btnCopyUserName_Click);
//
// txtPassWord
//
this.txtPassWord.Location = new System.Drawing.Point(117, 64);
this.txtPassWord.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtPassWord.Name = "txtPassWord";
this.txtPassWord.PasswordChar = '●';
this.txtPassWord.ReadOnly = true;
this.txtPassWord.Size = new System.Drawing.Size(135, 23);
this.txtPassWord.TabIndex = 374;
//
// txtUserName
//
this.txtUserName.Location = new System.Drawing.Point(117, 37);
this.txtUserName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtUserName.Name = "txtUserName";
this.txtUserName.ReadOnly = true;
this.txtUserName.Size = new System.Drawing.Size(135, 23);
this.txtUserName.TabIndex = 373;
//
// btnStop
//
this.btnStop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStop.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStop.ForeColor = System.Drawing.Color.White;
this.btnStop.Location = new System.Drawing.Point(243, 163);
this.btnStop.Margin = new System.Windows.Forms.Padding(2);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(91, 25);
this.btnStop.TabIndex = 372;
this.btnStop.Text = "停止操作";
this.btnStop.UseVisualStyleBackColor = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnReload
//
this.btnReload.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnReload.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnReload.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReload.ForeColor = System.Drawing.Color.White;
this.btnReload.Location = new System.Drawing.Point(150, 163);
this.btnReload.Margin = new System.Windows.Forms.Padding(2);
this.btnReload.Name = "btnReload";
this.btnReload.Size = new System.Drawing.Size(91, 25);
this.btnReload.TabIndex = 371;
this.btnReload.Text = "重新加载";
this.btnReload.UseVisualStyleBackColor = false;
this.btnReload.Click += new System.EventHandler(this.btnReload_Click);
//
// chkCloseAfterLogin
//
//
//
//
this.chkCloseAfterLogin.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.chkCloseAfterLogin.Checked = true;
this.chkCloseAfterLogin.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkCloseAfterLogin.CheckValue = "Y";
this.chkCloseAfterLogin.Location = new System.Drawing.Point(207, 138);
this.chkCloseAfterLogin.Name = "chkCloseAfterLogin";
this.chkCloseAfterLogin.Size = new System.Drawing.Size(135, 23);
this.chkCloseAfterLogin.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.chkCloseAfterLogin.TabIndex = 8;
this.chkCloseAfterLogin.Text = "登录成功后关闭窗口";
//
// splitContainer2
//
this.splitContainer2.BackColor = System.Drawing.Color.White;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer2.Location = new System.Drawing.Point(1, 33);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.txtAddress);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.splitContainer1);
this.splitContainer2.Size = new System.Drawing.Size(1022, 734);
this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 5;
//
// txtAddress
//
this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtAddress.Location = new System.Drawing.Point(3, 3);
this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtAddress.Name = "txtAddress";
this.txtAddress.Size = new System.Drawing.Size(1016, 23);
this.txtAddress.TabIndex = 7;
this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown);
//
// panel2
//
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.panel2.Controls.Add(this.txtUserName);
this.panel2.Controls.Add(this.btnLoginAgain);
this.panel2.Controls.Add(this.chkCloseAfterLogin);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.btnReload);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.btnStop);
this.panel2.Controls.Add(this.btnCopyPassword);
this.panel2.Controls.Add(this.txtPassWord);
this.panel2.Controls.Add(this.btnCopyUserName);
this.panel2.Location = new System.Drawing.Point(79, 195);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(376, 257);
this.panel2.TabIndex = 463;
this.panel2.Visible = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(73, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 17);
this.label1.TabIndex = 377;
this.label1.Text = "用户名";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(128, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(285, 28);
this.label3.TabIndex = 464;
this.label3.Text = "请使用拼多多手机版扫码登录";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Visible = false;
//
// PddMobileLoginForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1024, 768);
this.Controls.Add(this.splitContainer2);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "PddMobileLoginForm";
this.ShowMaximizeBox = true;
this.Text = "店铺登录";
this.TitleText = "店铺登录";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ShopLoginForm_FormClosed);
this.Load += new System.EventHandler(this.ShopLoginForm_Load);
this.Controls.SetChildIndex(this.splitContainer2, 0);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private UserControls.ButtonEx btnStop;
private UserControls.ButtonEx btnReload;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.TextBox txtAddress;
private UserControls.ButtonEx btnLoginAgain;
public DevComponents.DotNetBar.Controls.CheckBoxX chkCloseAfterLogin;
public System.Windows.Forms.TextBox txtPassWord;
public System.Windows.Forms.TextBox txtUserName;
public System.Windows.Forms.Label label2;
public UserControls.ButtonEx btnCopyPassword;
public UserControls.ButtonEx btnCopyUserName;
private System.Windows.Forms.Panel panel2;
public System.Windows.Forms.Label label3;
public System.Windows.Forms.Label label1;
}
}
+547
View File
@@ -0,0 +1,547 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using CefSharp;
using CefSharp.WinForms;
//using TemuKJD.DashBoardForms;
using TemuKJD.Helper;
using TemuKJD.BaseForms;
using Microsoft.Win32;
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.Web.Hosting;
using System.Windows.Forms;
using Work;
using Work.BLL.Tools;
using TemuKJD.BLL;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Param.PDDProdParam;
using TemuKJD.PDDForms.ShopForms;
namespace TemuKJD.ToolForms
{
public partial class PddMobileLoginForm : BaseGeneralForm
{
public static PddMobileLoginForm PddMobileLoginInstance { get; set; } = null;
public int CloseAfterSecond { get; set; }
public EnumOpenType openType = EnumOpenType.manage;
public string InitUrl = "";
private string shopCookieHead = "yangkeduo.com";
private string shopLoginUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
private string shopMainUrl = "https://mobile.yangkeduo.com/index.html";
public ChromiumWebBrowser cefWebBrowser = null;
private BuyerLoginInfo buyer = null;
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
private string currentUrl = "";
public PddMobileLoginForm(BuyerLoginInfo buyerInfo)
{
PddMobileLoginInstance = this;
InitializeComponent();
this.buyer = buyerInfo;
this.txtUserName.Text = buyerInfo?.buyer_name;
this.txtPassWord.Text = ""; //DataOpenSSL.DecryptString(buyerInfo.Password);
}
private void ShopLoginForm_Load(object sender, EventArgs e)
{
//this.splitContainer1.SplitterDistance = this.splitContainer1.Height - 62;
if (openType == EnumOpenType.login)
this.label3.Visible = true;
if (CloseAfterSecond > 0)
{
Task.Run(() =>
{
Thread.Sleep(1000 * CloseAfterSecond);
if (this.Created)
{
Invoke(new Action(() => { this.Close(); }));
}
});
}
AutoLogin();
CheckAndSaveShop(); //判断登录是否成功,成功则保存店铺信息和店铺cookie
//ClosePopWindow(); //自动关闭弹窗
}
/// <summary>
/// 判断登录,保存店铺
/// </summary>
private void CheckAndSaveShop()
{
}
/// <summary>
/// 自动关闭弹窗
/// </summary>
private void ClosePopWindow()
{
// 关闭弹窗
Task.Run(() =>
{
var sleepTime = 2500;
int i = 0;
while (true && i++ < 50)
{
try
{
Thread.Sleep(sleepTime);
var jsStr1 = "function ClosePopWindow(txt) {\r\n" +
" var result = 'no_pop'\r\n" +
" var item = document.getElementsByClassName(txt);\r\n" +
" for(i = 0; i < item.length; i++) {\r\n" +
" item[i].click();\r\n" +
" result = 'success'\r\n" +
" }\r\n" +
" return result;\r\n" +
"}\r\n" +
"ClosePopWindow('anticon-close-circle');\r\n" +
"ClosePopWindow('ant-modal-close-x');\r\n";
var jsStr2 = "function clickPopWindow(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_pop';\r\n"
+ "}\r\n"
+ "clickPopWindow('我知道了');\r\n"
+ "clickPopWindow('知道了');\r\n";
if (cefWebBrowser != null && cefWebBrowser.IsBrowserInitialized)
{
var t1 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr1);
t1.Wait();
var t2 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr2);
t2.Wait();
if (t1.Result?.Result?.ToString() == "success" || t2.Result?.Result?.ToString() == "success")
sleepTime = Randomx.GetId(550, 650);
else
sleepTime = Randomx.GetId(1500, 2000);
}
}
catch (Exception ex) { }
}
});
}
/// <summary>
/// 自动登录店铺后台
/// </summary>
private void AutoLogin()
{
if (openType != EnumOpenType.login && buyer == null)
return;
if (cefWebBrowser == null)
{
//cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
if (!string.IsNullOrEmpty(InitUrl))
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
else
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
var lifeSapnHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
cefWebBrowser.LifeSpanHandler = lifeSapnHandler;
cefWebBrowser.KeyboardHandler = new KeyboardHandler();
cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
cefWebBrowser.LoadError += CefWebBrowser_LoadError;
cefWebBrowser.Dock = DockStyle.Fill;
//js绑定C#对象
//PDDShopBrowserObject shopObj = new PDDShopBrowserObject();
//shopObj.OnInfoReceived += ShopObj_OnInfoReceived;
//CefSharpSettings.WcfEnabled = true;
//cefWebBrowser.JavascriptObjectRepository.Register(
// name: "shopObj",
// objectToBind: shopObj,
// isAsync: false,
// options: new BindingOptions { Binder = BindingOptions.DefaultBinder.Binder /*CamelCaseJavascriptNames = false*/ /*cef79*/ }
//);
//if (buyer.cookie == null)
// buyer.cookie = "";
List<Cookie> cookieLst = new List<Cookie>();
try
{
if (buyer != null)
{
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(buyer?.cookie);
if (cookieLst == null)
cookieLst = new List<Cookie>();
}
}
catch
{
}
Task.Run(() =>
{
Invoke(new Action(() =>
{
splitContainer1.Panel1.Controls.Add(cefWebBrowser);
//cefWebBrowser.Load(shopMainUrl);
}));
// cef138必须init后方可设置或删除cookie
while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
Thread.Sleep(20);
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
//if (cookieLst.Any(c => c.Value.StartsWith("windows_1")))
// cefWebBrowser.ExecuteScriptAsync("navigator.__defineGetter__('userAgent', function() { return 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12'; });");
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//if (this.openType != EnumOpenType.login)
{
var t = CEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), cefWebBrowser.GetCookieManager(null));
//foreach (var cook in cookieLst)
//{
// var t = CEFBrowser.SetCookieAsync(cook.Domain, cook.Name + "=" + cook.Value + ";", cefWebBrowser.GetCookieManager(null));
// t.Wait(5000);
//}
}
//根据登录的具体店铺设置local storage
if (!string.IsNullOrEmpty(buyer?.buyer_id))
{
//var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n";
//storageJsCode += "window.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');\r\n";
//while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
// Thread.Sleep(20);
//cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
}
if (!string.IsNullOrEmpty(InitUrl))
cefWebBrowser.Load(InitUrl);
else
cefWebBrowser.Load(shopMainUrl);
//不是登录的话就此返回
if (openType != EnumOpenType.login)
{
Invoke(new Action(() =>
{
chkCloseAfterLogin.Visible = false;
btnLoginAgain.Visible = false;
}));
return;
}
for (int i = 0; i < 50; i++)
{
if (cefWebBrowser.IsLoading)
Thread.Sleep(100);
}
Thread.Sleep(Randomx.GetId(1500,2000));
if (!this.Created)
return;
while (!cefWebBrowser.Address.StartsWith(shopLoginUrl))
{
Thread.Sleep(1000);
if (!this.Created)
return;
}
//CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
//InputUserNameAndPassword(cefWebBrowser, shop.LoginName, DataOpenSSL.DecryptString(shop.Password));
});
}
}
private void ShopObj_OnInfoReceived(string information)
{
//BaseMsgForm.ShowInfo(information);
if (!string.IsNullOrEmpty(information))
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("alert('" + information + "');");
}
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
{
}
private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e)
{
if (this.Created && !this.Disposing && !this.IsDisposed)
{
Invoke(new Action(() =>
{
currentUrl = e.Address;
txtAddress.Text = e.Address;
}));
}
}
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
{
//js绑定C#对象 html页面内声明绑定的C#对象
StringBuilder sb = new StringBuilder();
sb.Append("(function(){");
sb.Append("CefSharp.BindObjectAsync('shopObj');");
sb.Append("})();");
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
}
//public Func<object, string, string, request, bool> BeforeResourceLoadEvent; // sender, requestUrl, postData, request, true(表示取消执行)
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
return false;
}
public PDDProductUploadParam prodParam = null;
static int GetAntiContentsTimes = 40;
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
//if (url.Contains("https://mobile.yangkeduo.com/personal.html?refer_page_name=login") && openType == EnumOpenType.login)
if (url.Contains("https://mobile.yangkeduo.com/personal.html") && openType == EnumOpenType.login)
{
Task.Run(() =>
{
var data = responseData;
if (data.Contains("\"success\":true") || data.Contains("nickname"))
{
var uid = BaseRegex.GetStringJson(ref data, "uid");
var nickname = BaseRegex.GetStringJson(ref data, "nickname");
var username = nickname;
if (!string.IsNullOrEmpty(nickname) && !string.IsNullOrEmpty(uid))
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
var buyerUrl = BaseClass.BuildPDDObjString("user/add_buyer");
if (this.buyer == null)
buyer = GlobalConfig.BuyerLoginList.FirstOrDefault(buyer => buyer.buyer_id == uid);
if (this.buyer != null)
{
this.buyer.user_name = username;
this.buyer.buyer_nick = nickname;
this.buyer.cookie = JsonHelper.SerializeObject(cookieList);
buyerUrl = BaseClass.BuildPDDObjString("user/mdy_buyer");
}
var buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&buyer_name=" + username
+ "&buyer_nick=" + nickname;
var result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
buyerUrl = BaseClass.BuildPDDObjString("user/mdy_buyer_cookie");
buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&status=" + "在线"
+ "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList));
result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
Invoke(new Action(() =>
{
try
{
if (chkCloseAfterLogin.Checked)
this.Close();
}
catch (Exception ex)
{ }
}));
}
}
});
}
}
// 鼠标左键按下,移动,移动...左键抬起。
public static void CefMouseDragDou(ChromiumWebBrowser webBrowser, int x1, int y1, int x2, int y2)
{
Thread.Sleep(100);
var host = webBrowser.GetBrowser().GetHost();
var rx = -6 + Randomx.GetId(13);
x2 = x2 + rx;
// 随机按下点的位置(正负6像素),提高仿真性
int x = x1 + rx;
int y = y1 - 6 + Randomx.GetId(13);
// 按下鼠标左键
host.SendMouseClickEvent(x, y, MouseButtonType.Left, false, 1, CefEventFlags.None);
Thread.Sleep(100 + Randomx.GetId(300));
// 滑动光标
int times = -20;
while (x < x2 + 4 - Randomx.GetId(9))
{
times++;
x += (15 + Randomx.GetId(15)) / 8;
if (times % 5 == 0)
y = y - 1 + Randomx.GetId(3);
Thread.Sleep(6 + Math.Abs(times) / 5 + Randomx.GetId(16));
host.SendMouseMoveEvent((int)x, (int)y, false, CefEventFlags.LeftMouseButton);
}
if (x < x2 - 1)
while (x < x2)
{
times++;
x += (8 + Randomx.GetId(8)) / 8;
if (times % 5 == 0)
y = y - 1 + Randomx.GetId(3);
Thread.Sleep(6 + Math.Abs(times) / 5 + Randomx.GetId(16));
host.SendMouseMoveEvent((int)x, (int)y, false, CefEventFlags.LeftMouseButton);
}
else if (x > x2 + 1)
while (x > x2)
{
times++;
x -= (8 + Randomx.GetId(8)) / 8;
if (times % 5 == 0)
y = y - 1 + Randomx.GetId(3);
Thread.Sleep(6 + Math.Abs(times) / 5 + Randomx.GetId(16));
host.SendMouseMoveEvent((int)x, (int)y, false, CefEventFlags.LeftMouseButton);
}
// 如果最后位置偏差较多,再做一次调整
x = x2 - 1 + Randomx.GetId(3);
x = x2;
Thread.Sleep(18 + Math.Abs(times) / 5 + Randomx.GetId(16));
Thread.Sleep(18 + Math.Abs(times) / 5 + Randomx.GetId(16));
host.SendMouseMoveEvent((int)x, (int)y, false, CefEventFlags.LeftMouseButton);
// 抬起鼠标左键
Thread.Sleep(300 + Randomx.GetId(500));
host.SendMouseClickEvent(x, y, MouseButtonType.Left, true, 1, CefEventFlags.None);
host.SendMouseClickEvent(x, y, MouseButtonType.Left, true, 1, CefEventFlags.None);
}
private void btnStop_Click(object sender, EventArgs e)
{
}
private void btnCopyUserName_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtUserName.Text))
Clipboard.SetDataObject(txtUserName.Text);
}
private void btnCopyPassword_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtPassWord.Text))
Clipboard.SetDataObject(txtPassWord.Text);
}
private void btnReload_Click(object sender, EventArgs e)
{
if (cefWebBrowser != null)
{
if (txtAddress.Text != "about:blank")
cefWebBrowser.Load(txtAddress.Text);
else
cefWebBrowser.Load(shopMainUrl);
}
}
private void ShopLoginForm_FormClosed(object sender, FormClosedEventArgs e)
{
//OnSaveComplete(shop);
Task.Run(() => {
Thread.Sleep(500);
if (!this.Disposing && !this.IsDisposed)
{
//MainForm.instance.Invoke(new Action(() => { this.Dispose(); }));
}
});
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (cefWebBrowser != null)
{
cefWebBrowser.Load(txtAddress.Text);
}
}
}
string sInputValueChange { get; set; } = @"
let usernameId = document.getElementById('usernameId');
usernameId.value = '1';
var event = document.createEvent('HTMLEvents');
event.initEvent('input', true, true);
event.eventType = 'message';
usernameId.dispatchEvent(event);
";
string sInputValueChange2 { get; set; } = @"
function changeReactInputValue(inputDom,newText){
let lastValue = inputDom.value;
inputDom.value = newText;
let event = new Event('input', { bubbles: true });
event.simulated = true;
let tracker = inputDom._valueTracker;
if (tracker) {
tracker.setValue(lastValue);
}
inputDom.dispatchEvent(event);
}
";
string sGetElementWithText { get; set; } = @"
function getElementWithText(sText)
{
var elem=null;
const elements = document.querySelectorAll('*'); // 选择所有元素
elements.forEach(element => {
if (element.textContent.includes(sText)) {
// 对每个匹配的元素执行操作
//console.log(element);
elem=element;
}
});
return elem;
};
";
private void btnLoginAgain_Click(object sender, EventArgs e)
{
if (this.currentUrl != shopLoginUrl)
this.cefWebBrowser.Load(shopLoginUrl);
}
private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
{
}
}
}
+298
View File
@@ -0,0 +1,298 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAgIAQYAAAAABoKAAAFgAAACgAAACAAAAAAAEAAAEABAAAAAAAACgAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP//
AAD///8AAAAAAAAAAAAAAAAABEZmbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMZmZkQAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAZszMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMxmAAAAAAAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMxkAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzGQAAAAAAAAAAAAAAAAAAAbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMYAAAAAAAAAAAAAAAAARszMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAABszMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAAAAAGzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAAAAbMzMzMzMzMzMzMzMzM
zMzMzMzMzMx3d4iIiIiIiIh3fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAABszMzMzMzMzMzM
zMzMzMzMzMzHeIiIiIj/////////iIiIiId8zMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAGzMzMzMzM
zMzMzMzMzMzMzMeIiI/////////////////////4iIh8zMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAATMzM
zMzMzMzMzMzMzMzMzHiI////////////////////////////iIfMzMzMzMzMzMzMzMzMzMzMxAAAAAAA
AGzMzMzMzMzMzMzMzMzMx3iP///////////////////////////////4iHzMzMzMzMzMzMzMzMzMzMYA
AAAAAAbMzMzMzMzMzMzMzMzMx3iP//////////////////////////////////+IfMzMzMzMzMzMzMzM
zMzMYAAAAABMzMzMzMzMzMzMzMzMx3iP/////////////////////////////////////4h8zMzMzMzM
zMzMzMzMzMQAAAAAbMzMzMzMzMzMzMzMzHiP////////////////////////////////////////h3zM
zMzMzMzMzMzMzMzGAAAABMzMzMzMzMzMzMzMzHiP////////////////////////////////////////
//iHzMzMzMzMzMzMzMzMzEAAAAbMzMzMzMzMzMzMzMeI////////////////////////////////////
////////+IfMzMzMzMzMzMzMzMxgAABMzMzMzMzMzMzMzMx4////////////////////////////////
//////////////+IfMzMzMzMzMzMzMzMxAAAbMzMzMzMzMzMzMzHj///////////////////////////
/////////////////////4fMzMzMzMzMzMzMzMYAAMzMzMzMzMzMzMzMeP//////////////////////
///////////////////////////4fMzMzMzMzMzMzMzMAAbMzMzMzMzMzMzMx4//////////////////
/////////////////////////////////4fMzMzMzMzMzMzMzGAGzMzMzMzMzMzMzHj/////////////
///////////////////////////////////////4fMzMzMzMzMzMzMxgDMzMzMzMzMzMzMyI////////
/////////////////////////////////////////////4zMzMzMzMzMzMzMwEzMzMzMzMzMzMzHj///
//////////////////////////////////////////////////+HzMzMzMzMzMzMzMRszMzMzMzMzMzM
eP//////////////////////////////////////////////////////+HzMzMzMzMzMzMzGbMzMzMzM
zMzMzHj///////////////////////////////////////////////////////+MzMzMzMzMzMzMxmzM
zMzMzMzMzMyP////+IiP////////////////////////////////////////+I//////h8zMzMzMzMzM
zMZszMzMzMzMzMzHj////4iIiI//////////////////////////////////////+IiIj/////jMzMzM
zMzMzMzGbMzMzMzMzMzMyP////iIiIiI/////////////////////////////////////4iIiIj////4
fMzMzMzMzMzMxszMzMzMzMzMzHj////4iIiIiP////////////////////////////////////+IiIiI
j////4zMzMzMzMzMzMbMzMzMzMzMzMx4////iIiIiIj////////////////////////////////////4
iIiIiI////+HzMzMzMzMzMzMzMzMzMzMzMzMj////4iIiIiI//////////////+IiP//iI//////////
////+IiIiIiP////h8zMzMzMzMzMzMzMzMzMzMzMzI/////4iIiIiP/////////////4d3eIiIeIj///
//////////+IiIiIj/////jMzMzMzMzMzMzMzMzMzMzMzMyP////+IiIiIj/////////////iIiId3eI
iI//////////////iIiIiI/////4zMzMzMzMzMzMzMzMzMzMzMzHj/////+IiIiP/////////////4//
/4d4j/+P//////////////iIiIj/////+MzMzMzMzMzMzMzMzMzMzMzMx4//////+IiP////////////
///////4j///////////////////iIiP//////jMzMzMzMzMzMzMzMzMzMzMzMeP//////////+IiIj/
///////////////////////////////////////////4fMzMzMzMzMzMzMzMzMzMzMzH//////////+H
fMx8eP//////////////////////////iId3iP//////////+HzMzMzMzMzMzMzMzMzMzMzMyP//////
///4fMzHh8eP////////////////////////+MzMzMd4//////////h8zMzMzMzMzMzMzMzMzMzMzMf/
////////+MzMePjMeP///////////////////////4zMzMeHx4/////////4fMzMzMzMzMzMzMzMzMzM
zMzH/////////4fMd3eHzMeP//////////////////////iMzMzIiHx4////////+HzMzMzMzMzMzMzM
zMzMzMzMx/////////+Hx4iIfMzMj//////////////////////4h3d8x4h8yP////////jMzMzMzMzM
zMzMzMzMzMzMzMeP////////+HiP+IfMzI//////////////////////+HiIiHd3zHj////////4zMzM
zMzMzMzMzMzMzMzMzMzHj/////////h4//+HzMeP//////////////////////h4//h8zMyP////////
+MzMzMzMzMzMzMzMzMzMzMzMzI/////////4iP//h8x4///////////////////////4j//4fMzHj///
//////jMzMzMzMzMzMzMzMzMzMzMzMyP///////4iIiP+IfHj///////////////////////+Ij/+HzM
eP/////////4zMzMzMzMzMzMzMzMzMzMzMzMj///////iIiIiIh3eP////////////////////////+I
j4h8x3iI////////h8zMzMzMzMzMzMzMzMzMzMzMzH//////+Hj///iIiI//////////////////////
/////4iId4iIiIj//////4zMzMzMzMzMzMzMzMzMzMzMzMx4//////iP////iP//////////////////
/////////////4iP//iI//////+MzMzMzMzMzMzMzMzMzMzMzMzMyP//////////+I//////////////
///////////////////4eP//iP//////jMzMzMzMzMzMzMzMzMzMzMzMzMj///////////iP////////
/////////////////////////4j/////////+HzMzMzMzMzMzMzMzMzMzMzMzMzHj///////////////
//////////////////////////////+I//////////jMzMzMzMzMzMzMzMzMzMzMzMzMzI//////////
//////////////////////////////////////////////+HzMzMzMzMzMzMzMzMzMzMzMzMzMyP////
////////////////////////////////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzM
eP///////////////////////////////////////////////////////4zMzMzMzMzMzMzMzMzMzMzM
zMzMzMj///////////////////////////////////////////////////////h8zMzMzMzMzMzMzMzM
zMzMzMzMzMzHj//////////////////////////////////////////////////////4zMzMzMzMzMzM
zMzMzMzMzMzMzMzMzI//////////////////////////////////////////////////////h8zMzMzM
zMzMzMzMzMzMzMzMzMzMzMx4////////////////////////////////////////////////////+HzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMyI////+I////////////////////////////////////////////
//h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP////+Ij/////////////////////////////////////
//////+HzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP////+IiIiIj//////////////////////////4
////iI/////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMiP/////4iIiP//////////////////////
////+IiIiIj/////iHzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiP//////////////////////////
///////////4iIj//////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiP////////////////////
//////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiP//////////////
//////////////////////////////+HzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHj/////////
///////////////////////////////////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP////
////////////////////////////////////////+MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzI
j/////////////////////////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMeP//////////////////////////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMx4////////+I//////////////////////////////////////jMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMeP///////4iIj///////////////////////////iP///////4fMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMx4////////iIiIiP///////////////////////4iIiP///////4zMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMj///////+IiIiIiI////////////////////+IiIiIj///////+HzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMx4////////iIiIiIj////////////////////4iIiIiIj///////
+MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMj///////+IiIiIiI////////////////////+IiIiIiI//
//////h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx4////////iIiIiIiP////////////////////iIiI
iIiI///////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMj///////+IiIiIiIj/////iIiIiIiIj/////
/4iIiIiIiP///////4zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx4////////iIiIiIiI/////4zMzMzMzM
j/////+IiIiIiIiP//////+HzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP//////+IiIiIiIj/////+MzM
zMzMzI//////+IiIiIiIj///////+MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzI////////iIiIiIiI////
//jMzMzMzMyP//////iIiIiIiIj///////jMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP///////4iIiIiI
iP/////4zMzMzMzMj//////4iIiIiIiI///////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzI////////iI
iIiIiI//////+MzMzMzMzI//////+IiIiIiIiP///////4zMzMzMzMzMzMzMzMzMzMzMzMzMzMyP////
///4iIiIiIiP//////fMzMzMzMyP//////+IiIiIiIj///////+MzMzMzMzMzMzMzMzMzMzMzMzMzMzH
j///////+IiIiIiI//////+HzMzMzMzMeP//////iIiIiIiIj///////jMzMzMzMzMzMzMzMzMzMzMzM
zMzMyP////////iIiIiIiP//////jMzMzMzMzHj///////iIiIiIiI///////4fMzMzMzMzMzMzMzMzM
zMzMzMzMzMj///////+IiIiIiI///////4zMzMzMzMzI///////4iIiIiIiI///////3zMzMzMzMzMzM
zMzMzMzMzMzMzMzI////////iIiIiIiP//////+MzMzMzMzMyP//////+IiIiIiIiP//////+MzMzMzM
zMzMzMzMzMzMzMzMzMzMeP///////4iIiIiIj///////jMzMzMzMzMj///////+IiIiIiIj///////jM
zMzMzMzMzMzMzMzMzMzMzMzMzI////////+IiIiIiP//////+HzMzMzMzMzHj///////iIiIiIiI////
///4zMzMzMzMzMzMzMzMzMzMzMzMzMyP////////iIiIiI////////jMzMzMzMzMzI///////4iIiIiI
iI//////+MzMzMzMzMzMzMzMzMzMzMzMzMzMj////////4iIiIiP///////4zMzMzMzMzMyP///////4
iIiIiIiP//////jMzMzMzMzMzMzMzMzMzMzMzMzMzI////////+IiIiI////////h8zMzMzMzMzMeP//
/////4iIiIiIj//////4fMzMzMzMzMzMzMzMzMzMzMzMzMyP////////iIiIj////////4fMzMzMzMzM
zHj///////+IiIiIiI//////+HzMzMzMzMzMzMzMzMzMzMzMzMzHj/////////iIiP////////+MzMzM
zMzMzMzI////////+IiIiIiP//////h8zMzMzMzMzMzMxmzMzMzMzMzMx4/////////4iP/////////4
fMzMzMzMzMzMx4////////+IiIiIj//////4fMzMzMzMzMzMzMZszMzMzMzMzMeP////////////////
////+MzMzMzMzMzMzMyP////////iIiIiP//////+HzMzMzMzMzMzMzGbMzMzMzMzMzH////////////
//////////fMzMzMzMzMzMzMeP////////iIiIj///////98zMzMzMzMzMzMxmzMzMzMzMzMyP//////
//////////////+HzMzMzMzMzMzMzHj/////////+IiP////////jMzMzMzMzMzMzMZszMzMzMzMzMj/
////////////////////jMzMzMzMzMzMzMzIj////////////////////4zMzMzMzMzMzMzGTMzMzMzM
zMzH////////////////////+HzMzMzMzMzMzMzMx4////////////////////+MzMzMzMzMzMzMxAzM
zMzMzMzMx/////////////////////jMzMzMzMzMzMzMzMyI///////////////////4fMzMzMzMzMzM
zMAGzMzMzMzMzMeP//////////////////+HzMzMzMzMzMzMzMzMeP//////////////////+HzMzMzM
zMzMzMxgBszMzMzMzMzHj//////////////////4fMzMzMzMzMzMzMzMzMeP//////////////////h8
zMzMzMzMzMzMYADMzMzMzMzMzI//////////////////+HzMzMzMzMzMzMzMzMzHj///////////////
///4zMzMzMzMzMzMzAAAbMzMzMzMzMyP/////////////////4fMzMzMzMzMzMzMzMzMzHj/////////
////////+MzMzMzMzMzMzMYAAEzMzMzMzMzMj/////////////////+MzMzMzMzMzMzMzMzMzMzIj///
/////////////4fMzMzMzMzMzMzEAAAGzMzMzMzMzHj////////////////4fMzMzMzMzMzMzMzMzMzM
x4////////////////+MzMzMzMzMzMzMYAAABMzMzMzMzMx4////////////////h8zMzMzMzMzMzMzM
zMzMzMx4///////////////4fMzMzMzMzMzMzEAAAABszMzMzMzMx4//////////////+HzMzMzMzMzM
zMzMzMzMzMzMx4//////////////+MzMzMzMzMzMzMYAAAAATMzMzMzMzMyP/////////////4fMzMzM
zMzMzMzMzMzMzMzMzMeI/////////////4fMzMzMzMzMzMzEAAAAAAbMzMzMzMzMeP////////////h8
zMzMzMzMzMzMzMzMzMzMzMzMeI////////////h8zMzMzMzMzMzMYAAAAAAAbMzMzMzMzMeP////////
//iHzMzMzMzMzMzMzMzMzMzMzMzMzMyI//////////+HzMzMzMzMzMzMxgAAAAAAAEzMzMzMzMzMeP//
//////iHfMzMzMzMzMzMzMzMzMzMzMzMzMzMx4/////////4fMzMzMzMzMzMzMQAAAAAAAAGzMzMzMzM
zMeI//////iHfMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx4j//////4h8zMzMzMzMzMzMxgAAAAAAAAAGzM
zMzMzMzMx4iIiIiHzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiIj/+Ih3zMzMzMzMzMzMzGAAAAAAAA
AAAGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx3iId8zMzMzMzMzMzMzMYAAA
AAAAAAAAAGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
xgAAAAAAAAAAAAAGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzGAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzGQAAAAAAAAAAAAAAAAAbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMYAAAAAAAAAAAAAAAAAAARszMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAABGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAAAAAAAABmzMzMzMzMzMzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMzGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARGZmzMzMzMzMzMzMzM
zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMZmZEAAAAAAAAAAAAAAAAD////+AAAAAAAAAAD/////////AAAA
AAAAAAAAAP//////+AAAAAAAAAAAAAAf/////+AAAAAAAAAAAAAAB/////+AAAAAAAAAAAAAAAH////+
AAAAAAAAAAAAAAAAf////AAAAAAAAAAAAAAAAD////AAAAAAAAAAAAAAAAAP///gAAAAAAAAAAAAAAAA
B///wAAAAAAAAAAAAAAAAAP//4AAAAAAAAAAAAAAAAAB//8AAAAAAAAAAAAAAAAAAP/+AAAAAAAAAAAA
AAAAAAB//gAAAAAAAAAAAAAAAAAAf/wAAAAAAAAAAAAAAAAAAD/4AAAAAAAAAAAAAAAAAAAf+AAAAAAA
AAAAAAAAAAAAH/AAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAP4AAAAAAAAAAAAAAAAAAAB+AA
AAAAAAAAAAAAAAAAAAfAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAA
AAOAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAA
AAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAABAAAAAAAA
AAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAA
AAGAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAA
AAAAAAABgAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAADwAAAAAAA
AAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAfgAAAAAAAAAAAAAAAAAAAH8AAAAAAAAAAAAAAAAAAAD/AA
AAAAAAAAAAAAAAAAAA/4AAAAAAAAAAAAAAAAAAAf+AAAAAAAAAAAAAAAAAAAH/wAAAAAAAAAAAAAAAAA
AD/+AAAAAAAAAAAAAAAAAAB//gAAAAAAAAAAAAAAAAAAf/8AAAAAAAAAAAAAAAAAAP//gAAAAAAAAAAA
AAAAAAH//8AAAAAAAAAAAAAAAAAD///gAAAAAAAAAAAAAAAAB///8AAAAAAAAAAAAAAAAA////wAAAAA
AAAAAAAAAAA////+AAAAAAAAAAAAAAAAf////4AAAAAAAAAAAAAAAf/////gAAAAAAAAAAAAAAf/////
+AAAAAAAAAAAAAAf//////8AAAAAAAAAAAAA/////////gAAAAAAAAAAf////w==
</value>
</data>
</root>
+11 -3
View File
@@ -34,10 +34,16 @@ namespace TemuKJD.UserComponent
{
//base.OnPaint(e); // 禁用系统绘制
//if (e.ClipRectangle.X != 0 || e.ClipRectangle.Y != 0)
// return;
Graphics g = e.Graphics;
g.Clear(this.BackColor);
//填充背景色
g.FillRectangle(new SolidBrush(this.BackColor), e.ClipRectangle);
//g.FillRectangle(new SolidBrush(this.BackColor), e.ClipRectangle);
g.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
//绘制圆形(注释此句,以备后用)
//Brush brush = new SolidBrush(this.Checked ? checkBoxCheckColor : checkBoxColor);
@@ -64,8 +70,10 @@ namespace TemuKJD.UserComponent
}
Size size = TextRenderer.MeasureText(this.Text, Font);
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // 或者 AntiAliasGridFit // 平滑字体
e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
new PointF(e.ClipRectangle.X + checkBoxSize + 2 + Padding.Left, e.ClipRectangle.Y + (Height - size.Height) / 2));
//e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
// new PointF(e.ClipRectangle.X + checkBoxSize + 2 + Padding.Left, e.ClipRectangle.Y + (Height - size.Height) / 2));
e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
new PointF(this.ClientRectangle.X + checkBoxSize + 2 + Padding.Left, this.ClientRectangle.Y + (Height - size.Height) / 2));
}
private void DrawRoundedRectangle(Graphics g, Rectangle rect, int radius, Color color, bool isFill = false)
+37 -19
View File
@@ -41,6 +41,7 @@ namespace TemuKJD.WXForms.ProductForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkRandomCompanyProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkUseWXComplateProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkSaveBound = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkAiShortTitle = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -96,17 +97,17 @@ namespace TemuKJD.WXForms.ProductForms
this.pbSelectProd = new System.Windows.Forms.PictureBox();
this.cmbSourceType = new System.Windows.Forms.ComboBox();
this.cmbJstInitSet = new System.Windows.Forms.ComboBox();
this.cmbCateFilter3 = new System.Windows.Forms.ComboBox();
this.cmbCateFilter3 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
this.label21 = new System.Windows.Forms.Label();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.txtIdFilter = new System.Windows.Forms.TextBox();
this.cmbCateFilter2 = new System.Windows.Forms.ComboBox();
this.cmbCateFilter2 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
this.label19 = new System.Windows.Forms.Label();
this.btnClearFilter = new DevComponents.DotNetBar.PanelEx();
this.lblGoodsCount = new System.Windows.Forms.Label();
this.cmbWxSafe = new System.Windows.Forms.ComboBox();
this.btnClearUpload = new DevComponents.DotNetBar.PanelEx();
this.cmbCateFilter1 = new System.Windows.Forms.ComboBox();
this.cmbCateFilter1 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
this.label2 = new System.Windows.Forms.Label();
this.lblWaitToUp = new System.Windows.Forms.Label();
this.btnRandomAdd = new DevComponents.DotNetBar.PanelEx();
@@ -186,7 +187,6 @@ namespace TemuKJD.WXForms.ProductForms
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.panel1 = new System.Windows.Forms.Panel();
this.chkRandomCompanyProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -295,6 +295,18 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品上传";
//
// chkRandomCompanyProd
//
this.chkRandomCompanyProd.Checked = true;
this.chkRandomCompanyProd.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkRandomCompanyProd.Location = new System.Drawing.Point(856, 110);
this.chkRandomCompanyProd.Name = "chkRandomCompanyProd";
this.chkRandomCompanyProd.Size = new System.Drawing.Size(87, 21);
this.chkRandomCompanyProd.TabIndex = 889;
this.chkRandomCompanyProd.Text = "随机工厂商品";
this.chkRandomCompanyProd.UseVisualStyleBackColor = true;
this.chkRandomCompanyProd.Visible = false;
//
// chkUseWXComplateProd
//
this.chkUseWXComplateProd.Location = new System.Drawing.Point(727, 42);
@@ -1075,12 +1087,18 @@ namespace TemuKJD.WXForms.ProductForms
//
// cmbCateFilter3
//
this.cmbCateFilter3.DefaultText = "全部";
this.cmbCateFilter3.DropDownHeight = 1;
this.cmbCateFilter3.DropDownWidth = 1;
this.cmbCateFilter3.FormattingEnabled = true;
this.cmbCateFilter3.IntegralHeight = false;
this.cmbCateFilter3.Location = new System.Drawing.Point(309, 20);
this.cmbCateFilter3.Name = "cmbCateFilter3";
this.cmbCateFilter3.Size = new System.Drawing.Size(92, 25);
this.cmbCateFilter3.TabIndex = 710;
this.cmbCateFilter3.Text = "全部";
this.cmbCateFilter3.SelectedIndexChanged += new System.EventHandler(this.cmbCateFilter3_SelectedIndexChanged);
this.cmbCateFilter3.TextChanged += new System.EventHandler(this.cmbCateFilter3_TextChanged);
//
// label21
//
@@ -1113,12 +1131,18 @@ namespace TemuKJD.WXForms.ProductForms
//
// cmbCateFilter2
//
this.cmbCateFilter2.DefaultText = "全部";
this.cmbCateFilter2.DropDownHeight = 1;
this.cmbCateFilter2.DropDownWidth = 1;
this.cmbCateFilter2.FormattingEnabled = true;
this.cmbCateFilter2.IntegralHeight = false;
this.cmbCateFilter2.Location = new System.Drawing.Point(178, 20);
this.cmbCateFilter2.Name = "cmbCateFilter2";
this.cmbCateFilter2.Size = new System.Drawing.Size(92, 25);
this.cmbCateFilter2.TabIndex = 708;
this.cmbCateFilter2.Text = "全部";
this.cmbCateFilter2.SelectedIndexChanged += new System.EventHandler(this.cmbCateFilter2_SelectedIndexChanged);
this.cmbCateFilter2.TextChanged += new System.EventHandler(this.cmbCateFilter2_TextChanged);
//
// label19
//
@@ -1208,12 +1232,18 @@ namespace TemuKJD.WXForms.ProductForms
//
// cmbCateFilter1
//
this.cmbCateFilter1.DefaultText = "全部";
this.cmbCateFilter1.DropDownHeight = 1;
this.cmbCateFilter1.DropDownWidth = 1;
this.cmbCateFilter1.FormattingEnabled = true;
this.cmbCateFilter1.IntegralHeight = false;
this.cmbCateFilter1.Location = new System.Drawing.Point(47, 20);
this.cmbCateFilter1.Name = "cmbCateFilter1";
this.cmbCateFilter1.Size = new System.Drawing.Size(92, 25);
this.cmbCateFilter1.TabIndex = 663;
this.cmbCateFilter1.Text = "全部";
this.cmbCateFilter1.SelectedIndexChanged += new System.EventHandler(this.cmbCateFilter1_SelectedIndexChanged);
this.cmbCateFilter1.TextChanged += new System.EventHandler(this.cmbCateFilter1_TextChanged);
//
// label2
//
@@ -2292,18 +2322,6 @@ namespace TemuKJD.WXForms.ProductForms
this.panel1.Size = new System.Drawing.Size(873, 86);
this.panel1.TabIndex = 189;
//
// chkRandomCompanyProd
//
this.chkRandomCompanyProd.Checked = true;
this.chkRandomCompanyProd.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkRandomCompanyProd.Location = new System.Drawing.Point(856, 110);
this.chkRandomCompanyProd.Name = "chkRandomCompanyProd";
this.chkRandomCompanyProd.Size = new System.Drawing.Size(87, 21);
this.chkRandomCompanyProd.TabIndex = 889;
this.chkRandomCompanyProd.Text = "随机工厂商品";
this.chkRandomCompanyProd.UseVisualStyleBackColor = true;
this.chkRandomCompanyProd.Visible = false;
//
// WXDBProdUploadForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -2403,7 +2421,6 @@ namespace TemuKJD.WXForms.ProductForms
private DevComponents.DotNetBar.PanelEx panelEx1;
private System.Windows.Forms.TextBox txtIdFilter;
private System.Windows.Forms.Label lblIdFilter;
private System.Windows.Forms.ComboBox cmbCateFilter1;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.Label lblWaitToUp;
private System.Windows.Forms.Label label7;
@@ -2431,9 +2448,7 @@ namespace TemuKJD.WXForms.ProductForms
private System.Windows.Forms.PictureBox pbLoadingShop;
private System.Windows.Forms.ComboBox cmbJstInitSet;
private System.Windows.Forms.Label lblJstInitSet;
private System.Windows.Forms.ComboBox cmbCateFilter3;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.ComboBox cmbCateFilter2;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.PictureBox pbLoading;
private DevComponents.DotNetBar.PanelEx btnFilterBound;
@@ -2505,5 +2520,8 @@ namespace TemuKJD.WXForms.ProductForms
private UserComponent.UcCheckBox chkUseWXComplateProd;
private DevComponents.DotNetBar.PanelEx btnProdDb;
private UserComponent.UcCheckBox chkRandomCompanyProd;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter1;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter3;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter2;
}
}
@@ -1173,7 +1173,7 @@ namespace TemuKJD.WXForms.ProductForms
}));
}
public static KJDDBProduct GetProductDetail(string prodDbId, out string errMsg)
public static KJDDBProduct GetProductDetail(string prodDbId, out string errMsg, bool noViolationProduct = false)
{
errMsg = "";
@@ -1186,9 +1186,9 @@ namespace TemuKJD.WXForms.ProductForms
List<KJDDBProduct> list = new List<KJDDBProduct>();
var url = BaseClass.BuildObjString("product/get_pdd_product_detail_list");
var data = "";
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
var data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
if (noViolationProduct)
data += "&wx_safe_status=安全商品,未校验";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -4227,7 +4227,6 @@ namespace TemuKJD.WXForms.ProductForms
private void btnRandomAdd_Click(object sender, EventArgs e)
{
btnRandomAdd.Enabled = false;
pbSelectProd.Visible = true;
Task.Run(() =>
{
Thread.Sleep(5000);
@@ -4236,6 +4235,8 @@ namespace TemuKJD.WXForms.ProductForms
btnRandomAdd.Enabled = true;
}));
});
pbSelectProd.Visible = true;
int addCount = txtAddCount.Text.Trim().ParseToInt();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
@@ -4245,18 +4246,19 @@ namespace TemuKJD.WXForms.ProductForms
List<KJDDBProduct> prodLst = new List<KJDDBProduct>();
int index = 0;
int pageSize = 50;
int prodCount = 99999999;
while (addCount > 0)
{
if (getProdTokenSource.IsCancellationRequested)
break;
index++;
int prodCount = 0;
// 如果产品数量在0到50之间,说明数据库商品数量不足,无需再重复筛选,直接随机打乱
if (prodLst.Count == 0 || prodLst.Count == Math.Min(pageSize, addCount))
if (prodLst.Count == 0 || prodCount > pageSize)
{
if (index > 1 && prodCount > 0)
if (prodCount != 99999999)
{
//不重复筛选
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount), true, prodCount);
}
else
@@ -4282,7 +4284,7 @@ namespace TemuKJD.WXForms.ProductForms
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
selectProd.out_product_Id = prod.id.ToString();
selectProd.id = 1;
if(lstTemuDBProductSelect.Count > 0)
if (lstTemuDBProductSelect.Count > 0)
selectProd.id = lstTemuDBProductSelect.Max(p => p.id) + 1;
this.lstTemuDBProductSelect.Add(selectProd);
@@ -4328,28 +4330,49 @@ namespace TemuKJD.WXForms.ProductForms
data += "&in_ext_codes=" + txtExtCodeFilter.Text;
data += "&in_spu_ids=" + txtIdFilter.Text;
data += "&in_groups=" + cmbGroupFilter.Text;
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
data += "&in_cates=" + cmbCateFilter1.Text;
data += "&in_cates=" + (cmbCateFilter1.Text == "全部" ? "" : cmbCateFilter1.Text);
else
{
var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCateFilter2.Text.Trim());
var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
var cate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCateFilter3.Text.Trim());
//var selectCate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
//var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == selectCate1?.cat_id).ToList();
//var selectCate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCateFilter2.Text.Trim());
//var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == selectCate2?.cat_id).ToList();
//var selectCate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCateFilter3.Text.Trim());
if (!string.IsNullOrEmpty(cmbCateFilter1.Text) && cate1 != null)
data += "&wx_cat_1=" + cate1.cat_id;
else if (chkSkipQualification.Checked)
//if (!string.IsNullOrEmpty(cmbCateFilter1.Text) && selectCate1 != null)
// data += "&wx_cat_1=" + selectCate1.cat_id;
//else if (chkSkipQualification.Checked)
//{
// // 厂商直采普通店铺不要随特殊商品
// data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c=>c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
// .Select(c => c.cat_id));
//}
//if (!string.IsNullOrEmpty(cmbCateFilter2.Text) && selectCate2 != null)
// data += "&wx_cat_2=" + selectCate2.cat_id;
//if (!string.IsNullOrEmpty(cmbCateFilter3.Text) && selectCate3 != null)
// data += "&wx_cat_3=" + selectCate3.cat_id;
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (selectCate1?.Count == 0 && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c=>c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
if (!string.IsNullOrEmpty(cmbCateFilter2.Text) && cate2 != null)
data += "&wx_cat_2=" + cate2.cat_id;
if (!string.IsNullOrEmpty(cmbCateFilter3.Text) && cate3 != null)
data += "&wx_cat_3=" + cate3.cat_id;
if (!string.IsNullOrEmpty(cmbCateFilter1.Text) && selectCate1?.Count > 0)
data += "&wx_cat_1=" + string.Join(",", selectCate1.Select(c => c.cat_id).ToList());
if (!string.IsNullOrEmpty(cmbCateFilter2.Text) && selectCate2?.Count > 0)
data += "&wx_cat_2=" + string.Join(",", selectCate2.Select(c => c.cat_id).ToList());
if (!string.IsNullOrEmpty(cmbCateFilter3.Text) && selectCate3?.Count > 0)
data += "&wx_cat_3=" + string.Join(",", selectCate3.Select(c => c.cat_id).ToList());
}
data += "&product_get_type=" + cmbSourceType.Text.Trim();
data += "&wx_safe_status=" + cmbWxSafe.Text.Trim().Replace("安全+未校验", "安全商品,未校验");
@@ -4777,46 +4800,97 @@ namespace TemuKJD.WXForms.ProductForms
private void cmbCateFilter1_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "微信店采")
return;
cmbCateFilter2.Text = "";
cmbCateFilter2.Items.Clear();
var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
foreach (var cate2 in cates2)
{
cmbCateFilter2.Items.Add(cate2.name);
}
//if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "微信店采")
// return;
//cmbCateFilter2.Text = "";
//cmbCateFilter2.Items.Clear();
//var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
//var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
//foreach (var cate2 in cates2)
//{
// cmbCateFilter2.Items.Add(cate2.name);
//}
}
private void cmbCateFilter2_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "微信店采")
return;
//if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "微信店采")
// return;
cmbCateFilter3.Text = "";
cmbCateFilter3.Items.Clear();
var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCateFilter2.Text.Trim());
var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
foreach (var cate3 in cates3)
{
cmbCateFilter3.Items.Add(cate3.name);
}
//cmbCateFilter3.Text = "";
//cmbCateFilter3.Items.Clear();
//var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
//var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
//var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCateFilter2.Text.Trim());
//var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
//foreach (var cate3 in cates3)
//{
// cmbCateFilter3.Items.Add(cate3.name);
//}
}
private void cmbCateFilter3_SelectedIndexChanged(object sender, EventArgs e)
{
var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCateFilter2.Text.Trim());
var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
var cate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCateFilter3.Text.Trim());
//var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCateFilter1.Text.Trim());
//var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
//var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCateFilter2.Text.Trim());
//var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
//var cate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCateFilter3.Text.Trim());
}
private void cmbCateFilter1_TextChanged(object sender, EventArgs e)
{
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
return;
cmbCateFilter2.Text = "";
cmbCateFilter2.Items.Clear();
cmbCateFilter3.Text = "";
cmbCateFilter3.Items.Clear();
var selectCate1 = GlobalConfig.WxCatList
.Where(c => c.level == 1 && (cmbCateFilter1.Text.Trim() == cmbCateFilter1.DefaultText || (";" + cmbCateFilter1.Text.Trim() + ";")
.Contains(";" + c.name + ";"))).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
//foreach (var cate2 in cates2)
//{
// cmbCat2.Items.Add(cate2.name);
//}
cmbCateFilter2.Items.AddRange(cates2.Select(c => c.name).ToArray());
}
private void cmbCateFilter2_TextChanged(object sender, EventArgs e)
{
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
return;
cmbCateFilter3.Text = "";
cmbCateFilter3.Items.Clear();
var selectCate1 = GlobalConfig.WxCatList
.Where(c => c.level == 1 && (cmbCateFilter1.Text.Trim() == cmbCateFilter1.DefaultText || (";" + cmbCateFilter1.Text.Trim() + ";")
.Contains(";" + c.name + ";"))).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2
.Where(c => c.level == 2 && (cmbCateFilter2.Text.Trim() == cmbCateFilter1.DefaultText || (";" + cmbCateFilter2.Text.Trim() + ";")
.Contains(c.name))).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
//foreach (var cate3 in cates3)
//{
// cmbCat3.Items.Add(cate3.name);
//}
cmbCateFilter3.Items.AddRange(cates3.Select(c => c.name).ToArray());
}
private void cmbCateFilter3_TextChanged(object sender, EventArgs e)
{
//var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCat1.Text.Trim());
//var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
//var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCat1.Text.Trim());
//var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
//var cate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCat1.Text.Trim());
}
private void btnFilterBound_Click(object sender, EventArgs e)
{
var boundMax = txtFilterBoundMax.Text.Trim().ParseToInt();
@@ -5023,6 +5097,15 @@ namespace TemuKJD.WXForms.ProductForms
return result;
}
public static string searchProductWithTitle(ShopLoginInfo shop, string urlEncodeTitle)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?" +
"token=&lang=zh_CN&pageSize=20&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=1&status[]=-1&title=" + urlEncodeTitle;
string refere = "https://store.weixin.qq.com/shop/goods/list";
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, refere);
return result;
}
public static string getUploadTempImgAuth(ShopLoginInfo shop, int uploadScene = 3)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecchannelspicture/cgi/getUploadTempImgAuth?token=&lang=zh_CN&uploadScene=" + uploadScene;
+6 -6
View File
@@ -404,7 +404,7 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbCat3.DropDownWidth = 1;
this.cmbCat3.FormattingEnabled = true;
this.cmbCat3.IntegralHeight = false;
this.cmbCat3.Location = new System.Drawing.Point(733, 5);
this.cmbCat3.Location = new System.Drawing.Point(733, 7);
this.cmbCat3.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat3.Name = "cmbCat3";
this.cmbCat3.Size = new System.Drawing.Size(151, 25);
@@ -432,7 +432,7 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbCat2.DropDownWidth = 1;
this.cmbCat2.FormattingEnabled = true;
this.cmbCat2.IntegralHeight = false;
this.cmbCat2.Location = new System.Drawing.Point(525, 5);
this.cmbCat2.Location = new System.Drawing.Point(525, 7);
this.cmbCat2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat2.Name = "cmbCat2";
this.cmbCat2.Size = new System.Drawing.Size(151, 25);
@@ -460,7 +460,7 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbCat1.DropDownWidth = 1;
this.cmbCat1.FormattingEnabled = true;
this.cmbCat1.IntegralHeight = false;
this.cmbCat1.Location = new System.Drawing.Point(298, 5);
this.cmbCat1.Location = new System.Drawing.Point(298, 7);
this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat1.Name = "cmbCat1";
this.cmbCat1.Size = new System.Drawing.Size(151, 25);
@@ -520,7 +520,7 @@ namespace TemuKJD.WXForms.ProductForms
"安全+未校验",
"安全商品",
"未校验"});
this.cmbWxSafe.Location = new System.Drawing.Point(71, 40);
this.cmbWxSafe.Location = new System.Drawing.Point(71, 42);
this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbWxSafe.Name = "cmbWxSafe";
this.cmbWxSafe.Size = new System.Drawing.Size(151, 25);
@@ -543,7 +543,7 @@ namespace TemuKJD.WXForms.ProductForms
//
this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroupFilter.FormattingEnabled = true;
this.cmbGroupFilter.Location = new System.Drawing.Point(934, 7);
this.cmbGroupFilter.Location = new System.Drawing.Point(934, 5);
this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbGroupFilter.Name = "cmbGroupFilter";
this.cmbGroupFilter.Size = new System.Drawing.Size(151, 25);
@@ -564,7 +564,7 @@ namespace TemuKJD.WXForms.ProductForms
"机会商品",
"以图搜品",
"外部数据"});
this.cmbSourceType.Location = new System.Drawing.Point(733, 40);
this.cmbSourceType.Location = new System.Drawing.Point(733, 42);
this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSourceType.Name = "cmbSourceType";
this.cmbSourceType.Size = new System.Drawing.Size(151, 25);
+1 -1
View File
@@ -703,7 +703,7 @@ namespace TemuKJD.WXForms.ShopForms
return result;
}
public static string CheckShopLogin(ShopLoginInfo shop, string refere = "https://mms.pinduoduo.com/home/")
public static string CheckShopLogin(ShopLoginInfo shop, string refere = "https://store.weixin.qq.com/shop/home")
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodebase/reachDiolog/getBizNotifyConfig?token=&lang=zh_CN";
string body = @"{""path"":""https://store.weixin.qq.com/shop/home""}";
@@ -0,0 +1,478 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Param;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Result.WXResult;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.PDDForms.ProductSelectForms;
using TemuKJD.PDDForms.ShopForms;
using TemuKJD.ToolForms;
using Work;
namespace TemuKJD.WXForms.TalkForms
{
public partial class BuyerOrderListForm : BaseGeneralForm
{
private static BuyerOrderListForm instance = null;
public static BuyerOrderListForm Instance { get { if (instance == null || instance.IsDisposed || instance.Disposing) instance = new BuyerOrderListForm(); return instance; } }
ShopLoginInfo currentShop { get { return this.lblCurrentShop.Tag as ShopLoginInfo; } }
ConcurrentList<WxOrderInfoLite> lstWxOrderInfoLite { get; set; } = new ConcurrentList<WxOrderInfoLite>();
public CancellationTokenSource cancellationTokenSource { get; set; } = new CancellationTokenSource();
public bool loadComplate = false;
public bool firstVisible = false;
public DateTime nextGetOrderTime = DateTime.Now;
public BuyerOrderListForm()
{
InitializeComponent();
instance = this;
}
private void ProductListForm_Load(object sender, EventArgs e)
{
dtpStartTime.Value = DateTime.Now.Date.AddMonths(-1);
dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
dgvBuyer.AddSelectorColumn("colSelect");
GetBuyer();
AutoGetOrder();
loadComplate = true;
}
private void ProductListForm_VisibleChanged(object sender, EventArgs e)
{
}
void GetBuyer()
{
var ids = dgvBuyer.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).Select(s => s.Cells["colBuyerId"].Value.ParseToString()).ToList();
Invoke(new Action(() => { pbLoading.Visible = true; }));
Task.Run(() =>
{
var url = BaseClass.BuildPDDObjString("user/get_buyer");
var data = UserLogin.GetSignaturex();
data += "&page_size=200";
var result = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
if (result.Contains("\"code\":200"))
{
List<BuyerLoginInfo> loginInfoLst = JsonHelper.DeserializeJsonToList<BuyerLoginInfo>(JsonHelper.JObjectParse(result)["data"].ParseToString());
GlobalConfig.BuyerLoginList.Clear();
GlobalConfig.BuyerLoginList.AddRange(loginInfoLst);
Invoke(new Action(() =>
{
dgvBuyer.Rows.Clear();
}));
foreach (var buyer in GlobalConfig.BuyerLoginList)
{
Invoke(new Action(() =>
{
var rowIndex = this.dgvBuyer.Rows.Add(
ids.Contains(buyer.buyer_id),
buyer.buyer_id,
buyer.buyer_name,
buyer.buyer_nick,
buyer.notes,
"访问",
buyer.status
);
}));
}
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
}));
});
}
void AutoGetOrder()
{
Task.Run(() =>
{
while (true)
{
if (DateTime.Now > nextGetOrderTime)
{
nextGetOrderTime = DateTime.Now.AddMinutes(30);
GetOrder();
}
Thread.Sleep(1000);
Invoke(new Action(() =>
{
var ticks = nextGetOrderTime - DateTime.Now;
btnSearch.Text = "刷新订单 " + ticks.Minutes + ":" + ticks.Seconds;
}));
}
});
}
void GetOrder()
{
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
foreach (var shop in GlobalConfig.ShopLoginList)
{
}
}, cancellationTokenSource.Token);
}
private void btnSearch_Click(object sender, EventArgs e)
{
nextGetOrderTime = DateTime.Now.AddMinutes(30);
GetOrder();
}
private void pnlEmpty_Click(object sender, EventArgs e)
{
this.txtOrderSn.Text = "";
}
private void dgvDbProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvDbProduct.Columns[e.ColumnIndex].HeaderText;
//var dbId = dgvDbProduct.Rows[e.RowIndex].Cells["col_db_id"].Value.ParseToString();
//var dbProduct = lstTemuDbProduct.FirstOrDefault(p => p.id.ToString() == dbId);
switch (headerText)
{
case "详情":
case "编辑/详情":
//PDDDBProdEditForm editForm = new PDDDBProdEditForm(dbProduct);
//if (BaseClass.MainPath != "binxixi")
//{
// editForm.pnlSkuOption.Visible = false;
// editForm.txtProductName.ReadOnly = true;
// editForm.txtExtCode.ReadOnly = true;
// editForm.lblSkcId.Text = "仓库编码";
//}
//editForm.ShowDialog();
//dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes;
//dgvDbProduct.Rows[e.RowIndex].Cells["col_ext_code"].Value = dbProduct.ext_code;
//dgvDbProduct.Rows[e.RowIndex].Cells["colHeadWords"].Value = dbProduct.head_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["colEndWords"].Value = dbProduct.end_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["colFissionWords"].Value = dbProduct.fission_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["col_product_name"].Value = dbProduct.product_name;
//dgvDbProduct.Rows[e.RowIndex].Cells["colSkuReplaceImgUrl"].Value = dbProduct.sku_img_replace_url;
break;
case "主图":
ShowImgForm imgFrom = new ShowImgForm(dgvDbProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("?imageView2/2/w/90/h/90", ""));
imgFrom.ShowDialog();
break;
case "":
dgvDbProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvDbProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
default:
break;
}
}
private void dgvDbProduct_Scroll(object sender, ScrollEventArgs e)
{
}
private void btnStopStop_Click(object sender, EventArgs e)
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
Task.Run(() =>
{
Thread.Sleep(3000);
Invoke(new Action(() =>
{
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
pbLoading.Visible = false;
}));
});
}
private void PDDDBProdListForm_KeyDown(object sender, KeyEventArgs e)
{
}
private void PDDDBProdListForm_KeyUp(object sender, KeyEventArgs e)
{
}
private void WXUserProdListForm_FormClosing(object sender, FormClosingEventArgs e)
{
this.Hide();
e.Cancel = true;
}
private void btnAddBuyler_Click(object sender, EventArgs e)
{
PddMobileLoginForm buyerLoginForm = new PddMobileLoginForm(null);
buyerLoginForm.openType = EnumOpenType.login;
buyerLoginForm.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
buyerLoginForm.ShowDialog();
GetBuyer();
}
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvBuyer.Columns[e.ColumnIndex].HeaderText;
var buyerId = dgvBuyer.Rows[e.RowIndex].Cells["colBuyerId"].Value.ParseToString();
var buyer = GlobalConfig.BuyerLoginList.FirstOrDefault(p => p.buyer_id.ToString() == buyerId);
switch (headerText)
{
case "状态":
case "登录":
CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
if (buyer.status == "在线")
{
PddMobileLoginForm shopLoginForm = new PddMobileLoginForm(buyer);
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.WindowState = FormWindowState.Maximized;
shopLoginForm.InitUrl = "https://mobile.yangkeduo.com";
shopLoginForm.Show();
}
else
{
PddMobileLoginForm shopLoginForm = new PddMobileLoginForm(buyer);
shopLoginForm.openType = EnumOpenType.login;
shopLoginForm.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
shopLoginForm.ShowDialog();
GetBuyer();
}
break;
case "访问":
{
PddMobileLoginForm shopLoginForm = new PddMobileLoginForm(buyer);
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.WindowState = FormWindowState.Maximized;
shopLoginForm.InitUrl = "https://mobile.yangkeduo.com";
shopLoginForm.Show();
}
break;
case "详情":
case "编辑/详情":
//PDDDBProdEditForm editForm = new PDDDBProdEditForm(dbProduct);
//if (BaseClass.MainPath != "binxixi")
//{
// editForm.pnlSkuOption.Visible = false;
// editForm.txtProductName.ReadOnly = true;
// editForm.txtExtCode.ReadOnly = true;
// editForm.lblSkcId.Text = "仓库编码";
//}
//editForm.ShowDialog();
//dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes;
//dgvDbProduct.Rows[e.RowIndex].Cells["col_ext_code"].Value = dbProduct.ext_code;
//dgvDbProduct.Rows[e.RowIndex].Cells["colHeadWords"].Value = dbProduct.head_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["colEndWords"].Value = dbProduct.end_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["colFissionWords"].Value = dbProduct.fission_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["col_product_name"].Value = dbProduct.product_name;
//dgvDbProduct.Rows[e.RowIndex].Cells["colSkuReplaceImgUrl"].Value = dbProduct.sku_img_replace_url;
break;
case "":
case "全选":
dgvBuyer.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvBuyer.Rows[e.RowIndex].Cells["colSelect"].Value;
break;
default:
break;
}
}
public void CheckBuyerLogin(List<BuyerLoginInfo> checkBuyers, bool isShowProgress = true)
{
for (int i = 0; i < checkBuyers.Count; i++)
{
var buyer = GlobalConfig.BuyerLoginList.FirstOrDefault(v => v.buyer_id == checkBuyers[i].buyer_id);
var buys = GlobalConfig.BuyerLoginList.Where(v => v.buyer_id == checkBuyers[i].buyer_id).ToList();
if (buyer == null)
continue;
// 先从服务端取最新cookie
var url = BaseClass.BuildPDDObjString("user/get_buyer");
var data = UserLogin.GetSignaturex();
data += "&buyer_id=" + buyer.buyer_id;
data += "&page_size=1";
var result = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
continue;
List<BuyerLoginInfo> loginInfoLst = JsonHelper.DeserializeJsonToList<BuyerLoginInfo>(JsonHelper.JObjectParse(result)["data"].ParseToString());
var serverBuyer = loginInfoLst.FirstOrDefault();
if (buyer != null && serverBuyer != null)
{
buyer.cookie = serverBuyer.cookie;
foreach (var buy in buys)
{
buy.cookie = serverBuyer.cookie;
}
}
if (buyer != null)
{
var loginResult = CheckBuyerLogin(buyer);
if (loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true"))
{
buyer.cookie = "[]";
foreach (var buy in buys)
{
buy.status = "掉线";
buy.cookie = "[]";
}
}
else
{
foreach (var buy in buys)
{
buy.status = "在线";
}
}
UpdateServerBuyerCookies(buyer); // 店铺cookie和状态写入服务端
}
if (this.Created && isShowProgress)
{
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在检测...";
this.statusBar.pgbTaskProgress.Value = (i + 1);
this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + checkBuyers.Count;
}));
}
}
}
public static string CheckBuyerLogin(BuyerLoginInfo buyer, string refere = "https://mobile.yangkeduo.com/goods.html")
{
string url = "https://mobile.yangkeduo.com/proxy/api/api/apollo/v3/user/me?pdduid=" + buyer.buyer_id;
return YkdHttpResponseBLL.YangkeduoGetResponse(buyer, url, refere);
}
public static string UpdateServerBuyerCookies(BuyerLoginInfo buyer, string fromTool = null)
{
var url = BaseClass.BuildPDDObjString("user/mdy_buyer_cookie");
var data = UserLogin.GetSignaturex()
+ "&status=" + buyer.status
+ "&cookie=" + GetHtml.UrlEncodeUtf8(buyer.cookie)
+ "&buyer_id=" + buyer.buyer_id;
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
return result;
}
private void btnRefresh_Click(object sender, EventArgs e)
{
GetBuyer();
}
private void btnCheck_Click(object sender, EventArgs e)
{
var ids = dgvBuyer.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).Select(s => s.Cells["colBuyerId"].Value.ParseToString()).ToList();
var buyers = GlobalConfig.BuyerLoginList.Where(b => ids.Contains(b.buyer_id)).ToList();
Task.Run(() => {
CheckBuyerLogin(buyers);
GetBuyer();
});
}
private void btnDel_Click(object sender, EventArgs e)
{
if (BaseMsgForm.ShowConfirm("确定删除吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
return;
var ids = dgvBuyer.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).Select(s => s.Cells["colBuyerId"].Value.ParseToString()).ToList();
var buyers = GlobalConfig.BuyerLoginList.Where(b => ids.Contains(b.buyer_id)).ToList();
this.statusBar.pgbTaskProgress.Maximum = buyers.Count;
pbLoading.Visible = true;
Task.Run(() =>
{
int i = 0;
foreach (var buyer in buyers)
{
i++;
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在删除...";
this.statusBar.pgbTaskProgress.Value = i;
this.statusBar.pgbTaskProgress.Text = i + "/" + buyers.Count;
}));
var url = BaseClass.BuildPDDObjString("user/del_buyer");
var data = UserLogin.GetSignaturex()
+ "&buyer_id=" + buyer.buyer_id;
var result = GetHtml.PostUtf8(url, data);
Thread.Sleep(100);
}
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "删除完成";
this.statusBar.pgbTaskProgress.Value = buyers.Count;
this.statusBar.pgbTaskProgress.Text = buyers.Count + "/" + buyers.Count;
}));
GetBuyer();
});
}
}
public class YkdBuyerOrder
{
}
public class WxOrder
{
// orderStatus:20待发货 0售后中 30已发货
public static string OrderSeach(ShopLoginInfo shop, string orderId, string telNumber, int orderStatus = 20, int page = 1, string startTime="", string endTime="")
{
if (string.IsNullOrWhiteSpace(startTime))
startTime = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddMonths(-1)).ToString();
if (string.IsNullOrWhiteSpace(endTime))
endTime = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date).ToString();
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeorder/list/cgi/orderSearch?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/order/list";
string body = @"{""isSearch"":true,""pageSize"":100,""overTime"":0,""pengingShipOneDay"":0,""pengingShipSixHour"":0,""expediteDelivery"":0," +
@"""stockoutPunishAlert"":0,""waybillStatus"":0,""pageNum"":1,""onAftersaleOrderExist"":0,""orderStatus"":" + orderStatus +
@",""page"":" + page + @",""orderId"":""" + orderId + @""",""orderTime"":{""type"":0,""time"":[" + startTime + @"," + endTime + @"]}," +
@"""telNumber"":""" + telNumber + @""",""title"":"""",""receiverName"":"""",""finderNickName"":"""",""merchantNotes"":""""," +
@"""merchantNotesTagColor"":0,""waybillId"":"""",""productCode"":"""",""inspectStatus"":"""",""finderWay"":0,""searchOrderType"":0," +
@"""payMethod"":0,""orderChannel"":0,""bulkbuyActivityId"":"""",""deliveryNegotiationFlag"":0,""transactionId"":""""," +
@"""startCreateTime"":" + startTime + @",""endCreateTime"":" + endTime + @"}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
}
}
@@ -117,7 +117,7 @@
<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">
<metadata name="colCheck.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">
@@ -141,79 +141,37 @@
<metadata name="colRealPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_skc_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colBuyerMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMainCate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_cat_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCatBound.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_ext_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colStyleCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colGroup.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPriceText.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colExtCodePrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colEdit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colAddTimes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSelectTotalCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSaleCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colOrderStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_notes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colHeadWords.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colEdit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colEndWords.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colFissionWords.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colBuyerId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colGetType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colBuyerNick.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSpProdType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colShopNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colWxSafe.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colVisit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colAddTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMdyTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_edit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_delete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_select_product.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
@@ -1,305 +0,0 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Param;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Result.WXResult;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.PDDForms.ProductSelectForms;
using TemuKJD.ToolForms;
using Work;
namespace TemuKJD.WXForms.TalkForms
{
public partial class WxOrderListForm : BaseGeneralForm
{
private static WxOrderListForm instance = null;
public static WxOrderListForm Instance { get { if (instance == null || instance.IsDisposed || instance.Disposing) instance = new WxOrderListForm(); return instance; } }
ShopLoginInfo currentShop { get; set; } = null;
ConcurrentList<KJDDBProduct> lstTemuDbProduct { get; set; } = new ConcurrentList<KJDDBProduct>();
public CancellationTokenSource cancellationTokenSource { get; set; } = new CancellationTokenSource();
public WxOrderListForm()
{
InitializeComponent();
instance = this;
}
private void ProductListForm_Load(object sender, EventArgs e)
{
btnSelect.Visible = true;
}
private void btnSearch_Click(object sender, EventArgs e)
{
}
Bitmap defaultBitmap = null;
void ShowDgvImg()
{
Task.Run(() =>
{
foreach (DataGridViewRow row in this.dgvDbProduct.Rows)
{
if (row.Index > 0 && row.Cells["colMainImg"].Displayed == false)
{
Invoke(new Action(() =>
{
try
{
row.Cells["colMainImg"].Value = defaultBitmap;
}
catch
{
}
}));
continue;
}
if (row.Cells["colMainImg"].Value != null && row.Cells["colMainImg"].Value != defaultBitmap)
continue;
Image image = null;
string imgUrl = row.Cells["colImgUrl"]?.Value.ParseToString();
string getImgError = "";
if (!string.IsNullOrWhiteSpace(imgUrl))
image = GetHtml.GetUrlImg(imgUrl, out getImgError);
if (!string.IsNullOrEmpty(getImgError))
//BaseMsgForm.ShowError("图片加载失败 " + getImgError);
image = TemuKJD.Properties.Resources.errpic;
Invoke(new Action(() =>
{
try
{
row.Cells["colMainImg"].Value = image;
}
catch
{
}
}));
}
});
}
private void ProductListForm_VisibleChanged(object sender, EventArgs e)
{
}
private void pnlEmpty_Click(object sender, EventArgs e)
{
this.txtOrderSn.Text = "";
}
private void cmbCat1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cmbCat2_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cmbCat3_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cmbCat1_MultiSelectChanged(object sender, EventArgs e)
{
}
private void cmbCat2_MultiSelectChanged(object sender, EventArgs e)
{
}
private void cmbCat3_MultiSelectChanged(object sender, EventArgs e)
{
//var cate1 = GlobalConfig.WxCatList.FirstOrDefault(c => c.level == 1 && c.name == cmbCat1.Text.Trim());
//var cates2 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate1?.cat_id).ToList();
//var cate2 = cates2.FirstOrDefault(c => c.level == 2 && c.name == cmbCat1.Text.Trim());
//var cates3 = GlobalConfig.WxCatList.Where(c => c.f_cat_id == cate2?.cat_id).ToList();
//var cate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCat1.Text.Trim());
}
private void dgvDbProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvDbProduct.Columns[e.ColumnIndex].HeaderText;
var dbId = dgvDbProduct.Rows[e.RowIndex].Cells["col_db_id"].Value.ParseToString();
var dbProduct = lstTemuDbProduct.FirstOrDefault(p => p.id.ToString() == dbId);
switch (headerText)
{
case "详情":
case "编辑/详情":
//PDDDBProdEditForm editForm = new PDDDBProdEditForm(dbProduct);
//if (BaseClass.MainPath != "binxixi")
//{
// editForm.pnlSkuOption.Visible = false;
// editForm.txtProductName.ReadOnly = true;
// editForm.txtExtCode.ReadOnly = true;
// editForm.lblSkcId.Text = "仓库编码";
//}
//editForm.ShowDialog();
//dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes;
//dgvDbProduct.Rows[e.RowIndex].Cells["col_ext_code"].Value = dbProduct.ext_code;
//dgvDbProduct.Rows[e.RowIndex].Cells["colHeadWords"].Value = dbProduct.head_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["colEndWords"].Value = dbProduct.end_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["colFissionWords"].Value = dbProduct.fission_words;
//dgvDbProduct.Rows[e.RowIndex].Cells["col_product_name"].Value = dbProduct.product_name;
//dgvDbProduct.Rows[e.RowIndex].Cells["colSkuReplaceImgUrl"].Value = dbProduct.sku_img_replace_url;
break;
case "主图":
ShowImgForm imgFrom = new ShowImgForm(dgvDbProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("?imageView2/2/w/90/h/90", ""));
imgFrom.ShowDialog();
break;
case "认领":
//Task.Run(() => { SelectProduct(new KJDDBProduct[] { dbProduct }); });
break;
case "资料编码/真实上家":
try
{
string url = "";
if (string.IsNullOrEmpty(dbProduct.real_spu_id) || string.IsNullOrEmpty(dbProduct.real_coid))
url = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + dbProduct.spu_id + "?itemCoId=" + dbProduct.skc_id + "&noBack=true";
else
url = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + dbProduct.real_spu_id + "?itemCoId=" + dbProduct.real_coid + "&noBack=true";
Process.Start(new ProcessStartInfo(url)
{
UseShellExecute = true
});
}
catch
{
// 可能需要手动指定浏览器路径
Process.Start(new ProcessStartInfo("https://www.baidu.com") { UseShellExecute = true });
}
break;
case "":
dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value;
//rowIndex1 = rowIndex2;
//rowIndex2 = e.RowIndex;
//if (IsShiftDown)
//{
// if (rowIndex1 > -1 && rowIndex2 > -1)
// {
// try
// {
// if (rowIndex1 > rowIndex2)
// {
// for (int i = rowIndex2; i <= rowIndex1; i++)
// {
// dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value;
// }
// }
// else
// {
// for (int i = rowIndex1; i <= rowIndex2; i++)
// {
// dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value;
// }
// }
// }
// catch
// {
// }
// //rowIndex1 = -1;
// //rowIndex2 = -1;
// }
//}
break;
default:
break;
}
}
private void DeleteProduct(string dbId, bool isUpdate = true)
{
var url = BaseClass.BuildPDDObjString("product/del_db_product");
var data = UserLogin.GetSignaturex() +
"&db_id=" + dbId;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
BaseMsgForm.ShowError("删除商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
return;
}
else
{
}
}
private void btnSelect_Click(object sender, EventArgs e)
{
}
private void dgvDbProduct_Scroll(object sender, ScrollEventArgs e)
{
ShowDgvImg();
}
private void btnStopStop_Click(object sender, EventArgs e)
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
Task.Run(() =>
{
Thread.Sleep(3000);
Invoke(new Action(() =>
{
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
pbLoading.Visible = false;
}));
});
}
private void PDDDBProdListForm_KeyDown(object sender, KeyEventArgs e)
{
//switch (e.KeyCode)
//{
// case Keys.Shift:
// case Keys.ShiftKey:
// case Keys.LShiftKey:
// case Keys.RShiftKey:
// IsShiftDown = true;
// break;
//}
}
private void PDDDBProdListForm_KeyUp(object sender, KeyEventArgs e)
{
}
private void WXUserProdListForm_FormClosing(object sender, FormClosingEventArgs e)
{
this.Hide();
e.Cancel = true;
}
}
}
+24 -8
View File
@@ -79,7 +79,7 @@ namespace TemuKJD.WXForms.TalkForms
public static Dictionary<DataGridViewRow, Color> dicRowColor = new Dictionary<DataGridViewRow, Color>();
public List<string> LstTagShop = new List<string>();
public WxOrderListForm WxOrderListForm = null;
public BuyerOrderListForm orderListForm = null;
public int LocationXY = 0;
public int LocationSize = 200;
@@ -169,6 +169,7 @@ namespace TemuKJD.WXForms.TalkForms
SetMainBrowserUrl(GlobalConfig.ShopLoginList.FirstOrDefault());
LoadShop();
InitOrderForm(); // 加载店铺确认默认店铺后再初始化订单列表读取
InitAutoExecute();
Invoke(new Action(() =>
{
@@ -335,13 +336,6 @@ namespace TemuKJD.WXForms.TalkForms
}
});
WxOrderListForm = new WxOrderListForm();
WxOrderListForm.TopLevel = false;
WxOrderListForm.FormBorderStyle = FormBorderStyle.None;
WxOrderListForm.Dock = DockStyle.Fill;
tabPage3.Controls.Add(WxOrderListForm);
WxOrderListForm.Show();
//var _1688AddressForm = new GetAddressForm() { AddressType = "1688" };
//_1688AddressForm.cmbType.Enabled = false;
//_1688AddressForm.cmbTypeFilter.Enabled = false;
@@ -352,6 +346,24 @@ namespace TemuKJD.WXForms.TalkForms
//_1688AddressForm.Show();
}
void InitOrderForm()
{
Invoke(new Action(() =>
{
orderListForm = new BuyerOrderListForm();
orderListForm.TopLevel = false;
orderListForm.FormBorderStyle = FormBorderStyle.None;
orderListForm.Dock = DockStyle.Fill;
orderListForm.lblCurrentShop.Text = currentShop?.ShopAccount;
orderListForm.lblCurrentShop.Tag = currentShop;
tabPage3.Controls.Add(orderListForm);
orderListForm.Show();
}));
}
void ClosePopWindow()
{
Task.Run(() =>
@@ -1339,6 +1351,10 @@ namespace TemuKJD.WXForms.TalkForms
}
currentShop = shop;
orderListForm.lblCurrentShop.Text = currentShop.ShopAccount;
orderListForm.lblCurrentShop.Tag = currentShop;
shop.Chat.Dock = DockStyle.Fill;
shop.Chat.BringToFront();
btnPrev.BringToFront();