数据恢复临时调整

This commit is contained in:
wule committed 2026-03-09 09:55:23 +08:00
1 parent 3ee52f553e
commit 2d35f4b861
7 files changed
+342 -110

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 888;
public static int VersionCount = 896;
//public static int VersionCount = 613;
/// <summary>
@@ -470,7 +470,10 @@ namespace KJD_Web.BLL.BXX
}
if (!string.IsNullOrEmpty(standby3))
{
where += " and standby3 is null";
if (standby3.ToLower().Contains("is null"))
where += " and standby3 " + standby3;
else
where += " and standby3='" + standby3 + "'";
}
sql += where;
@@ -587,6 +590,7 @@ namespace KJD_Web.BLL.BXX
prod.sku_img_replace_base64 = row["img_base64"].ToString();
//prod.sku_img_replace_url = row["img_url"].ToString();
prod.wx_img_map_json = row["wx_img_map_json"].ToString();
standby3 = row["standby3"].IsNullOrEmpty() ? null : row["standby3"].ParseToString();
if (!prod.sku_secret_json.IsNullOrEmpty() && prod.secret_spu_id.IsNullOrEmpty())
{
@@ -816,9 +816,10 @@ namespace KJD_Web.BLL.WXXD
var mdyTime = Convert.ToDateTime(rst["mdy_time"]);
if (mdyTime.AddMinutes(60) < DateTime.Now)
{
var tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
//var tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
var tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=合肥测试一组", "");
if (!tokenRst.Contains("\"code\":0"))
tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=合肥测试一组", "");
if (!tokenRst.Contains("\"code\":0"))
{
var errMsg = RegexUtils.GetStringJson(ref tokenRst, "msg");
@@ -101,5 +101,6 @@ namespace KJD_Web.Model
public string real_coid { get; set; }
public string real_spu_id { get; set; }
public string has_wx_format { get; set; }
public string standby3 { get; set; }
}
}
@@ -49,6 +49,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdListForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnUpdateReturnServerData = new DevComponents.DotNetBar.PanelEx();
this.btnReturnSecretData = new DevComponents.DotNetBar.PanelEx();
this.btnStopStop = new DevComponents.DotNetBar.PanelEx();
this.btnPull = new DevComponents.DotNetBar.PanelEx();
@@ -64,7 +65,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.label8 = new System.Windows.Forms.Label();
this.txtReplaceText = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.chkHasReturn = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.label18 = new System.Windows.Forms.Label();
this.cmbHasReturn = new System.Windows.Forms.ComboBox();
this.chkWXComplateProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtRealCoid = new System.Windows.Forms.TextBox();
this.cmbCat2 = new System.Windows.Forms.ComboBox();
@@ -182,6 +184,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnUpdateReturnServerData);
this.splitContainer1.Panel1.Controls.Add(this.btnReturnSecretData);
this.splitContainer1.Panel1.Controls.Add(this.btnStopStop);
this.splitContainer1.Panel1.Controls.Add(this.btnPull);
@@ -211,6 +214,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer1.SplitterDistance = 110;
this.splitContainer1.TabIndex = 1;
//
// btnUpdateReturnServerData
//
this.btnUpdateReturnServerData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnUpdateReturnServerData.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnUpdateReturnServerData.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnUpdateReturnServerData.DisabledBackColor = System.Drawing.Color.Empty;
this.btnUpdateReturnServerData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateReturnServerData.Location = new System.Drawing.Point(759, 79);
this.btnUpdateReturnServerData.Name = "btnUpdateReturnServerData";
this.btnUpdateReturnServerData.Size = new System.Drawing.Size(85, 25);
this.btnUpdateReturnServerData.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpdateReturnServerData.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpdateReturnServerData.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpdateReturnServerData.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnUpdateReturnServerData.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnUpdateReturnServerData.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnUpdateReturnServerData.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnUpdateReturnServerData.Style.GradientAngle = 90;
this.btnUpdateReturnServerData.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpdateReturnServerData.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpdateReturnServerData.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpdateReturnServerData.TabIndex = 943;
this.btnUpdateReturnServerData.Text = "数据拉回";
this.btnUpdateReturnServerData.Click += new System.EventHandler(this.updateReturnServerData_Click);
//
// btnReturnSecretData
//
this.btnReturnSecretData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -218,9 +246,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnReturnSecretData.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnReturnSecretData.DisabledBackColor = System.Drawing.Color.Empty;
this.btnReturnSecretData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReturnSecretData.Location = new System.Drawing.Point(750, 79);
this.btnReturnSecretData.Location = new System.Drawing.Point(671, 79);
this.btnReturnSecretData.Name = "btnReturnSecretData";
this.btnReturnSecretData.Size = new System.Drawing.Size(94, 25);
this.btnReturnSecretData.Size = new System.Drawing.Size(86, 25);
this.btnReturnSecretData.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnReturnSecretData.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnReturnSecretData.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -488,7 +516,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66666F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.chkHasReturn, 10, 2);
this.tableLayoutPanel1.Controls.Add(this.label18, 10, 2);
this.tableLayoutPanel1.Controls.Add(this.cmbHasReturn, 11, 2);
this.tableLayoutPanel1.Controls.Add(this.chkWXComplateProd, 8, 2);
this.tableLayoutPanel1.Controls.Add(this.txtRealCoid, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.cmbCat2, 5, 2);
@@ -533,16 +562,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.tableLayoutPanel1.Size = new System.Drawing.Size(650, 105);
this.tableLayoutPanel1.TabIndex = 679;
//
// chkHasReturn
// label18
//
this.chkHasReturn.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.chkHasReturn.Location = new System.Drawing.Point(495, 77);
this.chkHasReturn.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.chkHasReturn.Name = "chkHasReturn";
this.chkHasReturn.Size = new System.Drawing.Size(57, 21);
this.chkHasReturn.TabIndex = 910;
this.chkHasReturn.Text = "未回传";
this.chkHasReturn.UseVisualStyleBackColor = true;
this.label18.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(492, 79);
this.label18.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(68, 17);
this.label18.TabIndex = 803;
this.label18.Text = "数据回传:";
//
// cmbHasReturn
//
this.cmbHasReturn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cmbHasReturn.FormattingEnabled = true;
this.cmbHasReturn.Items.AddRange(new object[] {
"",
"是",
"否",
"回传未拉回"});
this.cmbHasReturn.Location = new System.Drawing.Point(560, 77);
this.cmbHasReturn.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbHasReturn.Name = "cmbHasReturn";
this.cmbHasReturn.Size = new System.Drawing.Size(33, 25);
this.cmbHasReturn.TabIndex = 804;
//
// chkWXComplateProd
//
@@ -926,7 +970,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbCat1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cmbCat1.FormattingEnabled = true;
this.cmbCat1.Location = new System.Drawing.Point(163, 75);
this.cmbCat1.Location = new System.Drawing.Point(163, 77);
this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat1.Name = "cmbCat1";
this.cmbCat1.Size = new System.Drawing.Size(34, 25);
@@ -1804,6 +1848,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
private UserComponent.UcCheckBox chkWXComplateProd;
private DevComponents.DotNetBar.PanelEx btnReturnSecretData;
private UserComponent.UcCheckBox chkHasReturn;
private System.Windows.Forms.ComboBox cmbHasReturn;
private System.Windows.Forms.Label label18;
private DevComponents.DotNetBar.PanelEx btnUpdateReturnServerData;
}
}
@@ -71,7 +71,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Task.Run(() =>
{
GetPDDProductGroup(new List<ComboBox> { cmbGroup, cmbGroupFilter, });
GetPDDProductGroup(new List<ComboBox> { cmbGroup, cmbGroupFilter, });
GetPddProductCate();
});
}
@@ -305,7 +305,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
seconds = 0;
var url = BaseClass.BuildPDDObjString("product/get_product_list");
if(shop!=null && shop.DbId.ParseToInt()!=0 )
if (shop != null && shop.DbId.ParseToInt() != 0)
url = BaseClass.BuildPDDObjString("product/get_product_list");
var data = "";
@@ -388,9 +388,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
if (chkWXComplateProd.Checked)
data += "&has_wx_format=1";
if (chkHasReturn.Checked)
data += "&standby3=1";
if (cmbHasReturn.Text.Trim() == "是")
data += "&standby3=1";
else if (cmbHasReturn.Text.Trim() == "否")
data += "&standby3=is null";
else if (cmbHasReturn.Text.Trim() == "回传未拉回")
data += "&standby3=2";
else if (!string.IsNullOrEmpty(cmbHasReturn.Text.Trim()))
data += "&standby3=" + cmbHasReturn.Text.Trim();
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -416,7 +423,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
return list;
var sProd = JsonHelper.SerializeObject(jArr);
try
try
{
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd);
return list;
@@ -594,9 +601,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value;
}
}
}
catch
{
}
catch
{
}
//rowIndex1 = -1;
//rowIndex2 = -1;
@@ -639,7 +646,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (prodList.Count() > 0)
{
this.btnSelect.Enabled = false;
Task.Run(() => {
Task.Run(() =>
{
//SelectProduct(prodList);
Invoke(new Action(() =>
{
@@ -702,7 +710,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
return;
}
string in_db_ids=string.Join(",", lstProdDbId);
string in_db_ids = string.Join(",", lstProdDbId);
var url = BaseClass.BuildPDDObjString("product/mdy_db_product");
var data = UserLogin.GetSignaturex() +
"&in_db_ids=" + in_db_ids + "&group=" + cmbGroup.Text.Trim();
@@ -1146,7 +1154,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
level = catObj["cat"]["level"].ParseToInt(),
name = catObj["cat"]["name"].ParseToString(),
};
if (!GlobalConfig.WxCatList.Any(c => c.cat_id == catInfo.cat_id))
GlobalConfig.WxCatList.Add(catInfo);
}
@@ -1175,7 +1183,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
GetProdWxCat(prodList);
}
catch (Exception ex)
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
@@ -1240,7 +1248,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
var data = UserLogin.GetSignaturex() +
"&in_db_ids=" + in_db_ids + "&wx_safe_status=违规商品";
if (dbProd.notes.IsNullOrEmpty())
data += "&notes=商品图片链接失效";
data += "&notes=商品图片链接失效";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
@@ -1420,7 +1428,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
{
cancellationTokenSource = new CancellationTokenSource();
}
}
Task.Run(() =>
{
try
@@ -1476,9 +1484,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
prodDataObj["spuCode"] = dbProd.ext_code;
prodDataStr = JsonHelper.SerializeObject(prodDataObj);
}
catch
{
continue;
catch
{
continue;
}
string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/addGoods";
var exportRst = WXHttpResponseBLL.e57PostResponse(url, prodDataStr, "");
@@ -1492,7 +1500,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// 原批量拉取,已废弃 "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?page_size=10";
// 按spuCode(ext_code)拉取
url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
string body = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
//string body = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
string body = "{\"spuCodes\":[\"" + dbProd.spu_id + "\"]}";
var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
if (getRst.Contains("\"code\":0"))
{
@@ -1612,10 +1621,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}));
var spuCodes = string.Join("\",\"", dbProdTmp20Lst.Select(p => p.ext_code));
var spu_id = string.Join("\",\"", dbProdTmp20Lst.Select(p => p.spu_id));
// 原批量拉取,已废弃 "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?page_size=10";
// 按spuCode(ext_code)拉取
string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?" + Randomx.GetId(100,999);
string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?" + Randomx.GetId(100, 999);
string body = "{\"spuCodes\":[\"" + spuCodes + "\"]}";
//string body = "{\"warehouseGoodsIds\":[\"" + spu_id + "\"]}";
var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
Thread.Sleep(500);
if (getRst.Contains("\"code\":0"))
@@ -1655,11 +1666,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
else
{
{
}
}
}
catch (Exception ex)
catch (Exception ex)
{
}
}
@@ -1680,7 +1691,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//var dbProd = prod;
// // 导出成功,拉回然后提交导本地服务端标记导出成功
// if (dbProd.sku_secret_json.IsNullOrEmpty() || dbProd.sku_secret_json.Length < 10)
// {
@@ -1728,22 +1739,22 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// {
// }
// }
//Thread.Sleep(500);
//Thread.Sleep(500);
// 获取售后地址
//https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955
//var url2 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户";
//var exportRst2 = WXHttpResponseBLL.e57GetResponse(url2, "");
// 获取售后地址
//https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955
//var url2 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户";
//var exportRst2 = WXHttpResponseBLL.e57GetResponse(url2, "");
// 获取运费模板
//"https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=10361546";
//var url3 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=" + dbProd.skc_id;
//var exportRst3 = WXHttpResponseBLL.e57GetResponse(url3, "");
// 获取运费模板
//"https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=10361546";
//var url3 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=" + dbProd.skc_id;
//var exportRst3 = WXHttpResponseBLL.e57GetResponse(url3, "");
//url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户";
//exportRst = WXHttpResponseBLL.e57PostResponse(url, "&warehouseNum=123456&shopId=46568955", "");
//exportRst = WXHttpResponseBLL.e57GetResponse(url, "");
//url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户";
//exportRst = WXHttpResponseBLL.e57PostResponse(url, "&warehouseNum=123456&shopId=46568955", "");
//exportRst = WXHttpResponseBLL.e57GetResponse(url, "");
}
private void btnStopStop_Click(object sender, EventArgs e)
@@ -1865,7 +1876,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void btnReturnSecretData_Click(object sender, EventArgs e)
{
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList();
@@ -1894,7 +1904,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Invoke(new Action(() =>
{
pbLoading.Visible = false;
BaseMsgForm.ShowInfo("操作完成!数据回传 " + prodList.Count() + " 条数据,成功 " + prodList.Where(p => p.standby3 == "1").Count() + " 条");
BaseMsgForm.ShowInfo("操作完成!数据回传 " + prodList.Count() + " 条数据,成功 " + prodList.Where(p => p.standby3 == "2").Count() + " 条");
}));
}, cancellationTokenSource.Token);
}
@@ -1909,13 +1919,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
this.statusBar.lblTaskStatus.Text = "正在回传 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count + " 成功:" + dbProdLst.Where(p => p.standby3 == "1").Count();
this.statusBar.lblTaskStatus.Text = "正在回传 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count + " 成功:" + dbProdLst.Where(p => p.standby3 == "2").Count();
}));
var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString());
// 如果加密数据为空数据就跳过
if (string.IsNullOrEmpty(dbProd?.sku_secret_json) && dbProd.sku_secret_json.Length > 10)
{
//continue;
continue;
}
var rst = new WxProdFormConverter().JstPddConvertToWxOutServer(dbProd);
@@ -1936,73 +1947,240 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/addGoods";
var exportRst = WXHttpResponseBLL.e57PostResponse(url, prodDataStr, "");
//Thread.Sleep(500);
// 导出成功,回写数据
if (exportRst.Contains("\"code\":200"))
{
if (chkPullAfterPush.Checked)
var url3 = BaseClass.BuildPDDObjString("product/mdy_product");
var data3 = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&standby3=" + 2;
var html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
url = "https://po.e57.cn/prod-api/api/oms-api/updateGoodsId";
string body = dbProd.sku_secret_json.TrimStart('[').TrimEnd(']');
var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
if (getRst.Contains("\"code\":0") || getRst.Contains("<code>200</code>"))
{
try
{
{
//url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
//string bodyx = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
//var getRstx = WXHttpResponseBLL.e57PostResponse(url, bodyx, "");
}
continue;
}
else
{
prod.standby3 = "2";
dbProd.standby3 = "2";
}
}
Thread.Sleep(100);
var url3 = BaseClass.BuildPDDObjString("product/mdy_product");
if (1==1)
//// 导出成功,回写数据
//if (exportRst.Contains("\"code\":200"))
//{
// if (chkPullAfterPush.Checked)
// {
// url = "https://po.e57.cn/prod-api/api/oms-api/updateGoodsId";
// string body = dbProd.sku_secret_json.TrimStart('[').TrimEnd(']');
// var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
// if (getRst.Contains("\"code\":0") || getRst.Contains("<code>200</code>"))
// {
// try
// {
// {
// //url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
// //string bodyx = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
// //string bodyx = "{\"warehouseGoodsIds\":[\"" + dbProd.spu_id + "\"]}";
// //var getRstx = WXHttpResponseBLL.e57PostResponse(url, bodyx, "");
// }
// var url3 = BaseClass.BuildPDDObjString("product/mdy_product");
// var data3 = Work.UserLogin.GetSignaturex() +
// "&spu_id=" + dbProd.spu_id +
// "&standby3=" + 1;
// var html = GetHtml.PostUtf8(url3, data3);
// if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// html = GetHtml.PostUtf8(url3, data3);
// if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// {
// }
// else
// {
// prod.standby3 = "1";
// dbProd.standby3 = "1";
// }
// }
// catch
// {
// }
// }
// else
// {
// }
// }
//}
//else
//{
//}
Thread.Sleep(100);
// 查询微信接口token
//url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户";
//exportRst = WXHttpResponseBLL.e57PostResponse(url, "&warehouseNum=123456&shopId=46568955", "");
//exportRst = WXHttpResponseBLL.e57GetResponse(url, "");
}
}
private void updateReturnServerData_Click(object sender, EventArgs e)
{
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList();
if (prodList.Count == 0)
return;
this.statusBar.pgbTaskProgress.Maximum = prodList.Count;
this.statusBar.UpdateProgressBar(0);
this.pbLoading.Visible = true;
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
{
cancellationTokenSource = new CancellationTokenSource();
}
Task.Run(() =>
{
try
{
ReturnToServer2(prodList);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
// 刷新结果
SearchDbProd(this.ucSplitPage1.CurrentPage);
Invoke(new Action(() =>
{
pbLoading.Visible = false;
BaseMsgForm.ShowInfo("操作完成!拉回数据回传 " + prodList.Count() + " 条数据,成功 " + prodList.Where(p => p.standby3 == "1").Count() + " 条");
}));
}, cancellationTokenSource.Token);
}
public void ReturnToServer2(List<KJDDBProduct> dbProdLst)
{
foreach (var prod in dbProdLst)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
this.statusBar.lblTaskStatus.Text = "正在拉回回传 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count + " 成功:" + dbProdLst.Where(p => p.standby3 == "1").Count();
}));
var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString());
// 如果加密数据为空数据就跳过
if (string.IsNullOrEmpty(dbProd?.sku_secret_json) && dbProd.sku_secret_json.Length > 10)
{
continue;
}
if (dbProd.standby3 != "2")
{
//continue;
}
var rst = new WxProdFormConverter().JstPddConvertToWxOutServer(dbProd);
if (!rst.Contains("\"success\":true"))
{
continue;
}
// 导出成功,回写数据
if (1 == 1)
{
string url = "https://po.e57.cn/prod-api/api/oms-api/updateGoodsId";
string body = dbProd.sku_secret_json.TrimStart('[').TrimEnd(']');
try
{
JObject jBody = JsonHelper.JObjectParse(body);
jBody["warehouseGoodsId"] = dbProd.spu_id;
body = JsonHelper.SerializeObject(jBody);
}
catch
{
continue;
}
var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
if (getRst.Contains("更新失败,商品id重复"))
{
//JObject jBody = JsonHelper.JObjectParse(body);
//jBody["goodsId"] = "1" + dbProd.secret_spu_id;
//body = JsonHelper.SerializeObject(jBody);
//getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
}
if (getRst.Contains("Whitelabel Error Page") || getRst.Contains("更新失败,商品id重复") || getRst.Contains("\"code\":0") || getRst.Contains("<code>200</code>"))
{
try
{
{
url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
string bodyx = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
//string bodyx = "{\"warehouseGoodsIds\":[\"" + dbProd.spu_id + "\"]}";
var getRstx = WXHttpResponseBLL.e57PostResponse(url, bodyx, "");
if (!getRstx.Contains("\"code\":0"))
continue;
if (getRstx.Contains(body))
{
var data3 = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&standby3=" + 1;
var html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
}
else
{
prod.standby3 = "1";
dbProd.standby3 = "1";
}
}
else
{
bool success = true;
JObject bodyObj = JsonHelper.JObjectParse(body);
JObject bodyRstObj = JsonHelper.JObjectParse(getRstx)["data"].FirstOrDefault() as JObject;
if (bodyRstObj == null)
success = false;
if (string.IsNullOrEmpty(bodyObj["goodsId"].ParseToString()))
success = false;
if (bodyObj["goodsId"].ParseToString() != bodyRstObj["goodsId"].ParseToString())
success = false;
if (bodyObj["warehouseGoodsId"].ParseToString() != bodyRstObj["warehouseGoodsId"].ParseToString() &&
bodyObj["spuCode"].ParseToString() != bodyRstObj["spuCode"].ParseToString())
success = false;
if (bodyObj["skus"].Any(b => !bodyRstObj["skus"].Any(br => br.ParseToString() == b.ParseToString())))
success = false;
if (!success)
{
continue;
var urlFail = BaseClass.BuildPDDObjString("product/mdy_product");
var dataFail = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&standby3=" + 3;
var htmlFail = GetHtml.PostUtf8(urlFail, dataFail);
continue;
}
}
}
catch
var url3 = BaseClass.BuildPDDObjString("product/mdy_product");
var data3 = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&standby3=" + 1;
var html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
}
else
{
prod.standby3 = "1";
dbProd.standby3 = "1";
}
}
else
catch
{
}
}
////如果外部服务端提示入库成功又没有实际加成功,则记录未回拉
//if (prod.send_to_out_server == 2)
//{
// var url2 = BaseClass.BuildPDDObjString("product/mdy_product");
// var data2 = Work.UserLogin.GetSignaturex() +
// "&spu_id=" + dbProd.spu_id +
// "&send_to_out_server=" + 2;
// var html = GetHtml.PostUtf8(url2, data2);
// if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// html = GetHtml.PostUtf8(url2, data2);
// if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// {
// }
//}
else
{
}
}
else
{
@@ -4106,8 +4106,10 @@ namespace TemuKJD.WXForms.ProductForms
data += "&wx_safe_status=" + cmbWxSafe.Text.Trim().Replace("安全+未校验", "安全商品,未校验");
data += "&is_supplier_prod_ok=" + cmbJstInitSet.Text.Trim();
data += "&product_name=" + txtSearchGoodsName.Text.Trim();
if (chkSevenDays.Checked)
data += "&add_days_less=7";
data += "&add_days_less=21";
if (chkWXComplateProd.Checked)
data += "&has_wx_format=1";
}));