优化活动报名,官方大促暂时不能报名待修复
This commit is contained in:
1 parent
abf3cfbd89
commit
738ec76bf1
4 files changed
+215
-126
No files matched your search
@@ -44,6 +44,11 @@ namespace AllBase.Model.Result
|
||||
public List<TemuActivityLabelInfo> activityLabelList { get; set; }
|
||||
public string activityThematicName { get; set; }
|
||||
public string discount { get; set; } = "";
|
||||
public int activityType { get; set; }
|
||||
/// <summary>
|
||||
/// 活动类型的名称
|
||||
/// </summary>
|
||||
public string activityTypeName { get; set; }
|
||||
}
|
||||
|
||||
public class TemuActivitySiteInfo
|
||||
|
||||
+97
-76
@@ -76,13 +76,6 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.splitContainer5 = new System.Windows.Forms.SplitContainer();
|
||||
this.dgvActivity = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.colCheckActivity = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colActivityId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSignUpTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colDiscount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.colCheckProduct = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -103,6 +96,15 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnClear = new DevComponents.DotNetBar.PanelEx();
|
||||
this.colCheckActivity = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colActivityType = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityTypeName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityThematicId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityThematicName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSignUpTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colDiscount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colActivityMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -154,7 +156,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer3);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1029, 544);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1425, 544);
|
||||
this.splitContainer1.SplitterDistance = 120;
|
||||
this.splitContainer1.TabIndex = 11;
|
||||
//
|
||||
@@ -175,7 +177,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.ucGroupBoxEx3.Controls.Add(this.panel1);
|
||||
this.ucGroupBoxEx3.Location = new System.Drawing.Point(272, 2);
|
||||
this.ucGroupBoxEx3.Name = "ucGroupBoxEx3";
|
||||
this.ucGroupBoxEx3.Size = new System.Drawing.Size(755, 120);
|
||||
this.ucGroupBoxEx3.Size = new System.Drawing.Size(1151, 120);
|
||||
this.ucGroupBoxEx3.TabIndex = 666;
|
||||
this.ucGroupBoxEx3.TabStop = false;
|
||||
this.ucGroupBoxEx3.Text = "活动设置";
|
||||
@@ -302,7 +304,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
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(670, 32);
|
||||
this.panelEx2.Location = new System.Drawing.Point(1066, 32);
|
||||
this.panelEx2.Name = "panelEx2";
|
||||
this.panelEx2.Size = new System.Drawing.Size(70, 23);
|
||||
this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
@@ -532,7 +534,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
// splitContainer3.Panel2
|
||||
//
|
||||
this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
|
||||
this.splitContainer3.Size = new System.Drawing.Size(1029, 420);
|
||||
this.splitContainer3.Size = new System.Drawing.Size(1425, 420);
|
||||
this.splitContainer3.SplitterDistance = 390;
|
||||
this.splitContainer3.TabIndex = 1;
|
||||
//
|
||||
@@ -552,7 +554,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.splitContainer5);
|
||||
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1029, 390);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1425, 390);
|
||||
this.splitContainer2.SplitterDistance = 270;
|
||||
this.splitContainer2.TabIndex = 0;
|
||||
//
|
||||
@@ -662,7 +664,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
// splitContainer5.Panel2
|
||||
//
|
||||
this.splitContainer5.Panel2.Controls.Add(this.dgvProduct);
|
||||
this.splitContainer5.Size = new System.Drawing.Size(751, 390);
|
||||
this.splitContainer5.Size = new System.Drawing.Size(1147, 390);
|
||||
this.splitContainer5.SplitterDistance = 134;
|
||||
this.splitContainer5.TabIndex = 0;
|
||||
//
|
||||
@@ -686,8 +688,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.dgvActivity.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvActivity.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colCheckActivity,
|
||||
this.colActivityId,
|
||||
this.colActivityName,
|
||||
this.colActivityType,
|
||||
this.colActivityTypeName,
|
||||
this.colActivityThematicId,
|
||||
this.colActivityThematicName,
|
||||
this.colActivityTime,
|
||||
this.colSignUpTime,
|
||||
this.colDiscount,
|
||||
@@ -697,58 +701,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.dgvActivity.Name = "dgvActivity";
|
||||
this.dgvActivity.ReadOnly = true;
|
||||
this.dgvActivity.RowTemplate.Height = 23;
|
||||
this.dgvActivity.Size = new System.Drawing.Size(751, 134);
|
||||
this.dgvActivity.Size = new System.Drawing.Size(1147, 134);
|
||||
this.dgvActivity.TabIndex = 189;
|
||||
this.dgvActivity.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvActivity_CellContentClick);
|
||||
//
|
||||
// colCheckActivity
|
||||
//
|
||||
this.colCheckActivity.FillWeight = 15F;
|
||||
this.colCheckActivity.HeaderText = "选择";
|
||||
this.colCheckActivity.Name = "colCheckActivity";
|
||||
this.colCheckActivity.ReadOnly = true;
|
||||
this.colCheckActivity.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colCheckActivity.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// colActivityId
|
||||
//
|
||||
this.colActivityId.HeaderText = "活动编号";
|
||||
this.colActivityId.Name = "colActivityId";
|
||||
this.colActivityId.ReadOnly = true;
|
||||
this.colActivityId.Visible = false;
|
||||
//
|
||||
// colActivityName
|
||||
//
|
||||
this.colActivityName.HeaderText = "活动主题";
|
||||
this.colActivityName.Name = "colActivityName";
|
||||
this.colActivityName.ReadOnly = true;
|
||||
//
|
||||
// colActivityTime
|
||||
//
|
||||
this.colActivityTime.HeaderText = "活动时间";
|
||||
this.colActivityTime.Name = "colActivityTime";
|
||||
this.colActivityTime.ReadOnly = true;
|
||||
//
|
||||
// colSignUpTime
|
||||
//
|
||||
this.colSignUpTime.FillWeight = 50F;
|
||||
this.colSignUpTime.HeaderText = "报名截止";
|
||||
this.colSignUpTime.Name = "colSignUpTime";
|
||||
this.colSignUpTime.ReadOnly = true;
|
||||
//
|
||||
// colDiscount
|
||||
//
|
||||
this.colDiscount.FillWeight = 50F;
|
||||
this.colDiscount.HeaderText = "活动折扣";
|
||||
this.colDiscount.Name = "colDiscount";
|
||||
this.colDiscount.ReadOnly = true;
|
||||
//
|
||||
// colActivityMsg
|
||||
//
|
||||
this.colActivityMsg.HeaderText = "状态";
|
||||
this.colActivityMsg.Name = "colActivityMsg";
|
||||
this.colActivityMsg.ReadOnly = true;
|
||||
//
|
||||
// dgvProduct
|
||||
//
|
||||
this.dgvProduct.AllowUserToAddRows = false;
|
||||
@@ -787,7 +743,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.dgvProduct.Name = "dgvProduct";
|
||||
this.dgvProduct.ReadOnly = true;
|
||||
this.dgvProduct.RowTemplate.Height = 23;
|
||||
this.dgvProduct.Size = new System.Drawing.Size(751, 252);
|
||||
this.dgvProduct.Size = new System.Drawing.Size(1147, 252);
|
||||
this.dgvProduct.TabIndex = 188;
|
||||
//
|
||||
// colCheckProduct
|
||||
@@ -918,8 +874,8 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
//
|
||||
this.splitContainer4.Panel2.Controls.Add(this.panelEx1);
|
||||
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
|
||||
this.splitContainer4.Size = new System.Drawing.Size(1029, 26);
|
||||
this.splitContainer4.SplitterDistance = 751;
|
||||
this.splitContainer4.Size = new System.Drawing.Size(1425, 26);
|
||||
this.splitContainer4.SplitterDistance = 1147;
|
||||
this.splitContainer4.TabIndex = 3;
|
||||
//
|
||||
// statusBar
|
||||
@@ -930,7 +886,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.statusBar.Location = new System.Drawing.Point(0, 0);
|
||||
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.statusBar.Name = "statusBar";
|
||||
this.statusBar.Size = new System.Drawing.Size(751, 26);
|
||||
this.statusBar.Size = new System.Drawing.Size(1147, 26);
|
||||
this.statusBar.TabIndex = 2;
|
||||
//
|
||||
// panelEx1
|
||||
@@ -983,11 +939,74 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
this.btnClear.Text = "清空结果";
|
||||
this.btnClear.Visible = false;
|
||||
//
|
||||
// colCheckActivity
|
||||
//
|
||||
this.colCheckActivity.FillWeight = 15F;
|
||||
this.colCheckActivity.HeaderText = "选择";
|
||||
this.colCheckActivity.Name = "colCheckActivity";
|
||||
this.colCheckActivity.ReadOnly = true;
|
||||
this.colCheckActivity.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colCheckActivity.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// colActivityType
|
||||
//
|
||||
this.colActivityType.FillWeight = 50F;
|
||||
this.colActivityType.HeaderText = "活动类型";
|
||||
this.colActivityType.Name = "colActivityType";
|
||||
this.colActivityType.ReadOnly = true;
|
||||
//
|
||||
// colActivityTypeName
|
||||
//
|
||||
this.colActivityTypeName.FillWeight = 70F;
|
||||
this.colActivityTypeName.HeaderText = "活动类名";
|
||||
this.colActivityTypeName.Name = "colActivityTypeName";
|
||||
this.colActivityTypeName.ReadOnly = true;
|
||||
//
|
||||
// colActivityThematicId
|
||||
//
|
||||
this.colActivityThematicId.FillWeight = 50F;
|
||||
this.colActivityThematicId.HeaderText = "活动编号";
|
||||
this.colActivityThematicId.Name = "colActivityThematicId";
|
||||
this.colActivityThematicId.ReadOnly = true;
|
||||
this.colActivityThematicId.Visible = false;
|
||||
//
|
||||
// colActivityThematicName
|
||||
//
|
||||
this.colActivityThematicName.HeaderText = "活动主题";
|
||||
this.colActivityThematicName.Name = "colActivityThematicName";
|
||||
this.colActivityThematicName.ReadOnly = true;
|
||||
//
|
||||
// colActivityTime
|
||||
//
|
||||
this.colActivityTime.HeaderText = "活动时间";
|
||||
this.colActivityTime.Name = "colActivityTime";
|
||||
this.colActivityTime.ReadOnly = true;
|
||||
//
|
||||
// colSignUpTime
|
||||
//
|
||||
this.colSignUpTime.FillWeight = 60F;
|
||||
this.colSignUpTime.HeaderText = "报名截止";
|
||||
this.colSignUpTime.Name = "colSignUpTime";
|
||||
this.colSignUpTime.ReadOnly = true;
|
||||
//
|
||||
// colDiscount
|
||||
//
|
||||
this.colDiscount.FillWeight = 50F;
|
||||
this.colDiscount.HeaderText = "活动折扣";
|
||||
this.colDiscount.Name = "colDiscount";
|
||||
this.colDiscount.ReadOnly = true;
|
||||
//
|
||||
// colActivityMsg
|
||||
//
|
||||
this.colActivityMsg.HeaderText = "状态";
|
||||
this.colActivityMsg.Name = "colActivityMsg";
|
||||
this.colActivityMsg.ReadOnly = true;
|
||||
//
|
||||
// MarketingActivityForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(1029, 544);
|
||||
this.ClientSize = new System.Drawing.Size(1425, 544);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "MarketingActivityForm";
|
||||
this.Text = "店铺优化";
|
||||
@@ -1093,16 +1112,18 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colInventory;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckActivity;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colSignUpTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colDiscount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityMsg;
|
||||
private System.Windows.Forms.NumericUpDown numSaleCount;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ComboBox cmbDays;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckActivity;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityType;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityTypeName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityThematicId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityThematicName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colSignUpTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colDiscount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityMsg;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||
public List<TemuActivityThematicInfo> lstActivityThematic { get; set; } = new List<TemuActivityThematicInfo>();
|
||||
public List<string> lstShopIdSelect = new List<string>();
|
||||
public List<string> lstActivityIdSelect = new List<string>();
|
||||
public List<string> lstActivityThematicIdSelect = new List<string>();
|
||||
public List<int> lstDiscount = new List<int>() { 60, 70, 80, 85 };
|
||||
public Dictionary<string, List<SubOrderInfo>> dicNoSaleProd = new Dictionary<string, List<SubOrderInfo>>();
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
return;
|
||||
string headerText = dgvActivity.Columns[e.ColumnIndex].HeaderText;
|
||||
string columnName = dgvActivity.Columns[e.ColumnIndex].Name;
|
||||
long activityId = dgvActivity.Rows[e.RowIndex].Cells["colActivityId"].Value.ParseToLong();
|
||||
long activityId = dgvActivity.Rows[e.RowIndex].Cells["colActivityThematicId"].Value.ParseToLong();
|
||||
var activity = lstActivityThematic.FirstOrDefault(s => s.activityThematicId == activityId);
|
||||
var row = dgvActivity.Rows[e.RowIndex];
|
||||
switch (columnName)
|
||||
@@ -340,24 +340,60 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
jArr = jObj["result"]?["activityList"] as JArray;
|
||||
if (jArr == null)
|
||||
jArr = new JArray();
|
||||
}
|
||||
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
string sItem = item.ToString();
|
||||
TemuActivityInfo pActivity = JsonHelper.DeserializeJsonToObject<TemuActivityInfo>(sItem); // 反序列化得到类
|
||||
if (pActivity == null || pActivity.activityName != "大促进阶-限时活动")
|
||||
continue;
|
||||
|
||||
foreach (var pInfo in pActivity.thematicList)
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
lstActivityThematic.Add(pInfo);
|
||||
string name = pInfo.activityThematicName;
|
||||
pInfo.discount = BaseRegex.GetMatchRegexString(ref name, "(\\d{1,3}折)").ParseToString();
|
||||
pInfo.discount = pInfo.discount.Replace("折", "");
|
||||
pInfo.discount = string.IsNullOrWhiteSpace(pInfo.discount) ? "" : pInfo.discount;
|
||||
string sItem = item.ToString();
|
||||
TemuActivityInfo pActivity = JsonHelper.DeserializeJsonToObject<TemuActivityInfo>(sItem); // 反序列化得到类
|
||||
//if (pActivity == null || pActivity.activityName != "大促进阶-限时活动")
|
||||
// continue;
|
||||
if (pActivity.activityType == 51 || pActivity.activityName == "跨店满减") // 51 跨店满减平台补贴活动直接跳过
|
||||
continue;
|
||||
if (pActivity.benefitLabelName.Contains("平台补贴"))
|
||||
continue;
|
||||
if (pActivity.activityType == 52)
|
||||
{
|
||||
}
|
||||
|
||||
if (pActivity.thematicList.Count == 0)
|
||||
{
|
||||
pActivity.thematicList.Add(new TemuActivityThematicInfo()
|
||||
{
|
||||
activityType = pActivity.activityType, // 一级活动类型
|
||||
activityTypeName = pActivity.activityName, // 一级活动名称
|
||||
activityLabelDesc = pActivity.activityLabelDesc,
|
||||
activityLabelList = new List<TemuActivityLabelInfo>(),
|
||||
activityLabelTag = pActivity.activityLabelTag,
|
||||
activityThematicContent = pActivity.activityContent,
|
||||
activityThematicId = pActivity.activityType,
|
||||
activityThematicName = pActivity.activityName,
|
||||
benefitLabelName = pActivity.benefitLabelName,
|
||||
canEnrollTotal = null,
|
||||
discount = "",
|
||||
durationDays = 0,
|
||||
endTime = pActivity.sessionEndTime,
|
||||
startTime = pActivity.sessionStartTime,
|
||||
enrollDeadLine = null,
|
||||
enrolledCount = null,
|
||||
enrollSource = null,
|
||||
enrollStartAt = null,
|
||||
salePromotionLabel = null,
|
||||
sites = new List<TemuActivitySiteInfo>(),
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var pActThematic in pActivity.thematicList)
|
||||
{
|
||||
pActThematic.activityType = pActivity.activityType;
|
||||
pActThematic.activityTypeName = pActivity.activityName;
|
||||
lstActivityThematic.Add(pActThematic);
|
||||
string name = pActThematic.activityThematicName;
|
||||
pActThematic.discount = BaseRegex.GetMatchRegexString(ref name, "(\\d{1,3}折)").ParseToString();
|
||||
pActThematic.discount = pActThematic.discount.Replace("折", "");
|
||||
pActThematic.discount = string.IsNullOrWhiteSpace(pActThematic.discount) ? "" : pActThematic.discount;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
|
||||
|
||||
int total = BaseRegex.GetStringJson(ref jsonRst, "total").ParseToInt();
|
||||
totalPage = Math.Ceiling(total / 10.0).ParseToInt();
|
||||
@@ -388,24 +424,33 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
|
||||
foreach (var actInfo in lstActivityThematic)
|
||||
{
|
||||
string sActivityTime = BaseClass.StampToDateTime((int)(actInfo.startTime.ParseToLong() / 1000)).ToString("yyyy/MM/dd HH:mm:ss") + "~" +
|
||||
BaseClass.StampToDateTime((int)(actInfo.endTime.ParseToLong() / 1000)).ToString("yyyy/MM/dd HH:mm:ss") + "(" +
|
||||
actInfo.durationDays + "天)";
|
||||
string sActivityRemaining = "";
|
||||
string sActivityTime = "-";
|
||||
if (actInfo.startTime.ParseToLong() > 0 && actInfo.endTime.ParseToLong() > 0)
|
||||
{
|
||||
sActivityTime = BaseClass.StampToDateTime((int)(actInfo.startTime.ParseToLong() / 1000)).ToString("yyyy/MM/dd HH:mm:ss") + "~" +
|
||||
BaseClass.StampToDateTime((int)(actInfo.endTime.ParseToLong() / 1000)).ToString("yyyy/MM/dd HH:mm:ss") + "(" +
|
||||
actInfo.durationDays + "天)";
|
||||
}
|
||||
string sActivityRemaining = "-";
|
||||
TimeSpan timeRemaining = BaseClass.StampToDateTime((int)(actInfo.enrollDeadLine.ParseToLong() / 1000)) - DateTime.Now;
|
||||
if (timeRemaining.Days >= 1)
|
||||
sActivityRemaining = timeRemaining.Days + "天后截止";
|
||||
else if (timeRemaining.Hours >= 1)
|
||||
sActivityRemaining = timeRemaining.Hours + "小时后截止";
|
||||
else if (timeRemaining.Minutes >= 1)
|
||||
sActivityRemaining = timeRemaining.Minutes + "分钟后截止";
|
||||
else
|
||||
sActivityRemaining = timeRemaining.Seconds + "秒后截止";
|
||||
if (timeRemaining.TotalSeconds > 0)
|
||||
{
|
||||
if (timeRemaining.Days >= 1)
|
||||
sActivityRemaining = timeRemaining.Days + "天后截止";
|
||||
else if (timeRemaining.Hours >= 1)
|
||||
sActivityRemaining = timeRemaining.Hours + "小时后截止";
|
||||
else if (timeRemaining.Minutes >= 1)
|
||||
sActivityRemaining = timeRemaining.Minutes + "分钟后截止";
|
||||
else
|
||||
sActivityRemaining = timeRemaining.Seconds + "秒后截止";
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowId = this.dgvActivity.Rows.Add(
|
||||
false,
|
||||
actInfo.activityType,
|
||||
actInfo.activityTypeName,
|
||||
actInfo.activityThematicId,
|
||||
actInfo.activityThematicName,
|
||||
sActivityTime,
|
||||
@@ -468,7 +513,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
continue;
|
||||
|
||||
var actRow = this.dgvActivity.Rows.Cast<DataGridViewRow>()
|
||||
.FirstOrDefault(r => r.Cells["colActivityId"].Value.ParseToLong() == actInfo?.activityThematicId);
|
||||
.FirstOrDefault(r => r.Cells["colActivityThematicId"].Value.ParseToLong() == actInfo.activityThematicId);
|
||||
if (actRow == null)
|
||||
continue;
|
||||
|
||||
@@ -516,7 +561,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
int tryCount = 0;
|
||||
tryAgain:
|
||||
Thread.Sleep(100 + Randomx.GetId(200));
|
||||
string jsonRst = GetActivityMatch(shop, actInfo.activityThematicId.ParseToLong());
|
||||
string jsonRst = GetActivityMatch(shop, actInfo.activityType, actInfo.activityThematicId);
|
||||
if (jsonRst.Contains("指定的值含有无效的控制字符") || jsonRst.Contains("login") || jsonRst.Contains("Login"))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
@@ -632,7 +677,8 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
}
|
||||
|
||||
var lstActivityId = dgvActivity.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colCheckActivity"]?.Value.ParseToBool() == true).Select(r => r.Cells["colActivityId"]?.Value.ToString()).ToList();
|
||||
=> row.Cells["colCheckActivity"]?.Value.ParseToBool() == true)
|
||||
.Select(r => r.Cells["colActivityThematicId"]?.Value.ToString()).ToList();
|
||||
if (lstActivityId.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowInfo("请选择活动!");
|
||||
@@ -651,8 +697,8 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
lstShopIdSelect.Clear();
|
||||
lstShopIdSelect.AddRange(lstShopId);
|
||||
lstActivityIdSelect.Clear();
|
||||
lstActivityIdSelect.AddRange(lstActivityId);
|
||||
lstActivityThematicIdSelect.Clear();
|
||||
lstActivityThematicIdSelect.AddRange(lstActivityId);
|
||||
#endregion
|
||||
|
||||
Task.Run(() =>
|
||||
@@ -805,20 +851,20 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
if (!CheckLogin(shop))
|
||||
continue;
|
||||
|
||||
foreach (var activityId in lstActivityIdSelect)
|
||||
foreach (var activityId in lstActivityThematicIdSelect)
|
||||
{
|
||||
var activity = lstActivityThematic.FirstOrDefault(a => a.activityThematicId.ParseToString() == activityId);
|
||||
if (activity == null)
|
||||
continue;
|
||||
var actRow = this.dgvActivity.Rows.Cast<DataGridViewRow>()
|
||||
.FirstOrDefault(r => r.Cells["colActivityId"].Value.ParseToLong() == activity.activityThematicId);
|
||||
.FirstOrDefault(r => r.Cells["colActivityThematicId"].Value.ParseToLong() == activity.activityThematicId);
|
||||
if (actRow == null)
|
||||
continue;
|
||||
|
||||
int tryCount = 0;
|
||||
tryAgain:
|
||||
Thread.Sleep(100 + Randomx.GetId(200));
|
||||
var jsonRst = GetActivityMatch(shop, activity.activityThematicId, string.Join(",", noSaleProdIdLst));
|
||||
var jsonRst = GetActivityMatch(shop, activity.activityType, activity.activityThematicId, string.Join(",", noSaleProdIdLst));
|
||||
if (jsonRst.Contains("指定的值含有无效的控制字符") || jsonRst.Contains("login") || jsonRst.Contains("Login"))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
@@ -877,8 +923,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
var prodSubmitRows = new List<DataGridViewRow>();
|
||||
|
||||
TemuActivityParam activityParam = new TemuActivityParam();
|
||||
activityParam.activityType = 13;
|
||||
activityParam.activityThematicId = activity.activityThematicId;
|
||||
activityParam.activityType = activity.activityType;
|
||||
// 相同的是主活动,不需要activityThematicId就可以报名。
|
||||
if (activity.activityThematicId != activity.activityType)
|
||||
activityParam.activityThematicId = activity.activityThematicId;
|
||||
activityParam.productList = new List<ActProductListItem>();
|
||||
|
||||
foreach (var prod in prodLst)
|
||||
@@ -939,11 +987,11 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
string data = JsonHelper.SerializeObject(activityParam);
|
||||
string submitRst = "";
|
||||
Thread.Sleep(Randomx.GetId(1000, 5000));
|
||||
submitRst = SubmitActivity(shop, activityParam.activityThematicId, data);
|
||||
submitRst = SubmitActivity(shop, activityParam.activityType, activityParam.activityThematicId, data);
|
||||
for (int j = 0; j < 4 && (jsonRst.Contains("当前操作人数太多,请稍后重试") || jsonRst.Contains("too quickly")); j++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(5000, 7500));
|
||||
submitRst = SubmitActivity(shop, activityParam.activityThematicId, data);
|
||||
submitRst = SubmitActivity(shop, activityParam.activityType, activityParam.activityThematicId, data);
|
||||
}
|
||||
|
||||
if (!submitRst.Contains("\"success\":true"))
|
||||
@@ -1035,17 +1083,24 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
/// <param name="thematicId"></param>
|
||||
/// <param name="spuIds">多个用逗号隔开</param>
|
||||
/// <returns></returns>
|
||||
private string GetActivityMatch(ShopLoginInfo shop, long? thematicId, string spuIds="")
|
||||
private string GetActivityMatch(ShopLoginInfo shop,int? activityType, long? thematicId, string spuIds="")
|
||||
{
|
||||
string url = "https://agentseller.temu.com/api/kiana/gamblers/marketing/enroll/scroll/match";
|
||||
string body;
|
||||
body = @"{""activityType"":13,""activityThematicId"":" + thematicId + @",""rowCount"":50}";
|
||||
body = "{\"activityType\":" + activityType;
|
||||
if (thematicId != activityType)
|
||||
body += ",\"activityThematicId\":" + thematicId;
|
||||
body += ",\"rowCount\":50}";
|
||||
if (!string.IsNullOrWhiteSpace(spuIds))
|
||||
{
|
||||
body = @"{""activityType"":13,""activityThematicId"":" + thematicId +
|
||||
@",""rowCount"":50,""productIds"":[" + spuIds + @"],""productSkcExtCodes"":[]}";
|
||||
body = "{\"activityType\":" + activityType;
|
||||
if (thematicId != activityType)
|
||||
body += ",\"activityThematicId\":" + thematicId;
|
||||
body += ",\"rowCount\":50,\"productIds\":[" + spuIds + "],\"productSkcExtCodes\":[]}";
|
||||
}
|
||||
string refere = "https://agentseller.temu.com/activity/marketing-activity/detail-new?type=13&thematicId=" + thematicId;
|
||||
string refere = "https://agentseller.temu.com/activity/marketing-activity/detail-new?type=" + activityType;
|
||||
if (thematicId != activityType)
|
||||
refere += "&thematicId=" + thematicId;
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
@@ -1056,12 +1111,14 @@ namespace TemuKJD.KJDForms.SalesCenterForms
|
||||
/// <param name="thematicId"></param>
|
||||
/// <param name="_body"></param>
|
||||
/// <returns></returns>
|
||||
private string SubmitActivity(ShopLoginInfo shop, long? thematicId, string _body)
|
||||
private string SubmitActivity(ShopLoginInfo shop, int? activityType, long? thematicId, string _body)
|
||||
{
|
||||
string url = "https://agentseller.temu.com/api/kiana/gamblers/marketing/enroll/submit";
|
||||
string body;
|
||||
body = _body;
|
||||
string refere = "https://agentseller.temu.com/activity/marketing-activity/detail-new?type=13&thematicId=" + thematicId;
|
||||
string refere = "https://agentseller.temu.com/activity/marketing-activity/detail-new?type=" + activityType;
|
||||
if (thematicId != activityType)
|
||||
refere += "&thematicId=" + thematicId;
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,10 +138,16 @@
|
||||
<metadata name="colCheckActivity.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colActivityId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="colActivityType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colActivityName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="colActivityTypeName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colActivityThematicId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colActivityThematicName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colActivityTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
||||
Reference in new issue
Block a user