fix
This commit is contained in:
@@ -9,8 +9,12 @@
|
||||
<div class="brandsList">
|
||||
<div class="brand" :class="db_name === 'verity' && 'selected'">
|
||||
<button @click="db_name = 'verity'">
|
||||
<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>
|
||||
</div>
|
||||
<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" :class="g === 1 && 'selected'">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,8 @@ const readXlsxFile = require('read-excel-file/node')
|
||||
const guaranteeSerialsPath = './static/uploads/serials'
|
||||
const productSerialsPath = './static/uploads/serials_products'
|
||||
|
||||
const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
|
||||
return new Promise(async (reso, rej) => {
|
||||
const serialChecker = (serial, type = 'guaranteeSerial', g = 1) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let exelsPath;
|
||||
if (type === 'guaranteeSerial') exelsPath = guaranteeSerialsPath + `/${g}`;
|
||||
if (type === 'orginality') exelsPath = productSerialsPath + `/${g}`;
|
||||
@@ -14,28 +14,30 @@ const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
|
||||
|
||||
try {
|
||||
const serialFiles = await fs.readdirSync(exelsPath);
|
||||
if((serialFiles?.length) <= 0){
|
||||
rej("این کد در سامانه موجود نیست")
|
||||
}
|
||||
serialFiles.forEach(async(file, i)=>{
|
||||
if ((serialFiles?.length) <= 0) {
|
||||
// eslint-disable-next-line prefer-promise-reject-errors
|
||||
reject("این کد در سامانه موجود نیست")
|
||||
}
|
||||
serialFiles.forEach(async (file, i) => {
|
||||
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
|
||||
|
||||
|
||||
for (const row of exelFile) {
|
||||
for (const col of row) {
|
||||
if (col == lowerSerial) {
|
||||
reso(row[2]);
|
||||
|
||||
if ((row[1].toString()).toLowerCase() == lowerSerial) {
|
||||
resolve(row[2]);
|
||||
return; // Serial found, exit loop
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if((serialFiles.length - 1) <= i){
|
||||
rej("این کد در سامانه موجود نیست")
|
||||
if ((serialFiles.length - 1) <= i) {
|
||||
// eslint-disable-next-line prefer-promise-reject-errors
|
||||
reject("این کد در سامانه موجود نیست")
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
rej(e);
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user