拼多多上货类目匹配
This commit is contained in:
1 parent
e7ece386e9
commit
e80cf369c8
4 files changed
+58
-15
No files matched your search
@@ -65,7 +65,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 1183;
|
||||
public static int VersionCount = 1186;
|
||||
public static string MainPath = "29wx";
|
||||
//public static string MainPath = "29wx";
|
||||
//public static string MainPath = "29pdd";
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ Global
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|x64.Build.0 = Debug|x86
|
||||
{6461D807-B1C8-45F0-B388-E0CA1A418DE0}.Debug|x86.ActiveCfg = Debug|x86
|
||||
|
||||
@@ -3163,11 +3163,19 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (propInfo.name == "容量")
|
||||
{
|
||||
|
||||
}
|
||||
if (propInfo.name == "格数")
|
||||
{
|
||||
|
||||
}
|
||||
if (propInfo.values.Count == 0)
|
||||
continue;
|
||||
|
||||
var attr = productAttr.attr.FirstOrDefault(r => r.name == propInfo.name);
|
||||
if (attr == null)
|
||||
attr = productAttr.attr.FirstOrDefault(r => r.name.Replace("填充材料", "填充材质") == propInfo.name ||
|
||||
r.name.Replace("材质", "材质种类") == propInfo.name);
|
||||
// 材质 产品名称 适用年龄 面料 生产企业名称 CCC证书编号 尺寸(长) 尺寸(宽) 尺寸(高) 物品(含配件)清单 型号 产品名称
|
||||
if (propInfo.name == "生产日期" && propInfo.values.Count > 0)
|
||||
{
|
||||
propInfo.values.FirstOrDefault().value = DateTime.Now.Date.AddDays(-15).ToString("yyyy-MM-dd");
|
||||
@@ -3248,6 +3256,8 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
var attrValueLst = attr.value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
var attrValue = attrValueLst.FirstOrDefault(v => v == propInfo.values.FirstOrDefault()?.value);
|
||||
if (attrValue.IsNullOrEmpty())
|
||||
attrValue = attrValueLst.FirstOrDefault(v => v.Replace("高硼硅玻璃", "耐热玻璃(高硼硅)") == propInfo.values.FirstOrDefault()?.value);
|
||||
if (propInfo.name == "保质期")
|
||||
{
|
||||
attrValue = "30 天";
|
||||
@@ -3368,6 +3378,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
attrValue = "7 岁以上";
|
||||
if (propInfo.values.FirstOrDefault().value.Contains("岁以上") || propInfo.values.FirstOrDefault().value.Contains("个月以上"))
|
||||
attrValue = propInfo.values.FirstOrDefault().value;
|
||||
if (propInfo.values.FirstOrDefault().value.Contains("岁"))
|
||||
{
|
||||
var propValue = propInfo.values.FirstOrDefault().value;
|
||||
var match = BaseRegex.GetMatchRegexString(ref propValue, @"([\d]{1,3})");
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
{
|
||||
attrValue = match + " 岁以上";
|
||||
}
|
||||
}
|
||||
else if (propInfo.values.FirstOrDefault().value.Contains("月"))
|
||||
{
|
||||
var propValue = propInfo.values.FirstOrDefault().value;
|
||||
var match = BaseRegex.GetMatchRegexString(ref propValue, @"([\d]{1,3})");
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
{
|
||||
attrValue = match + " 个月以上";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (attr.value == "个")
|
||||
{
|
||||
@@ -3425,20 +3453,35 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
else
|
||||
{
|
||||
attrValue = propInfo.values.FirstOrDefault()?.value.ParseToString();
|
||||
var units = attr.value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var unit in units)
|
||||
var param = recommendParamRst.productInfo.param.FirstOrDefault(p => p.categorys?.FirstOrDefault()?.name == attr.name);
|
||||
if (param != null && param.categorys.Count == 2)
|
||||
{
|
||||
var val = attrValue.Replace(unit, "").Trim();
|
||||
if (attr.type == "decimal4_unit" && val.ParseToDecimal() != 0m)
|
||||
attrValue = param.categorys[1].name;
|
||||
if (attrValue.Contains("磅") && attrValue.Replace("磅", "").ParseToDecimal() > 0)
|
||||
{
|
||||
attrValue = val + " " + unit;
|
||||
break;
|
||||
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";
|
||||
}
|
||||
if (attr.type == "integer_unit" && val.ParseToInt() != 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
attrValue = propInfo.values.FirstOrDefault()?.value.ParseToString();
|
||||
var units = attr.value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var unit in units)
|
||||
{
|
||||
attrValue = val + " " + unit;
|
||||
break;
|
||||
var val = attrValue.Replace(unit, "").Trim();
|
||||
if (attr.type == "decimal4_unit" && val.ParseToDecimal() != 0m)
|
||||
{
|
||||
attrValue = val + " " + unit;
|
||||
break;
|
||||
}
|
||||
if (attr.type == "integer_unit" && val.ParseToInt() != 0)
|
||||
{
|
||||
attrValue = val + " " + unit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3507,7 +3550,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
//{
|
||||
// attrValue = attrValueLst.FirstOrDefault();
|
||||
//}
|
||||
else
|
||||
else if (!(attr.type == "decimal4_unit" || attr.type == "integer_unit"))
|
||||
attrValue = attrValueLst.Where(v => !"真丝、蚕丝、香云纱、羊绒、羊毛、羊羔绒、羊羔毛、羽绒、皮草".Contains(v)).OrderBy(x => Guid.NewGuid()).FirstOrDefault();
|
||||
|
||||
//书籍属性处理
|
||||
|
||||
Reference in new issue
Block a user