Authored by 郝肖肖

Merge branch 'feature/libxml-xsd'

const xsd = require('libxml-xsd');
const fs = require('fs');
const xml = './public/dist/goods-xml/goods-1.xml';
const xmlFile = fs.readFileSync(xml).toString();
xsd.parseFile('./apps/controllers/seo/xm.xsd', function(err1, schema) {
console.log(err1, schema);
schema.validate(xmlFile, function(err, validationErrors) {
console.log(err);
console.log(validationErrors);
});
});
const xsdFile = fs.readFileSync('./apps/controllers/seo/xm.xsd').toString();
for (let i = 1; i <= 32; i++) {
const xml = `./public/dist/goods-xml/goods-${i}.xml`;
const xmlFile = fs.readFileSync(xml).toString();
const schema = xsd.parse(xsdFile);
const validationErrors = schema.validate(xmlFile);
console.log(`check => start: ${i} `);
validationErrors && validationErrors.forEach(verr => {
console.log(i, verr.line, verr.str1);
});
}
... ...
... ... @@ -194,8 +194,8 @@ const baiduBrand = {
yoho: '袜子',
categoryLv1: '服饰内衣',
categoryLv2: '内衣',
categoryLv3: '休闲棉袜',
categoryLv4: '休闲棉袜'
categoryLv3: '休闲棉袜 ',
categoryLv4: '休闲棉袜 '
},
147: {
yoho: '休闲/运动鞋',
... ... @@ -964,8 +964,8 @@ const baiduBrand = {
yoho: '袜子',
categoryLv1: '服饰内衣',
categoryLv2: '内衣',
categoryLv3: '休闲棉袜',
categoryLv4: '休闲棉袜'
categoryLv3: '休闲棉袜 ',
categoryLv4: '休闲棉袜 '
},
411: {
yoho: '手拎包/单肩包',
... ... @@ -1025,10 +1025,10 @@ const baiduBrand = {
},
486: {
yoho: '灯具',
categoryLv1: '家用电器',
categoryLv2: '五金家装',
categoryLv3: '灯具',
categoryLv4: '灯具'
categoryLv1: '家装建材',
categoryLv2: '灯饰照明',
categoryLv3: 'LED灯',
categoryLv4: ''
},
488: {
yoho: '打火机',
... ... @@ -1179,9 +1179,9 @@ const baiduBrand = {
},
1218: {
yoho: 'GoPro',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '数码',
categoryLv2: '摄影摄像',
categoryLv3: '运动相机',
categoryLv4: ''
},
1220: {
... ... @@ -1298,37 +1298,37 @@ const baiduBrand = {
},
1254: {
yoho: '安全避孕',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '医药保健',
categoryLv2: '计生情趣',
categoryLv3: '安全避孕',
categoryLv4: ''
},
1256: {
yoho: '情爱玩具',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '医药保健',
categoryLv2: '计生情趣',
categoryLv3: '女用器具',
categoryLv4: ''
},
1258: {
yoho: '人体润滑',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '医药保健',
categoryLv2: '计生情趣',
categoryLv3: '人体润滑',
categoryLv4: ''
},
1260: {
yoho: '验孕测孕',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '医药保健',
categoryLv2: '计生情趣',
categoryLv3: '验孕测孕',
categoryLv4: ''
},
1262: {
yoho: 'SM用品',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '医药保健',
categoryLv2: '计生情趣',
categoryLv3: '人体润滑',
categoryLv4: ''
},
1264: {
... ... @@ -1419,8 +1419,8 @@ const baiduBrand = {
yoho: '电子秤/厨房秤',
categoryLv1: '家用电器',
categoryLv2: '个护健康',
categoryLv3: '电子秤/厨房秤',
categoryLv4: '电子秤'
categoryLv3: '电子秤',
categoryLv4: ''
},
1292: {
yoho: '血糖仪',
... ... @@ -1438,9 +1438,9 @@ const baiduBrand = {
},
1296: {
yoho: '温度计',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '医药保健',
categoryLv2: '保健器械',
categoryLv3: '体温计',
categoryLv4: ''
},
1298: {
... ... @@ -1452,10 +1452,10 @@ const baiduBrand = {
},
1300: {
yoho: '电子血压计',
categoryLv1: '家用电器',
categoryLv2: '个护健康',
categoryLv1: '医药保健',
categoryLv2: '保健器械',
categoryLv3: '血压计',
categoryLv4: '血压计'
categoryLv4: ''
},
1302: {
yoho: '智能眼镜',
... ... @@ -2216,9 +2216,9 @@ const baiduBrand = {
1532: {
yoho: '图书/杂志',
categoryLv1: '图书',
categoryLv2: '图书',
categoryLv3: '图书',
categoryLv4: '图书'
categoryLv2: '小说',
categoryLv3: '期刊杂志',
categoryLv4: ''
},
1534: {
yoho: '纹身贴',
... ... @@ -2565,10 +2565,10 @@ const baiduBrand = {
},
1650: {
yoho: '灯具',
categoryLv1: '家用电器',
categoryLv2: '五金家装',
categoryLv3: '灯具',
categoryLv4: '灯具'
categoryLv1: '家装建材',
categoryLv2: '灯饰照明',
categoryLv3: 'LED灯',
categoryLv4: ''
},
1652: {
yoho: '唇部护理',
... ... @@ -2810,16 +2810,16 @@ const baiduBrand = {
},
1726: {
yoho: '宠物主粮',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '宠物生活',
categoryLv2: '宠物主粮',
categoryLv3: '狗粮',
categoryLv4: ''
},
1728: {
yoho: '宠物零食',
categoryLv1: '',
categoryLv2: '',
categoryLv3: '',
categoryLv1: '宠物生活',
categoryLv2: '宠物主粮',
categoryLv3: '狗粮',
categoryLv4: ''
},
1730: {
... ... @@ -3343,7 +3343,7 @@ const baiduBrand = {
1902: {
yoho: '毛衣',
categoryLv1: '服饰内衣',
categoryLv2: '装',
categoryLv2: '装',
categoryLv3: '羊毛衫',
categoryLv4: '羊毛衫'
},
... ...
... ... @@ -59,7 +59,7 @@ class SeoIndexModel extends global.yoho.BaseModel {
_.each(productLists, item => {
let images = [];
if (!baiduBrand[item.small_sort_id]) {
if (!baiduBrand[item.small_sort_id] || !baiduBrand[item.small_sort_id].categoryLv1) {
console.error(`goods-xml => s_sort_id: ${item.small_sort_id}, s_sort_name: ${item.small_sort_name}, baidu cate is null`);// eslint-disable-line
return true;
}
... ...