|
@@ -1300,30 +1300,34 @@
|
|
|
|
|
|
return outObj;
|
|
return outObj;
|
|
}, authority, this.execNum);
|
|
}, authority, this.execNum);
|
|
- // 主图下载
|
|
|
|
- for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
- let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
- if(fileName){
|
|
|
|
- let queryIndex = fileName.indexOf('?');
|
|
|
|
- if (queryIndex !== -1) {
|
|
|
|
- fileName = fileName.substr(0, queryIndex);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let num = Number(j) + 1;
|
|
|
|
- let suffix = '';
|
|
|
|
- if(fileName.lastIndexOf('.') > -1){
|
|
|
|
- suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
- fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
|
|
+
|
|
|
|
+ if(this.settingArr.indexOf('mainImg') > -1){
|
|
|
|
+ // 主图下载
|
|
|
|
+ for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
+ let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
+ if(fileName){
|
|
|
|
+ let queryIndex = fileName.indexOf('?');
|
|
|
|
+ if (queryIndex !== -1) {
|
|
|
|
+ fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
+ fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
+ await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
-
|
|
|
|
- let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
// sku图片下载
|
|
// sku图片下载
|
|
if(this.settingArr.indexOf('skuImg') > -1){
|
|
if(this.settingArr.indexOf('skuImg') > -1){
|
|
for(let j = 0; j < imgInfo.skuImg.length; j++){
|
|
for(let j = 0; j < imgInfo.skuImg.length; j++){
|
|
@@ -1586,27 +1590,29 @@
|
|
imgInfo.video = responseVideo;
|
|
imgInfo.video = responseVideo;
|
|
}
|
|
}
|
|
|
|
|
|
- // 主图下载
|
|
|
|
- for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
- let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
- if(fileName){
|
|
|
|
- let queryIndex = fileName.indexOf('?');
|
|
|
|
- if (queryIndex !== -1) {
|
|
|
|
- fileName = fileName.substr(0, queryIndex);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let num = Number(j) + 1;
|
|
|
|
- let suffix = '';
|
|
|
|
- if(fileName.lastIndexOf('.') > -1){
|
|
|
|
- suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
- fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
|
|
+ if(this.settingArr.indexOf('mainImg') > -1){
|
|
|
|
+ // 主图下载
|
|
|
|
+ for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
+ let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
+ if(fileName){
|
|
|
|
+ let queryIndex = fileName.indexOf('?');
|
|
|
|
+ if (queryIndex !== -1) {
|
|
|
|
+ fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
+ fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
+ await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
-
|
|
|
|
- let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1794,26 +1800,28 @@
|
|
}, authority, this.execNum);
|
|
}, authority, this.execNum);
|
|
|
|
|
|
// 主图下载
|
|
// 主图下载
|
|
- for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
- let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
- if(fileName){
|
|
|
|
- let queryIndex = fileName.indexOf('?');
|
|
|
|
- if (queryIndex !== -1) {
|
|
|
|
- fileName = fileName.substr(0, queryIndex);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let num = Number(j) + 1;
|
|
|
|
- let suffix = '';
|
|
|
|
- if(fileName.lastIndexOf('.') > -1){
|
|
|
|
- suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
- fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
|
|
+ if(this.settingArr.indexOf('mainImg') > -1){
|
|
|
|
+ for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
+ let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
+ if(fileName){
|
|
|
|
+ let queryIndex = fileName.indexOf('?');
|
|
|
|
+ if (queryIndex !== -1) {
|
|
|
|
+ fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
+ fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
+ await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
-
|
|
|
|
- let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|