Commit db752e45 authored by edwin's avatar edwin

add back old logic such it can download old sku format

parent 93e6e082
......@@ -154,7 +154,7 @@
(asset.filename.match(new RegExp(`^goods_[0-9]{2}_${SKU}$`)) && asset.models.length === 0 && asset.products.length === 1)
) {
classes = "is-product";
} else if( tagid.find(x => x.includes("Model") || x.includes("Appeal POP")) ) {
classes = "is-model";
} else{
......@@ -199,10 +199,19 @@
await downloadList(assetlist, `${SKU}`);
await sleep(sleepTime);
let is_old = assetlist.length === 0;
// &t=datacategory%2Fasset&w=341947&r=north&z=30&c=DEFAULT
currentms = new Date().getTime();
assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=datacategory%2Fasset&w=${SKU}&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} model image`);
let downloadlist = filtering(assetlist, SKU);
if(is_old){
addDebugMessage(`re-attempt download product list`);
await downloadList(downloadlist["product"], `${SKU}`);
await sleep(sleepTime);
}
await downloadList(downloadlist["model"], `${SKU}_model`);
await sleep(sleepTime);
}
......@@ -293,11 +302,19 @@
let tagid = item.tags.map(x => x.id);
if (item.filename.includes("GU_")) {
if (item.filename.includes(`goods_${SKU}_sub`) ||
item.filename.includes(`_${SKU}_chip`) ||
(item.filename.match(new RegExp(`^goods_[0-9]{2}_${SKU}$`)) && item.models.length === 0 && item.products.length === 1) // file name include SKU and no model
) {
arrlist["product"].push(item);
} else if (item.filename.includes(`${SKU}_I0`) ||
(item.filename.includes("goods") && !item.filename.includes(SKU)) ||
item.tags.map(x => x.id).includes("assettype/Poster") || item.filename.includes("GU_")
) {
// not adding to model
} else if( tagid.find(x => x.includes("Model") || x.includes("Appeal POP")) ) {
}else if ( tagid.find(x => x.includes("Model") || x.includes("Appeal POP")) ) {
arrlist["model"].push(item);
}
return arrlist;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment