1微信用户采集店铺商品功能 2查询达人带货商品并联系达人功能

This commit is contained in:
wule committed 2026-06-09 18:11:32 +08:00
1 parent e1ee91dd03
commit 2759ff0f6d
33 files changed
+2464 -626

No files matched your search

@@ -355,20 +355,21 @@ namespace TemuKJD.WXForms.ProductForms
cmbSourceType.Items.Insert(1, "------");
cmbSourceType.Items.Insert(1, "1688商品");
cmbSourceType.Items.Insert(1, "多多商品");
cmbSourceType.Items.Insert(1, "微信商品");
chkRandomFissionProduct.Visible = true;
txtRandomFissionProductCount.Visible = true;
}
cmbHot_TextChanged(null, null);
if (BaseClass.UserAuthority.Contains("商品裂变"))
if (BaseClass.UserAuthority.Contains("裂变调试"))
{
chkRandomFissionProduct.Visible = true;
txtRandomFissionProductCount.Visible = true;
}
else
{
ucTabControlMetro1.TabPages.Remove(商品裂变);
ucTabControlMetro1.TabPages.Remove(裂变调试);
}
List<Control> ctrlLst = new List<Control>()
@@ -1453,7 +1454,7 @@ namespace TemuKJD.WXForms.ProductForms
}
#region 裂变标题
if (BaseClass.UserAuthority.Contains("商品裂变") && chkFissionGoodsName.Checked)
if (BaseClass.UserAuthority.Contains("裂变调试") && chkFissionGoodsName.Checked)
{
bool isFinish = false;
Invoke(new Action(() => {
@@ -3066,6 +3067,30 @@ namespace TemuKJD.WXForms.ProductForms
}
#endregion
WXUploadProductInfoRecommendParam recommendParamRst = new WXUploadProductInfoRecommendParam();
if (chkUseRecommand.Checked)
{
WXUploadProductInfoRecommendParam recommendParam = new WXUploadProductInfoRecommendParam();
//recommendParam.productId = upProdParam.product.productKey.productId;
recommendParam.predictTypeList = new List<int>() { 5, 4, 2 };
recommendParam.productInfo = new RecommendProductInfoParam();
recommendParam.productInfo.title = upProdParam.product.info.title;
recommendParam.productInfo.headImg = new List<string>();
recommendParam.productInfo.headImg.AddRange(upProdParam.product.info.headImg);
recommendParam.productInfo.brandId = upProdParam.product.info.brandId.ParseToString();
recommendParam.productInfo.category = JsonHelper.DeserializeJsonToList<categoryParam>(JsonHelper.SerializeObject(upProdParam.product.info.category));
recommendParam.productInfo.detail = new productDetailParam(); //JsonHelper.DeserializeJsonToObject<productDetailParam>(JsonHelper.SerializeObject(upProdParam.product.info.detail));
var recommendRst = WXUpload.generalProductInfoRecommend(shop, recommendParam);
if (recommendRst.Contains("\"code\":0"))
{
recommendParamRst = JsonHelper.DeserializeJsonToObject<WXUploadProductInfoRecommendParam>(recommendRst);
}
}
if (recommendParamRst.productInfo == null)
recommendParamRst.productInfo = new RecommendProductInfoParam();
if (recommendParamRst.productInfo.param == null)
recommendParamRst.productInfo.param = new List<RecommendProductInfoParamResult>();
#region 匹配产品属性
//真丝、蚕丝、香云纱、羊绒、羊毛、羊羔毛、羽绒、皮草
upProdParam.product.info.param = new List<wxPropParam>(); // 商品属性值
@@ -3548,9 +3573,22 @@ namespace TemuKJD.WXForms.ProductForms
{
attrValue = "其他";
}
if (attrValue.IsNullOrEmpty() && (attr.type == "decimal4_unit" || attr.type == "integer_unit"))
if ((attrValue.IsNullOrEmpty() || attrValue == "见包装") && (attr.type == "decimal4_unit" || attr.type == "integer_unit"))
{
if (attr.value == "%")
// 走系统推荐
var param = recommendParamRst.productInfo.param.FirstOrDefault(p => p.categorys?.FirstOrDefault()?.name == attr.name);
if (param != null && param.categorys.Count == 2)
{
attrValue = param.categorys[1].name;
if (attrValue.Contains("磅") && attrValue.Replace("磅", "").ParseToDecimal() > 0)
{
if ((";" + attr.value + ";").Contains(";g;"))
attrValue = (attrValue.Replace("磅", "").ParseToDecimal() * 454).ParseToInt() + "g";
else if ((";" + attr.value + ";").Contains(";kg;"))
attrValue = (attrValue.Replace("磅", "").ParseToDecimal() * 0.454m).ParseToDecimal() + "kg";
}
}
else if (attr.value == "%")
attrValue = "10 %";
else if (attr.value == "g;kg")
attrValue = "50 g";
@@ -3617,29 +3655,27 @@ namespace TemuKJD.WXForms.ProductForms
prodInfo.detail.sku.FirstOrDefault().thumb_url = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1)?.url;
// 处理系统指定的规格名称
if (upProdParam.product.info.category.FirstOrDefault()?.name == "食品饮料" || prodInfo.detail.cats.FirstOrDefault() == "食品饮料")
if ((upProdParam.product.info.category.FirstOrDefault()?.name == "食品饮料" || prodInfo.detail.cats.FirstOrDefault() == "食品饮料") &&
(selectProd.cat_name == "坚果炒货" || selectProd.cat_name == "果干"))
{
if (selectProd.cat_name == "坚果炒货" || selectProd.cat_name == "果干")
if (!prodInfo.detail.sku.FirstOrDefault().spec.Any(s => s.parent_name == "规格/净含量"))
{
if (!prodInfo.detail.sku.FirstOrDefault().spec.Any(s => s.parent_name == "规格/净含量"))
foreach (var sku in prodInfo.detail.sku)
{
foreach (var sku in prodInfo.detail.sku)
{
sku.spec.FirstOrDefault().parent_name = "规格/净含量";
}
}
}
else
{
if (!prodInfo.detail.sku.FirstOrDefault().spec.Any(s => s.parent_name == "规格"))
{
foreach (var sku in prodInfo.detail.sku)
{
sku.spec.FirstOrDefault().parent_name = "规格";
}
sku.spec.FirstOrDefault().parent_name = "规格/净含量";
}
}
}
//else if ((upProdParam.product.info.category.FirstOrDefault()?.name == "食品饮料" || prodInfo.detail.cats.FirstOrDefault() == "食品饮料"))
//{
// if (!prodInfo.detail.sku.FirstOrDefault().spec.Any(s => s.parent_name == "规格"))
// {
// foreach (var sku in prodInfo.detail.sku)
// {
// sku.spec.FirstOrDefault().parent_name = "规格";
// }
// }
//}
else
{
var leafCat = upProdParam.product.info.category.LastOrDefault();
@@ -5028,7 +5064,7 @@ namespace TemuKJD.WXForms.ProductForms
}));
});
if (BaseClass.UserAuthority.Contains("商品裂变") && chkFissionGoodsName.Checked)
if (BaseClass.UserAuthority.Contains("裂变调试") && chkFissionGoodsName.Checked)
{
Invoke(new Action(() =>
{
@@ -5163,7 +5199,7 @@ namespace TemuKJD.WXForms.ProductForms
}
data += "&ban_wx=0";
data += "&in_ext_codes=" + txtExtCodeFilter.Text;
//data += "&in_ext_codes=" + txtExtCodeFilter.Text;
data += "&in_spu_ids=" + txtIdFilter.Text;
string serach_group = cmbGroupFilter.Text.Trim();
@@ -5178,13 +5214,13 @@ namespace TemuKJD.WXForms.ProductForms
data += "&product_name=" + txtSearchGoodsName.Text.Trim();
// 商品采集权限可以随机管理員或自己采集的商品
// 商品采集权限可以随机管理员或自己采集的商品
string addUserName = BaseClass.UserAuthority.Contains("商品采集") ? ("admin," + BaseClass.UserName) : "admin";
if (BaseClass.GroupId != 3)
addUserName = BaseClass.ParentAuthority.Contains("商品采集") ? ("admin," + BaseClass.ParentUserName) : "admin";
// 如果指定只有自己采集的商品,则只随机自己采集的商品
if ((cmbSourceType.Text.Trim().Contains("多多商品") || cmbSourceType.Text.Trim().Contains("1688商品")) &&
cmbSourceType.Text.Trim().Replace("多多商品", "").Replace("1688商品", "").Trim(',').IsNullOrEmpty())
if ((cmbSourceType.Text.Trim().Contains("多多商品") || cmbSourceType.Text.Trim().Contains("1688商品") || cmbSourceType.Text.Trim().Contains("微信商品")) &&
cmbSourceType.Text.Trim().Replace("多多商品", "").Replace("1688商品", "").Replace("微信商品", "").Trim(',').IsNullOrEmpty())
data += "&add_user_name=" + (BaseClass.GroupId == 3 ? BaseClass.UserName : BaseClass.ParentUserName);
else
data += "&add_user_name=" + addUserName;
@@ -5193,7 +5229,7 @@ namespace TemuKJD.WXForms.ProductForms
{
// 采集来源判断
data += "&product_get_type=" + cmbSourceType.Text.Trim().Replace("已采集数据", "1688外部数据")
.Replace("多多商品", "机会商品,多多外部数据").Replace("1688商品", "1688厂家,1688外部数据");
.Replace("多多商品", "机会商品,多多外部数据").Replace("1688商品", "1688厂家,1688外部数据").Replace("微信商品", "微信店采");
}
//if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
@@ -5692,7 +5728,7 @@ namespace TemuKJD.WXForms.ProductForms
private void cmbGroupFilter_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbGroupFilter.Text == "我的商品" && cmbSourceType.Text != "多多商品" && cmbSourceType.Text != "1688商品")
if (cmbGroupFilter.Text == "我的商品" && cmbSourceType.Text != "多多商品" && cmbSourceType.Text != "1688商品" && cmbSourceType.Text != "微信商品")
{
cmbSourceType.Text = "";
}
@@ -5830,7 +5866,7 @@ namespace TemuKJD.WXForms.ProductForms
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2
.Where(c => c.level == 2 && (cmbCateFilter2.Text.Trim() == cmbCateFilter1.DefaultText || (";" + cmbCateFilter2.Text.Trim() + ";")
.Contains(c.name))).ToList();
.Contains(";" + c.name + ";"))).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
//foreach (var cate3 in cates3)
//{
@@ -6086,7 +6122,7 @@ namespace TemuKJD.WXForms.ProductForms
if ((BaseClass.UserAuthority.Contains("商品采集") || BaseClass.ParentAuthority.Contains("商品采集")) &&
!BaseClass.UserAuthority.Contains("货源选择") && BaseClass.SaLevel == 0)
{
cmbSourceType.Text = "多多商品,1688商品";
cmbSourceType.Text = "多多商品,1688商品,微信商品";
cmbJstInitSet.Text = "";
}
}
@@ -6507,6 +6543,18 @@ Content-Type: application/octet-stream
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string generalProductInfoRecommend(ShopLoginInfo shop, WXUploadProductInfoRecommendParam recommendParam)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductupload/aiRecommendCompat/cgi/goods/generalProductInfoRecommend?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + recommendParam.productId + "&isUpdateAuditFree=0&source=list_edit&continueEditInfo={%22isEditingContinued%22:false,%22lastEditDraftTime%22:0,%22listingTime%22:0}";
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
string body = JsonConvert.SerializeObject(recommendParam, jsonSetting);
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
}
public class AddPriceRule