拼多多外部前端采集数据格式化入库 50%

This commit is contained in:
wule_5900x committed 2026-01-11 00:00:19 +08:00
1 parent 343b01ab90
commit 426e03d529
9 files changed
+667 -48

No files matched your search

+1
View File
@@ -211,6 +211,7 @@
<Compile Include="Model\Result\PDDResult\PDDActivityRuleInfo.cs" />
<Compile Include="Model\Result\PDDResult\PDDActivitySuggestPriceInfo.cs" />
<Compile Include="Model\Result\PDDResult\PDDChanceProductInfo.cs" />
<Compile Include="Model\Result\PDDResult\PDDFrontProductInfo.cs" />
<Compile Include="Model\Result\PDDResult\PDDShopListProductInfo.cs" />
<Compile Include="Model\Result\PDDResult\PDDMaterialInfo.cs" />
<Compile Include="Model\Result\PDDResult\PDDProductDecorationInfo.cs" />
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result.PDDResult
{
public class PDDFrontProductInfo
{
public long? server_time { get; set; } // 1760369093,
public int? version { get; set; } // 3,
public int? status { get; set; } // 0,
public long? goods_id { get; set; } // 51987242,
public PddFrontGoodsInfo goods { get; set; }
public List<PddFrontSkuInfo> sku { get; set; }
public PddFrontMallInfo mall { get; set; }
public PddFrontPriceInfo price { get; set; }
}
public class PddFrontPriceInfo
{
public int? line_price { get; set; } // 11800,
public int? min_on_sale_group_price { get; set; } // 2689,
public int? max_on_sale_group_price { get; set; } // 2689,
public int? min_on_sale_normal_price { get; set; } // 2989,
public int? max_on_sale_normal_price { get; set; } // 2989,
public int? min_group_price { get; set; } // 2689,
public int? max_group_price { get; set; } // 2689,
public int? min_normal_price { get; set; } // 2989,
public int? max_normal_price { get; set; } // 2989
}
public class PddFrontMallInfo
{
public long? mall_id { get; set; } // 17876,
public string mall_name { get; set; } // "迪尔卡特童装专营店",
public string mall_logo { get; set; } // "http://t16img.yangkeduo.com/pdd_ims/f514a69127d0e03c0bfbebf64b8de956.jpg"
}
public class PddFrontSkuInfo
{
public long? sku_id { get; set; } // 892759407357,
public int? is_onsale { get; set; } // 1,
public int? is_sku_pre_sale { get; set; } // 0,
public string sku_pre_sale_time { get; set; } // "",
public string sku_pre_sale_tip { get; set; } // "",
public string normal_price { get; set; } // "29.9",
public string normal_save_price { get; set; } // "3.0",
public string group_price { get; set; } // "26.9",
public int? quantity { get; set; } // 96,
public int? weight { get; set; } // 0,
public string thumb_url { get; set; } // "https://img.pddpic.com/mms-material-img/2021-07-06/78b6b3b7-bad6-4c7e-83d4-df6eeb49eed9.jpeg",
public string spec { get; set; } // "7206440709,1445175322",
public string spec_keys { get; set; } // "颜色分类;参考分类",
public string spec_values { get; set; } // "小猫款绿豆色;80 码建议身高65-75cm",
public object price_display { get; set; } // { },
public string group_tip { get; set; } // ""
}
public class PddFrontGoodsInfo
{
public long? goods_id { get; set; } // 51987242,
public long? cat_id { get; set; } // 15061,
public long? mall_id { get; set; } // 17876,
public long? quantity { get; set; } // 1000,
public string goods_name { get; set; } // "2025新款儿童羽绒棉服男女童中小童棉衣宝宝短款耳朵连帽外套",
public string share_desc { get; set; } // "2025新款儿童羽绒棉服男女童中小童棉衣宝宝短款耳朵连帽外套",
public string share_title { get; set; } // "2025新款儿童羽绒棉服男女童中小童棉衣宝宝短款耳朵连帽外套",
public string side_sales_tip { get; set; } // "已拼2.7万+件",
public int? sold_quantity { get; set; } // 27000,
public string hd_url { get; set; } // "https://img.pddpic.com/mms-material-img/2021-07-06/d55a1b8e-25ac-4573-ba6b-936b286c50e1.jpeg",
public string thumb_url { get; set; } // "http://t00img.yangkeduo.com/goods/images/2021-07-06/f98d113e33397f07f0bc4694ce9100bf.jpeg",
public string hd_thumb_url { get; set; } // "http://t00img.yangkeduo.com/goods/images/2021-07-06/f9399a421653af62c4b85d324b778d63.jpeg",
public string image_url { get; set; } // "http://t00img.yangkeduo.com/goods/images/2021-07-06/f98d113e33397f07f0bc4694ce9100bf.jpeg",
public int? is_onsale { get; set; } // 1,
public int? is_pre_sale { get; set; } // 0,
public int? pre_sale_time { get; set; } // 0,
public long? group_id { get; set; } // 103977708,
public long? cat_id_1 { get; set; } // 14966,
public long? cat_id_2 { get; set; } // 14988,
public long? cat_id_3 { get; set; } // 15061,
public long? cat_id_4 { get; set; } // 0,
public List<propertyInfo> property { get; set; }
public List<galleryInfo> gallery { get; set; }
public List<object> decoration { get; set; }
}
public class galleryInfo
{
public long? id { get; set; } // 1170187037,
public string url { get; set; } // "https://img.pddpic.com/mms-material-img/2021-07-06/d55a1b8e-25ac-4573-ba6b-936b286c50e1.jpeg",
public int? priority { get; set; } // 0,
public int? type { get; set; } // 1
}
public class propertyInfo
{
public string key { get; set; }
public List<string> values { get; set; }
}
}
@@ -258,6 +258,7 @@ namespace AllBase.Model.Result.PDDResult
public object batch_id { get; set; }
public int? priority { get; set; }
public int? ware_id { get; set; }
public object ware_biz_type { get; set; } // null
public object advice_price { get; set; }
public object length { get; set; }
public oversea_sku_item oversea_sku { get; set; }
@@ -20,6 +20,7 @@ namespace AllBase.Model.Result.PDDResult
/// 长图
/// </summary>
public PDDMaterialInfo material3 { get; set; }
public object source_json { get; set; }
+372
View File
@@ -0,0 +1,372 @@
using AllBase;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Work;
namespace TemuKJD.BLL
{
public class PDDProdFormConverter
{
public string PddConvert(string outProdJson, bool UpdateOldData = true)
{
PDDFrontProductInfo frontProdInfo = null;
try
{
frontProdInfo = JsonHelper.DeserializeJsonToObject<PDDFrontProductInfo>(outProdJson);
}
catch(Exception ex)
{
return "转换错误" + ex.Message;
}
if (frontProdInfo == null || frontProdInfo.goods_id == null)
{
return "商品数据信息为空";
}
KJDDBProduct dbProd = new KJDDBProduct() { size_json = "{}" };
PDDProductInfo prodInfo = new PDDProductInfo() { source_json = JsonHelper.JObjectParse(outProdJson) };
prodInfo.chance_id = null;
prodInfo.chance_refere = null;
prodInfo.chance_tab = null;
prodInfo.decoration = null;
// 商品详情
prodInfo.detail = new PDDProductDetailInfo();
prodInfo.detail.allergy_refund = 0;
prodInfo.detail.allowed_region = new List<object>();
//prodInfo.detail.appeal_status = null;
//prodInfo.detail.app_id = null;
//prodInfo.detail.app_name = null;
//prodInfo.detail.bad_claim_text = null;
prodInfo.detail.bad_fruit_claim = 0;
//prodInfo.detail.business_source_type = null;
prodInfo.detail.can_appeal = null;
prodInfo.detail.card_verification_list = null;
prodInfo.detail.cats = new List<string>();
prodInfo.detail.cat_id = frontProdInfo.goods.cat_id.ParseToInt();
prodInfo.detail.cat_ids = new List<int?>() { frontProdInfo.goods.cat_id_1.ParseToInt(), frontProdInfo.goods.cat_id_2.ParseToInt(), frontProdInfo.goods.cat_id_3.ParseToInt(), frontProdInfo.goods.cat_id_4.ParseToInt() };
prodInfo.detail.check_status = 9;
//prodInfo.detail.check_type = null;
//prodInfo.detail.client_id = null;
prodInfo.detail.commit_deleted = 0;
//prodInfo.detail.commit_extension = null;
//prodInfo.detail.community_group_buying = null;
prodInfo.detail.cost_template_id = 0;
//prodInfo.detail.country = null;
prodInfo.detail.country_id = 0;
//prodInfo.detail.created_at = null;
//prodInfo.detail.creator_name = null;
prodInfo.detail.customizable = 0;
prodInfo.detail.customs = "";
prodInfo.detail.damage_claim = 0;
prodInfo.detail.delivery_one_day = 0;
//prodInfo.detail.delivery_type = null;
//prodInfo.detail.elec_goods_attributes = null;
prodInfo.detail.estimate_quantity = 0;
prodInfo.detail.event_type = 0;
prodInfo.detail.extend_warranty_dto = new extend_warranty_dto_item() { extend_warranty = 0 };
//prodInfo.detail.fabric = null;
//prodInfo.detail.fabric_content = null;
prodInfo.detail.galleries = new List<gallery_item>();
int galleryIndex = 0;
foreach (var frontGallery in frontProdInfo.goods.gallery)
{
if (frontGallery.type == 6)
{
prodInfo.detail.galleries.Add(new gallery_item()
{
url = frontGallery.url,
type = frontGallery.type,
width = 0,
height = 0,
});
}
else
{
string getImgError;
var image = GetHtml.GetUrlImg(frontGallery.url.Replace("https://", "http://"), out getImgError);
if (!string.IsNullOrEmpty(getImgError))
{
return getImgError;
}
prodInfo.detail.galleries.Add(new gallery_item()
{
url = frontGallery.url,
type = frontGallery.type,
width = image.Width,
height = image.Height,
});
}
galleryIndex++;
}
prodInfo.detail.gold_price_template_id = null;
prodInfo.detail.gold_price_type = null;
prodInfo.detail.goods_certificate = null;
prodInfo.detail.goods_commit_check = new List<object>();
prodInfo.detail.goods_desc = frontProdInfo.goods.share_desc;
prodInfo.detail.goods_id = frontProdInfo.goods.goods_id ?? frontProdInfo.goods_id;
prodInfo.detail.goods_name = frontProdInfo.goods.goods_name;
prodInfo.detail.goods_name_prefix = "";
prodInfo.detail.goods_pattern = 8;
prodInfo.detail.goods_property_list = null;
prodInfo.detail.goods_sn = null;
prodInfo.detail.goods_srv_templates = new List<object>();
prodInfo.detail.goods_trade_attr = null;
prodInfo.detail.goods_travel_attr = null;
prodInfo.detail.goods_type = 1;
prodInfo.detail.groups = new group_item() { single_price = 0, group_price = 0, customer_num = 2, buy_limit = 999999, order_limit = 999999 };
prodInfo.detail.hd_thumb_url = frontProdInfo.goods.hd_thumb_url;
prodInfo.detail.id = 0; // 编辑id,随意填写
prodInfo.detail.image_url = frontProdInfo.goods.image_url;
prodInfo.detail.instruction_vo = new instruction_vo_item() { template_status = -1 };
prodInfo.detail.invoice_mode = null;
prodInfo.detail.invoice_mode_sub_type = null;
prodInfo.detail.invoice_status = 0;
prodInfo.detail.is_all_weight_same = true;
prodInfo.detail.is_app = 0;
prodInfo.detail.is_bangdan = 0;
prodInfo.detail.is_card_secret = false;
prodInfo.detail.is_certificate_provide = 0;
prodInfo.detail.is_customized = 0;
prodInfo.detail.is_customs = 0;
prodInfo.detail.is_deposit = false;
prodInfo.detail.is_draft = false;
prodInfo.detail.is_folt = 0;
prodInfo.detail.is_general_trade = 0;
prodInfo.detail.is_gold_price_matched = null;
prodInfo.detail.is_goods_copy = null;
prodInfo.detail.is_goods_decoration = 1;
prodInfo.detail.is_group_pre_sale = 0;
prodInfo.detail.is_only_for_remote_area = false;
prodInfo.detail.is_pre_sale = 0;
prodInfo.detail.is_refundable = 1;
prodInfo.detail.is_refundable_fifteen_day = 0;
prodInfo.detail.is_shop = 1;
prodInfo.detail.is_size_change_casually = 0;
prodInfo.detail.is_sku_pre_sale = 0;
prodInfo.detail.is_sku_shipment = 0;
prodInfo.detail.is_small_group = null;
prodInfo.detail.is_spring_festival_open_tag = false;
prodInfo.detail.is_two_num_group = false;
prodInfo.detail.is_warranty_one_year = 0;
prodInfo.detail.is_wms = 0;
prodInfo.detail.is_wp_service = 0;
prodInfo.detail.lack_of_weight_claim = 0;
prodInfo.detail.last_commit_check_status = 2;
prodInfo.detail.list_desc = new List<object>();
prodInfo.detail.local_service_id_list = null;
prodInfo.detail.mai_jia_zi_ti = null;
prodInfo.detail.mall_id = frontProdInfo.goods.mall_id;
prodInfo.detail.mall_info = new mall_info_item() { mall_name = frontProdInfo.mall?.mall_name };
prodInfo.detail.market_price = frontProdInfo.price.line_price;
prodInfo.detail.max_group_price = frontProdInfo.price.max_group_price;
prodInfo.detail.min_group_price = frontProdInfo.price.min_group_price;
prodInfo.detail.must_check_type = 0;
prodInfo.detail.name_prefix = "";
prodInfo.detail.origin_country_id = 0;
prodInfo.detail.origin_country_name = "";
prodInfo.detail.out_goods_sn = "";
prodInfo.detail.out_source_goods_id = null;
prodInfo.detail.out_source_type = null;
prodInfo.detail.oversea_goods = null;
prodInfo.detail.oversea_type = 0;
prodInfo.detail.owner = "主账号";
prodInfo.detail.owner_name = "";
prodInfo.detail.paper_length = null;
prodInfo.detail.paper_net_weight = null;
prodInfo.detail.paper_plies_num = null;
prodInfo.detail.paper_width = null;
prodInfo.detail.pre_sale_time = 0;
prodInfo.detail.privacy_delivery = 0;
prodInfo.detail.processing_charges = null;
prodInfo.detail.processing_charges_type = null;
prodInfo.detail.promised_delivery_seconds = null;
prodInfo.detail.purchase_info_supply = 0;
prodInfo.detail.qualification_id_list = new List<object>();
prodInfo.detail.quan_guo_lian_bao = 0;
prodInfo.detail.quick_refund = 0;
prodInfo.detail.reason = null;
prodInfo.detail.region_limit = 1;
prodInfo.detail.reject_reason = null;
prodInfo.detail.reject_status = null;
prodInfo.detail.same_city_template_id = 0;
prodInfo.detail.schedule_sale = new schedule_sale_item() { sale_type = 0 };
prodInfo.detail.second_hand = 0;
prodInfo.detail.sf_markup_template_sn = null;
prodInfo.detail.shang_men_an_zhuang = null;
prodInfo.detail.share_desc = frontProdInfo.goods.share_desc;
prodInfo.detail.shipment_limit_second = 172800;
prodInfo.detail.shoes_template_id = null;
prodInfo.detail.shop_group_id = null;
prodInfo.detail.shop_group_name = null;
prodInfo.detail.show_activity_price = false;
prodInfo.detail.size_parent_spec_id = null;
prodInfo.detail.size_spec_id = null;
prodInfo.detail.sku = new List<sku_item>();
foreach (var frontSku in frontProdInfo.sku)
{
sku_item skuInfo = new sku_item()
{
id = 0,
sku_id = frontSku.sku_id,
sku_sn = null,
carnival_price = 0,
init_quantity = 0,
is_onsale = 1,
limit_quantity = 999999,
multi_price = (int)(frontSku.group_price.ParseToDecimal() * 100),
multi_price_in_yuan = null,
price = (int)(frontSku.normal_price.ParseToDecimal() * 100),
price_in_yuan = null,
quantity = 0,
reserve_quantity = 0,
weight = 0,
thumb_url = frontSku.thumb_url,
thumb_url_file_id = null,
thumb_url_status = null,
thumb_url_is_deleted = null,
quantity_delta = frontSku.quantity,
spec = new List<spec_item>(),
out_sku_sn = "",
batch_id = null,
priority = 1,
ware_id = 0,
ware_biz_type = null,
advice_price = null,
length = null,
oversea_sku = null,
cspu_id = null,
child_skus = null,
ref_sku_commit_id = 0,
start_time = null,
end_time = null,
sku_srv_templates = null,
calendar_rule_id = null,
hot_live_group = null,
pre_sale_time = 0,
out_source_sku_id = null,
dd_grocery_sku_params = null,
sku_extended_attribute_dtos = null,
sku_basic_property_dtos = null,
spec_note_map = null,
delivery_schedule_dtos = null,
shipment_limit_second_list = null,
sku69_code = "",
};
List<string> specIds = frontSku.spec.Split(',').ToList();
List<string> specKeys = frontSku.spec_keys.Split(';').ToList();
List<string> specValues = frontSku.spec_values.Split(';').ToList();
for (int i = 0; i < specIds.Count; i++)
{
skuInfo.spec.Add(new spec_item()
{
parent_name = specKeys[i],
spec_id = specIds[i].ParseToLong(),
spec_name = specValues[i],
});
}
prodInfo.detail.sku.Add(skuInfo);
}
prodInfo.detail.sku_type = null;
prodInfo.detail.song_huo_an_zhuang = null;
prodInfo.detail.song_huo_ru_hu = null;
prodInfo.detail.source = 0;
prodInfo.detail.spu_id = null;
prodInfo.detail.spu_version = null;
prodInfo.detail.submit_time = 0;
prodInfo.detail.thawed_refund = 0;
prodInfo.detail.third_type = 0;
prodInfo.detail.thumb_url = frontProdInfo.goods.thumb_url;
prodInfo.detail.tiny_name = "";
prodInfo.detail.transport_type_list = null;
prodInfo.detail.two_pieces_discount = 99;
prodInfo.detail.user_source = 1;
prodInfo.detail.warehouse = "";
prodInfo.detail.warm_tips = "";
prodInfo.detail.zhi_huan_bu_xiu = 0;
prodInfo.size = null;
prodInfo.material1 = null;
prodInfo.material3 = null;
prodInfo.property = new PDDProductPropertyInfo();
prodInfo.property.sku_properties = new object();
prodInfo.property.goods_properties = new List<goods_propertie_item>();
foreach (var frontProp in frontProdInfo.goods.property)
{
goods_propertie_item propInfo = new goods_propertie_item();
propInfo.name = frontProp.key;
propInfo.values = new List<value_item>();
foreach (var frontPropValue in frontProp.values)
{
propInfo.values.Add(new value_item() { value = frontPropValue, raw_value = frontPropValue });
}
prodInfo.property.goods_properties.Add(propInfo);
}
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
bool isExist = false;
var existUrl = BaseClass.BuildObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prodInfo.detail.goods_id;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200"))
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
else
{
return "入库失败,产品数据库已存在商品查询失败";
}
var url = BaseClass.BuildObjString("product/add_product");
if (isExist)
{
if (UpdateOldData)
{
url = BaseClass.BuildObjString("product/mdy_product");
}
else
{
return "已存在相同id商品,跳过";
}
}
var data = Work.UserLogin.GetSignaturex() +
"&from_shop_id=" + frontProdInfo.mall?.mall_name +
"&spu_id=" + prodInfo.detail.goods_id.ParseToString() +
"&skc_id=" + prodInfo.detail.goods_id.ParseToString() +
"&price_text=" + prodInfo.detail.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + prodInfo.detail.sku.Max(s => s.multi_price).ParseToInt() * 0.01m +
"&main_cat_id=" + (prodInfo.detail.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() +
"&main_cat_name=" + HttpUtility.UrlEncode((prodInfo.detail.cat_ids?.FirstOrDefault(c => c != null)).ParseToString(), Encoding.UTF8) + // 取不到catname直接用catid,上货时候再取
"&cat_id=" + prodInfo.detail.cat_id.ParseToString() +
"&cat_name=" + HttpUtility.UrlEncode(prodInfo.detail.cat_id.ParseToString(), Encoding.UTF8) + // 取不到catname直接用catid,上货时候再取
"&ext_code=" + HttpUtility.UrlEncode(prodInfo.detail.out_goods_sn, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(prodInfo.detail.goods_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("外部数据", 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"))
{
return "商品采集保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
}
return "";
}
}
}
+1
View File
@@ -116,6 +116,7 @@
<ItemGroup>
<Compile Include="BLL\AuthorBLL.cs" />
<Compile Include="BLL\MemoryReader.cs" />
<Compile Include="BLL\PDDProdFormConverter.cs" />
<Compile Include="BLL\ProductSelectBLL.cs" />
<Compile Include="BLL\WXHttpResponseBLL.cs" />
<Compile Include="BoundObject.cs" />
@@ -110,6 +110,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.label10 = new System.Windows.Forms.Label();
this.cmbSource = new System.Windows.Forms.ComboBox();
this.btnImport = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -136,6 +139,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnImport);
this.splitContainer1.Panel1.Controls.Add(this.chkHighestPriceSku);
this.splitContainer1.Panel1.Controls.Add(this.chkSameSpecPrice);
this.splitContainer1.Panel1.Controls.Add(this.label9);
@@ -228,51 +232,52 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 16;
this.tableLayoutPanel1.ColumnCount = 12;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 19.9952F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Controls.Add(this.cmbSource, 5, 1);
this.tableLayoutPanel1.Controls.Add(this.label10, 4, 1);
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txtSPU, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.txtCat, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 4, 0);
this.tableLayoutPanel1.Controls.Add(this.cmbGroupFilter, 11, 0);
this.tableLayoutPanel1.Controls.Add(this.txtProdName, 5, 0);
this.tableLayoutPanel1.Controls.Add(this.label4, 6, 0);
this.tableLayoutPanel1.Controls.Add(this.txtExtCode, 7, 0);
this.tableLayoutPanel1.Controls.Add(this.lblNotes, 8, 0);
this.tableLayoutPanel1.Controls.Add(this.label6, 12, 0);
this.tableLayoutPanel1.Controls.Add(this.cmbSort, 13, 0);
this.tableLayoutPanel1.Controls.Add(this.txtNotes, 9, 0);
this.tableLayoutPanel1.Controls.Add(this.btnSearch, 14, 0);
this.tableLayoutPanel1.Controls.Add(this.lblGroup, 10, 0);
this.tableLayoutPanel1.Controls.Add(this.pnlEmpty, 15, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 13);
this.tableLayoutPanel1.Controls.Add(this.label6, 8, 0);
this.tableLayoutPanel1.Controls.Add(this.cmbSort, 9, 0);
this.tableLayoutPanel1.Controls.Add(this.btnSearch, 10, 0);
this.tableLayoutPanel1.Controls.Add(this.pnlEmpty, 11, 0);
this.tableLayoutPanel1.Controls.Add(this.lblNotes, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.txtNotes, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.lblGroup, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.cmbGroupFilter, 3, 1);
this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(822, 47);
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(727, 71);
this.tableLayoutPanel1.TabIndex = 679;
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(3, 15);
this.label5.Location = new System.Drawing.Point(3, 9);
this.label5.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(57, 17);
@@ -282,17 +287,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtSPU
//
this.txtSPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtSPU.Location = new System.Drawing.Point(60, 12);
this.txtSPU.Location = new System.Drawing.Point(60, 6);
this.txtSPU.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtSPU.Name = "txtSPU";
this.txtSPU.Size = new System.Drawing.Size(44, 23);
this.txtSPU.Size = new System.Drawing.Size(68, 23);
this.txtSPU.TabIndex = 434;
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(110, 15);
this.label2.Location = new System.Drawing.Point(134, 9);
this.label2.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
@@ -302,17 +307,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtCat
//
this.txtCat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtCat.Location = new System.Drawing.Point(154, 12);
this.txtCat.Location = new System.Drawing.Point(178, 6);
this.txtCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtCat.Name = "txtCat";
this.txtCat.Size = new System.Drawing.Size(44, 23);
this.txtCat.Size = new System.Drawing.Size(68, 23);
this.txtCat.TabIndex = 425;
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(204, 15);
this.label3.Location = new System.Drawing.Point(252, 9);
this.label3.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
@@ -323,26 +328,26 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
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(530, 13);
this.cmbGroupFilter.Location = new System.Drawing.Point(178, 40);
this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbGroupFilter.Name = "cmbGroupFilter";
this.cmbGroupFilter.Size = new System.Drawing.Size(44, 25);
this.cmbGroupFilter.Size = new System.Drawing.Size(68, 25);
this.cmbGroupFilter.TabIndex = 653;
//
// txtProdName
//
this.txtProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtProdName.Location = new System.Drawing.Point(248, 12);
this.txtProdName.Location = new System.Drawing.Point(296, 6);
this.txtProdName.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtProdName.Name = "txtProdName";
this.txtProdName.Size = new System.Drawing.Size(44, 23);
this.txtProdName.Size = new System.Drawing.Size(68, 23);
this.txtProdName.TabIndex = 427;
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(298, 15);
this.label4.Location = new System.Drawing.Point(370, 9);
this.label4.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
@@ -352,17 +357,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtExtCode
//
this.txtExtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtExtCode.Location = new System.Drawing.Point(342, 12);
this.txtExtCode.Location = new System.Drawing.Point(414, 6);
this.txtExtCode.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtExtCode.Name = "txtExtCode";
this.txtExtCode.Size = new System.Drawing.Size(44, 23);
this.txtExtCode.Size = new System.Drawing.Size(68, 23);
this.txtExtCode.TabIndex = 429;
//
// lblNotes
//
this.lblNotes.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblNotes.AutoSize = true;
this.lblNotes.Location = new System.Drawing.Point(392, 15);
this.lblNotes.Location = new System.Drawing.Point(3, 44);
this.lblNotes.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.lblNotes.Name = "lblNotes";
this.lblNotes.Size = new System.Drawing.Size(44, 17);
@@ -373,7 +378,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(580, 15);
this.label6.Location = new System.Drawing.Point(488, 9);
this.label6.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(44, 17);
@@ -387,19 +392,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbSort.Items.AddRange(new object[] {
"入库时间",
"认领总数"});
this.cmbSort.Location = new System.Drawing.Point(627, 13);
this.cmbSort.Location = new System.Drawing.Point(535, 5);
this.cmbSort.Name = "cmbSort";
this.cmbSort.Size = new System.Drawing.Size(65, 25);
this.cmbSort.Size = new System.Drawing.Size(64, 25);
this.cmbSort.TabIndex = 448;
this.cmbSort.Text = "入库时间";
//
// txtNotes
//
this.txtNotes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtNotes.Location = new System.Drawing.Point(436, 12);
this.txtNotes.Location = new System.Drawing.Point(60, 41);
this.txtNotes.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(44, 23);
this.txtNotes.Size = new System.Drawing.Size(68, 23);
this.txtNotes.TabIndex = 439;
//
// btnSearch
@@ -409,7 +414,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSearch.Location = new System.Drawing.Point(698, 11);
this.btnSearch.Location = new System.Drawing.Point(605, 5);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(56, 25);
this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -431,7 +436,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.lblGroup.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblGroup.AutoSize = true;
this.lblGroup.Location = new System.Drawing.Point(486, 15);
this.lblGroup.Location = new System.Drawing.Point(134, 44);
this.lblGroup.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.lblGroup.Name = "lblGroup";
this.lblGroup.Size = new System.Drawing.Size(44, 17);
@@ -444,7 +449,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control;
this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlEmpty.Location = new System.Drawing.Point(760, 11);
this.pnlEmpty.Location = new System.Drawing.Point(667, 5);
this.pnlEmpty.Name = "pnlEmpty";
this.pnlEmpty.Size = new System.Drawing.Size(56, 25);
this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -495,7 +500,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnDelSelect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelSelect.DisabledBackColor = System.Drawing.Color.Empty;
this.btnDelSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelSelect.Location = new System.Drawing.Point(1038, 25);
this.btnDelSelect.Location = new System.Drawing.Point(941, 25);
this.btnDelSelect.Name = "btnDelSelect";
this.btnDelSelect.Size = new System.Drawing.Size(84, 25);
this.btnDelSelect.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -517,7 +522,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.Location = new System.Drawing.Point(845, 25);
this.cmbGroup.Location = new System.Drawing.Point(750, 25);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(85, 25);
this.cmbGroup.TabIndex = 640;
@@ -529,7 +534,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetGroup.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetGroup.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetGroup.Location = new System.Drawing.Point(932, 25);
this.btnSetGroup.Location = new System.Drawing.Point(837, 25);
this.btnSetGroup.Name = "btnSetGroup";
this.btnSetGroup.Size = new System.Drawing.Size(84, 25);
this.btnSetGroup.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -1036,6 +1041,58 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.statusBar.Size = new System.Drawing.Size(1438, 25);
this.statusBar.TabIndex = 5;
//
// label10
//
this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(252, 44);
this.label10.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(44, 17);
this.label10.TabIndex = 651;
this.label10.Text = "来源:";
//
// cmbSource
//
this.cmbSource.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cmbSource.FormattingEnabled = true;
this.cmbSource.Items.AddRange(new object[] {
"全部",
"母店采集",
"机会商品",
"外部数据"});
this.cmbSource.Location = new System.Drawing.Point(296, 40);
this.cmbSource.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSource.Name = "cmbSource";
this.cmbSource.Size = new System.Drawing.Size(68, 25);
this.cmbSource.TabIndex = 654;
this.cmbSource.Text = "全部";
//
// btnImport
//
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnImport.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnImport.DisabledBackColor = System.Drawing.Color.Empty;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(1045, 25);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(84, 25);
this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnImport.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnImport.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnImport.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnImport.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnImport.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnImport.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnImport.Style.GradientAngle = 90;
this.btnImport.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnImport.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnImport.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnImport.TabIndex = 741;
this.btnImport.Text = "导入外部数据";
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// PDDDBProdListForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1145,5 +1202,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.Label label8;
private UserComponent.UcCheckBox chkSameSpecPrice;
private UserComponent.UcCheckBox chkHighestPriceSku;
private System.Windows.Forms.ComboBox cmbSource;
private System.Windows.Forms.Label label10;
private DevComponents.DotNetBar.PanelEx btnImport;
}
}
@@ -18,6 +18,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.ToolForms;
using Work;
@@ -945,5 +946,46 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (!txtReplaceText.Text.Trim().IsNullOrEmpty())
this.lstTitleReplaceText.AddRange(txtReplaceText.Text.Trim().Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries));
}
private void btnImport_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true;
// 设置过滤条件,只显示文本文件
openFileDialog.Filter = "文本文件 (*.txt)|*.txt|All files (*.*)|*.*";
// 显示对话框并获取结果
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
var filePathLst = openFileDialog.FileNames.ToList();
Task.Run(() =>
{
int successNum = 0;
int failedNum = 0;
foreach (var path in filePathLst)
{
string content = "";
string rst = "";
try
{
using (StreamReader sr = new StreamReader(path))
{
content = sr.ReadToEnd();
}
rst = new PDDProdFormConverter().PddConvert(content);
}
catch (Exception ex)
{
rst = ex.Message;
}
if (string.IsNullOrEmpty(rst))
successNum++;
else
failedNum++;
}
});
}
}
}
}
@@ -1049,6 +1049,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
var prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
prodInfo.detail.galleries.RemoveAll(g => g.type == 6); // 视频暂时移除,以后再视情况加上
if (prodInfo.detail.cats == null || prodInfo.detail.cats.Where(c => !string.IsNullOrEmpty(c)).Count() == 0)
{
var getCatRst = get_cate_detail(shop, prodInfo.detail.cat_id);
if (!getCatRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref getCatRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = getCatRst;
return "新建查询失败 " + error;
}
}
var prodParam = new PDDProductUploadParam();
int currentCount = 0;
@@ -4196,6 +4209,30 @@ Content-Disposition: form-data; name=""pic_operations""
return null;
}
}
public static string get_cate_detail(ShopLoginInfo shop, long? leafCatId)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/vodka/v2/mms/category/detail?catId=" + leafCatId;
string body = @"{}";
string refere = "https://mms.pinduoduo.com/goods/category";
var result = HttpResponseBLL.PDDGetResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(300, 500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDGetResponse(shop, url, body, refere, anti);
}
}
return result;
}
/// <summary>
/// 新建商品获取商品goodsid和commitid