Commit 566e59a1 authored by edwin's avatar edwin

combine ECAsset and GlobalAsset result

parent 974be349
...@@ -93,14 +93,14 @@ ...@@ -93,14 +93,14 @@
// fetch product URL // fetch product URL
let currentms = new Date().getTime(); let currentms = new Date().getTime();
let assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=main_product%2FGU%2F${SKU}&t=datacategory%2Fecasset&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} product image`); let assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=main_product%2FGU%2F${SKU}&t=datacategory%2Fecasset&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} ECAsset`);
let DOMString = createDOMString(SKU, assetlist); let DOMString = createDOMString(SKU, assetlist);
container.insertAdjacentHTML('beforeend', DOMString); container.insertAdjacentHTML('beforeend', DOMString);
clientSideFilter(); clientSideFilter();
// fetch model URL // fetch model URL
currentms = new Date().getTime(); 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`); assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=datacategory%2Fasset&w=${SKU}&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} GlobalAsset`);
DOMString = createDOMString(SKU, assetlist); DOMString = createDOMString(SKU, assetlist);
container.insertAdjacentHTML('beforeend', DOMString); container.insertAdjacentHTML('beforeend', DOMString);
clientSideFilter(); clientSideFilter();
...@@ -183,24 +183,20 @@ ...@@ -183,24 +183,20 @@
// first link // first link
let currentms = new Date().getTime(); let currentms = new Date().getTime();
let assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=main_product%2FGU%2F${SKU}&t=datacategory%2Fecasset&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} product image`); let assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=main_product%2FGU%2F${SKU}&t=datacategory%2Fecasset&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} ECAsset`);
let downloadlist = filtering(assetlist, SKU); let downloadlist = filtering(assetlist, SKU);
await downloadList(downloadlist["product"], `${SKU}`);
await sleep(sleepTime); await sleep(sleepTime);
let is_old = assetlist.length === 0; let productlist = downloadlist["product"];
let modellist = downloadlist["model"]; let modellist = downloadlist["model"];
// second link // second link
currentms = new Date().getTime(); 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`); assetlist = await fetchSKU(`${baseurl}api/asset?time=${currentms}&t=datacategory%2Fasset&w=${SKU}&r=north&z=${fetchNumber}&c=DEFAULT`, `${SKU} GlobalAsset`);
downloadlist = filtering(assetlist, SKU); downloadlist = filtering(assetlist, SKU);
if(is_old){ await downloadList(downloadlist["product"].concat(productlist), `${SKU}`);
addDebugMessage(`re-attempt download product list`); await sleep(sleepTime);
await downloadList(downloadlist["product"], `${SKU}`);
await sleep(sleepTime);
}
await downloadList(downloadlist["model"].concat(modellist), `${SKU}_model`); await downloadList(downloadlist["model"].concat(modellist), `${SKU}_model`);
await sleep(sleepTime); await sleep(sleepTime);
......
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