1跨境达sku增加随机字符 2跨境达搜索同货号商品随机替换主图及sku随机转主
This commit is contained in:
1 parent
2388ea8ae9
commit
1487bc31c8
8 files changed
+141
-7
No files matched your search
+15
@@ -144,6 +144,7 @@
|
||||
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.chkSameExtcodeRandomMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -183,6 +184,7 @@
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.chkSameExtcodeRandomMainImg);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblSkuRandomLetterNotes);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnAdd);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label21);
|
||||
@@ -1669,6 +1671,18 @@
|
||||
this.statusBar.Size = new System.Drawing.Size(1558, 25);
|
||||
this.statusBar.TabIndex = 5;
|
||||
//
|
||||
// chkSameExtcodeRandomMainImg
|
||||
//
|
||||
this.chkSameExtcodeRandomMainImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkSameExtcodeRandomMainImg.AutoSize = true;
|
||||
this.chkSameExtcodeRandomMainImg.Location = new System.Drawing.Point(1372, 71);
|
||||
this.chkSameExtcodeRandomMainImg.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.chkSameExtcodeRandomMainImg.Name = "chkSameExtcodeRandomMainImg";
|
||||
this.chkSameExtcodeRandomMainImg.Size = new System.Drawing.Size(188, 21);
|
||||
this.chkSameExtcodeRandomMainImg.TabIndex = 488;
|
||||
this.chkSameExtcodeRandomMainImg.Text = "同货号主图随机+sku随机转主";
|
||||
this.chkSameExtcodeRandomMainImg.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DbProductSelectListManageForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@@ -1824,5 +1838,6 @@
|
||||
private DevComponents.DotNetBar.PanelEx btnSearch;
|
||||
private UserComponent.UcCheckBox chkSkuRandomLetter;
|
||||
private System.Windows.Forms.Label lblSkuRandomLetterNotes;
|
||||
private UserComponent.UcCheckBox chkSameExtcodeRandomMainImg;
|
||||
}
|
||||
}
|
||||
@@ -815,7 +815,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
return list.FirstOrDefault();
|
||||
}
|
||||
|
||||
public static KJDDBProduct GetProductDetail(string prodDbId)
|
||||
public static KJDDBProduct GetProductDetail(string prodDbId, string extCode="")
|
||||
{
|
||||
if (string.IsNullOrEmpty(prodDbId))
|
||||
return new KJDDBProduct();
|
||||
@@ -826,6 +826,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
var data = "";
|
||||
|
||||
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
|
||||
if (!string.IsNullOrEmpty(extCode))
|
||||
{
|
||||
data += "&search_ext_code=" + extCode;
|
||||
}
|
||||
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
@@ -856,6 +860,44 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
}
|
||||
}
|
||||
|
||||
public static List< KJDDBProduct> GetProductSameExtCodeDetailList(string extCode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(extCode))
|
||||
return new List<KJDDBProduct>();
|
||||
|
||||
List<KJDDBProduct> list = new List<KJDDBProduct>();
|
||||
|
||||
var url = BaseClass.BuildObjString("product/get_product_detail_list");
|
||||
var data = "";
|
||||
|
||||
data = UserLogin.GetSignaturex() + "&search_ext_code=" + extCode;
|
||||
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return null;
|
||||
var sProd = JsonHelper.SerializeObject(jArr);
|
||||
|
||||
try
|
||||
{
|
||||
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd);
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell)
|
||||
{
|
||||
if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功" || shop.LoginStatus2 != "国际版在线")
|
||||
@@ -940,7 +982,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
List<string> realCarouselImageUrls = new List<string>();
|
||||
realCarouselImageUrls.AddRange(prodInfo.carouselImageUrls);
|
||||
|
||||
if (chkCustomPic.Checked) // 上传自定义图片
|
||||
if (chkCustomPic.Checked) // 上传自定义图片 自定义主图
|
||||
{
|
||||
for (int i = 0; i < prodParam.carouselImageUrls.Count; i++)
|
||||
{
|
||||
@@ -952,6 +994,47 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
}
|
||||
}
|
||||
|
||||
if (chkSameExtcodeRandomMainImg.Checked) //选择同货号(extcode)的商品主图和sku图做随机主图
|
||||
{
|
||||
var sameExtCodeDBProdLst = GetProductSameExtCodeDetailList(dbProd.ext_code);
|
||||
var sameExtCodeProdInfoLst = new List<TemuDetailProductInfo>();
|
||||
var sameExtCodeMainImgUrlLst = new List<string>();
|
||||
var sameExtCodeSkuImgUrlLst = new List<string>();
|
||||
try
|
||||
{
|
||||
foreach(var sameExtCodeDbProd in sameExtCodeDBProdLst)
|
||||
{
|
||||
var pInfo = JsonHelper.DeserializeJsonToObject<TemuDetailProductInfo>(sameExtCodeDbProd.product_json);
|
||||
sameExtCodeProdInfoLst.Add(pInfo);
|
||||
sameExtCodeMainImgUrlLst.AddRange(pInfo.carouselImageUrls);
|
||||
foreach (var sku in pInfo.productSkcList.FirstOrDefault().productSkuList)
|
||||
{
|
||||
sameExtCodeSkuImgUrlLst.Add(sku.thumbUrl);
|
||||
}
|
||||
}
|
||||
if (sameExtCodeMainImgUrlLst.Count > 0 && sameExtCodeSkuImgUrlLst.Count > 0)
|
||||
{
|
||||
bool isUseDefault = false;
|
||||
for (int i = 0; i < prodParam.carouselImageUrls.Count; i++)
|
||||
{
|
||||
// 主图 :sku转主 比例 2 :1
|
||||
if (Randomx.GetId(3) > 0 || (isUseDefault == false && i == prodParam.carouselImageUrls.Count - 1))
|
||||
{
|
||||
isUseDefault = true;
|
||||
prodParam.carouselImageUrls[i] = sameExtCodeMainImgUrlLst[Randomx.GetId(sameExtCodeMainImgUrlLst.Count)];
|
||||
}
|
||||
else
|
||||
{
|
||||
prodParam.carouselImageUrls[i] = sameExtCodeSkuImgUrlLst[Randomx.GetId(sameExtCodeSkuImgUrlLst.Count)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
prodParam.goodsAdvantageLabelTypes = prodInfo.goodsAdvantageLabelVOList != null ?
|
||||
prodInfo.goodsAdvantageLabelVOList : new List<object>();
|
||||
prodParam.goodsLayerDecorationCustomizeI18nReqs = prodInfo.goodsLayerDecorationCustomizeI18nVOList;
|
||||
|
||||
Reference in new issue
Block a user