商品选品准备工作

This commit is contained in:
wule committed 2025-07-15 19:09:45 +08:00
1 parent dda4fdfc5f
commit a77278c6d1
34 files changed
+2336 -48

No files matched your search

+9
View File
@@ -289,6 +289,12 @@
<DependentUpon>PriceManageForm.cs</DependentUpon>
</Compile>
<Compile Include="KJDForms\ProductForms\ProductResponse\KJDHttpResponse.cs" />
<Compile Include="KJDForms\ProductForms\ProductSelectForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="KJDForms\ProductForms\ProductSelectForm.Designer.cs">
<DependentUpon>ProductSelectForm.cs</DependentUpon>
</Compile>
<Compile Include="KJDForms\ProductSelectForms\ProductSelectListForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -875,6 +881,9 @@
<EmbeddedResource Include="KJDForms\ProductForms\PriceManageForm.resx">
<DependentUpon>PriceManageForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="KJDForms\ProductForms\ProductSelectForm.resx">
<DependentUpon>ProductSelectForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="KJDForms\ProductSelectForms\ProductSelectListForm.resx">
<DependentUpon>ProductSelectListForm.cs</DependentUpon>
</EmbeddedResource>
+12 -4
View File
@@ -560,7 +560,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
var goodsLayerDecorationItem = new GoodsLayerDecorationReqsItem()
{
floorId = "" + goodsLayerDecorationVOInfo.floorId,
floorId = goodsLayerDecorationVOInfo.floorId,
key = goodsLayerDecorationVOInfo.key,
lang = goodsLayerDecorationVOInfo.lang,
priority = goodsLayerDecorationVOInfo.priority,
@@ -579,12 +579,16 @@ namespace TemuKJD.KJDForms.AdminForms
}
prodParam.goodsLayerDecorationReqs.Add(goodsLayerDecorationItem);
}
prodParam.goodsModelReqs = prodInfo.goodsModelList;
prodParam.goodsModelReqs = prodInfo.goodsModelList != null? prodInfo.goodsModelList : new List<object>();
prodParam.materialImgUrl = prodInfo.materialImgUrl;
prodParam.materialMultiLanguages = prodInfo.productLocalExtAttr.materialMultiLanguages != null ?
prodInfo.productLocalExtAttr.materialMultiLanguages : new List<object>();
prodParam.personalizationSwitch = prodInfo.productWhExtAttr.personalizationSwitch.ParseToInt();
prodParam.productCarouseVideoReqList = prodInfo.carouseVideoVOList;
var carouseVideoVOList = JsonHelper.SerializeObject(prodInfo.carouseVideoVOList);
prodParam.productCarouseVideoReqList = JsonHelper.DeserializeJsonToList<productCarouseVideoReqItem>(carouseVideoVOList);
if (prodParam.productCarouseVideoReqList == null)
prodParam.productCarouseVideoReqList = new List<productCarouseVideoReqItem>();
//此处打开商品编辑详情无法获取到,如何查询存疑
prodParam.productComplianceStatementReq = new ProductComplianceStatementReq
{
@@ -709,6 +713,8 @@ namespace TemuKJD.KJDForms.AdminForms
};
skuItem.productSkuNonAuditExtAttrReq = JsonHelper.DeserializeJsonToObject<ProductSkuNonAuditExtAttrReq>(
JsonHelper.SerializeObject(skuInfo.productSkuNonAuditExtAttr));
if (skuItem.productSkuNonAuditExtAttrReq == null)
skuItem.productSkuNonAuditExtAttrReq = new ProductSkuNonAuditExtAttrReq();
skuItem.productSkuSpecReqs=new List<ProductSkuSpecReqsItem>();
int groupId = 0;
foreach(var skuSpecInfo in skuInfo.productSkuSpecList)
@@ -808,7 +814,9 @@ namespace TemuKJD.KJDForms.AdminForms
else
{
var error = BaseRegex.GetStringJson(ref html, "errorMsg");
BaseMsgForm.ShowError("上传商品失败" + error + "\r\n,请在草稿箱查找商品!");
if (string.IsNullOrWhiteSpace(error))
error = BaseRegex.GetStringJson(ref html, "error_msg");
BaseMsgForm.ShowError(("上传商品失败\r\n" + error + "\r\n请在草稿箱查找商品!").Replace("\r\n\r\n","\r\n"));
return;
}
}
@@ -339,7 +339,8 @@ namespace TemuKJD.KJDForms.AdminForms
private void ShopObj_OnInfoReceived(string information)
{
//BaseMsgForm.ShowInfo(information);
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("alert('" + information + "');");
if (!string.IsNullOrEmpty(information))
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("alert('" + information + "');");
}
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
+106 -37
View File
@@ -32,49 +32,110 @@ namespace TemuKJD.KJDForms.AdminForms
return "failed";
}
Task.Run(() => {
var shop1 = shop;
var prodId1 = prodId;
var html = ProductQuery(shop1, prodId1.ToString());
if (html.Contains("\"success\":true") && html.Contains("\"result\""))
Task.Run(() =>
{
try
{
var shop1 = shop;
var prodId1 = prodId;
string err_msg = "";
var html = ProductQuery(shop1, prodId1.ToString());
if (!html.Contains("\"success\":true") || !html.Contains("\"result\""))
{
OnInfoReceived("商品获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg"));
return;
}
JObject obj = JObject.Parse(html);
try
var result = JsonHelper.SerializeObject(obj["result"]);
var sizeRst = "";
TemuProductInfo product = JsonHelper.DeserializeJsonToObject<TemuProductInfo>(result);
if (product.sizeTemplateId > 0)
{
var result = JsonHelper.SerializeObject(obj["result"]);
TemuProductInfo product = JsonHelper.DeserializeJsonToObject<TemuProductInfo>(result);
// 创建 SaveFileDialog 的实例
SaveFileDialog saveFileDialog = new SaveFileDialog();
// 单线程单元(STA)模式运行文件对话框,否则会报错。
System.Threading.Thread InvokeThread = new System.Threading.Thread(new System.Threading.ThreadStart(()=> {
// 设置对话框的属性
saveFileDialog.Title = "保存商品";
saveFileDialog.Filter = "商品文件 (*.prd)|*.prd|所有文件 (*.*)|*.*"; // 过滤文件类型
saveFileDialog.FileName = product.productId.ParseToString(); // 默认文件名
saveFileDialog.DefaultExt = "txt"; // 默认文件扩展名
// 显示对话框并获取结果
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
// 用户点击了“保存”按钮,此时可以获取文件的路径
string filePath = saveFileDialog.FileName;
// 在这里处理文件保存逻辑,例如写入数据到文件
System.IO.File.WriteAllText(filePath, result);
}
//BaseMsgForm.ShowInfo("商品保存成功!");
OnInfoReceived("商品保存成功!");
}));
InvokeThread.SetApartmentState(System.Threading.ApartmentState.STA);
InvokeThread.Start();
InvokeThread.Join();
html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString());
if(!html.Contains("\"success\":true"))
{
err_msg += "尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
}
else
{
obj = JObject.Parse(html);
sizeRst = JsonHelper.SerializeObject(obj["result"]);
}
}
catch(Exception ex)
var cat = product.categories.cat10;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat9;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat8;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat7;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat6;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat5;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat4;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat3;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat2;
if (string.IsNullOrWhiteSpace(cat.catName))
cat = product.categories.cat1;
var url = BaseClass.BuildObjString("product/add_product");
var data = Work.UserLogin.GetSignaturex() +
"&spu_id=" + product.productId +
"&skc_id=" + product.productSkcList.FirstOrDefault().productSkcId +
"&cat_id=" + cat.catId +
"&cat_name=" + HttpUtility.UrlEncode(cat.catName, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(product.productName, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(result, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(product.carouselImageUrls.FirstOrDefault(), Encoding.UTF8);
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"))
{
}
//// 创建 SaveFileDialog 的实例
//SaveFileDialog saveFileDialog = new SaveFileDialog();
//// 单线程单元(STA)模式运行文件对话框,否则会报错。
//System.Threading.Thread InvokeThread = new System.Threading.Thread(new System.Threading.ThreadStart(()=> {
// // 设置对话框的属性
// saveFileDialog.Title = "保存商品";
// saveFileDialog.Filter = "商品文件 (*.prd)|*.prd|所有文件 (*.*)|*.*"; // 过滤文件类型
// saveFileDialog.FileName = product.productId.ParseToString(); // 默认文件名
// saveFileDialog.DefaultExt = "txt"; // 默认文件扩展名
// // 显示对话框并获取结果
// if (saveFileDialog.ShowDialog() == DialogResult.OK)
// {
// // 用户点击了“保存”按钮,此时可以获取文件的路径
// string filePath = saveFileDialog.FileName;
// // 在这里处理文件保存逻辑,例如写入数据到文件
// System.IO.File.WriteAllText(filePath, result);
// //BaseMsgForm.ShowInfo("商品保存成功!");
// }
//}));
//InvokeThread.SetApartmentState(System.Threading.ApartmentState.STA);
//InvokeThread.Start();
//InvokeThread.Join();
}
catch (Exception ex)
{
}
});
@@ -90,5 +151,13 @@ namespace TemuKJD.KJDForms.AdminForms
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?from=productList&productId=" + prodId;
return KJDHttpResponse.PostResponse(shop, url, body, refere);
}
private string SizeSpecQuery(ShopLoginInfo shop, string prodId, string sizeSpecId)
{
string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/query";
string body = @"{""businessId"":17593513382470,""reusable"":false}";
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?from=productList&productId=" + prodId;
return KJDHttpResponse.PostResponse(shop, url, body, refere);
}
}
}
@@ -0,0 +1,47 @@
namespace TemuKJD.KJDForms.ProductForms
{
partial class ProductSelectForm
{
/// <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()
{
this.SuspendLayout();
//
// ProductSelectForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(883, 565);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "ProductSelectForm";
this.Text = "选品管理";
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TemuKJD.KJDForms.ProductForms
{
public partial class ProductSelectForm : Form
{
public ProductSelectForm()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+1 -1
View File
@@ -37,7 +37,7 @@ namespace TemuKJD.KJDForms.ShopForms
if (BaseClass.GroupId == 3)
{
hideName.Remove("用户管理");
if (BaseClass.UserName == "18888888888" || BaseClass.UserName == "15333333333")
if (BaseClass.IsSa/*BaseClass.UserName == "18888888888" || BaseClass.UserName == "15333333333"*/)
{
hideName.Remove("超级用户管理");
hideName.Remove("超级店铺管理");