fix
This commit is contained in:
@@ -9,8 +9,12 @@
|
|||||||
<div class="brandsList">
|
<div class="brandsList">
|
||||||
<div class="brand" :class="db_name === 'verity' && 'selected'">
|
<div class="brand" :class="db_name === 'verity' && 'selected'">
|
||||||
<button @click="db_name = 'verity'">
|
<button @click="db_name = 'verity'">
|
||||||
<i class="fas fa-phone-laptop"></i>
|
<span class="row">
|
||||||
<span>لوازم جانبی کامپیوتر ، موبایل و محصولات حافظه</span>
|
<i class="fas fa-phone-laptop" style=" margin-right: -10px;"></i>
|
||||||
|
<i class="fas fa-gamepad" style="margin-top: 32px; position: absolute; margin-right: 25px;"></i>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>لوازم جانبی کامپیوتر ، موبایل ، حافظه و کنسول</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand" :class="db_name === 'panatech' && 'selected'">
|
<div class="brand" :class="db_name === 'panatech' && 'selected'">
|
||||||
|
|||||||
+7
-2
@@ -19,8 +19,13 @@
|
|||||||
<div class="brand-sp col-lg-6 col-md-6 col-sm-12" >
|
<div class="brand-sp col-lg-6 col-md-6 col-sm-12" >
|
||||||
<div class="brand" :class="g === 1 && 'selected'">
|
<div class="brand" :class="g === 1 && 'selected'">
|
||||||
<button @click="openModal(1)">
|
<button @click="openModal(1)">
|
||||||
<i class="fas fa-phone-laptop"></i>
|
|
||||||
<span>لوازم جانبی کامپیوتر ، موبایل و محصولات حافظه</span>
|
<span class="row">
|
||||||
|
<i class="fas fa-phone-laptop" style=" margin-right: -10px;"></i>
|
||||||
|
<i class="fas fa-gamepad" style="margin-top: 32px; position: absolute; margin-right: 25px;"></i>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>لوازم جانبی کامپیوتر ، موبایل ، حافظه و کنسول</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ const readXlsxFile = require('read-excel-file/node')
|
|||||||
const guaranteeSerialsPath = './static/uploads/serials'
|
const guaranteeSerialsPath = './static/uploads/serials'
|
||||||
const productSerialsPath = './static/uploads/serials_products'
|
const productSerialsPath = './static/uploads/serials_products'
|
||||||
|
|
||||||
const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
|
const serialChecker = (serial, type = 'guaranteeSerial', g = 1) => {
|
||||||
return new Promise(async (reso, rej) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
let exelsPath;
|
let exelsPath;
|
||||||
if (type === 'guaranteeSerial') exelsPath = guaranteeSerialsPath + `/${g}`;
|
if (type === 'guaranteeSerial') exelsPath = guaranteeSerialsPath + `/${g}`;
|
||||||
if (type === 'orginality') exelsPath = productSerialsPath + `/${g}`;
|
if (type === 'orginality') exelsPath = productSerialsPath + `/${g}`;
|
||||||
@@ -14,28 +14,30 @@ const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const serialFiles = await fs.readdirSync(exelsPath);
|
const serialFiles = await fs.readdirSync(exelsPath);
|
||||||
if((serialFiles?.length) <= 0){
|
if ((serialFiles?.length) <= 0) {
|
||||||
rej("این کد در سامانه موجود نیست")
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
}
|
reject("این کد در سامانه موجود نیست")
|
||||||
serialFiles.forEach(async(file, i)=>{
|
}
|
||||||
|
serialFiles.forEach(async (file, i) => {
|
||||||
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
|
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
|
||||||
|
|
||||||
for (const row of exelFile) {
|
for (const row of exelFile) {
|
||||||
for (const col of row) {
|
|
||||||
if (col == lowerSerial) {
|
if ((row[1].toString()).toLowerCase() == lowerSerial) {
|
||||||
reso(row[2]);
|
resolve(row[2]);
|
||||||
return; // Serial found, exit loop
|
return; // Serial found, exit loop
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if((serialFiles.length - 1) <= i){
|
if ((serialFiles.length - 1) <= i) {
|
||||||
rej("این کد در سامانه موجود نیست")
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
|
reject("این کد در سامانه موجود نیست")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
rej(e);
|
reject(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user