Fix serial checker bug
This commit is contained in:
@@ -101,7 +101,7 @@ module.exports.checkSerial = [
|
||||
try {
|
||||
const { serial, type, g } = req.body
|
||||
const serialStatus = await serialChecker(serial, type, g)
|
||||
console.log("s");
|
||||
console.log(serialStatus);
|
||||
|
||||
let okMsg
|
||||
if (type === 'guaranteeSerial') okMsg = serialStatus
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ const inHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@asan-service:27017/as
|
||||
const outHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@hotaka.liara.cloud:33794/asanserv_database?authSource=admin'
|
||||
const init = ()=>{
|
||||
try {
|
||||
mongoose.connect(outHostUrl, {
|
||||
mongoose.connect(inHostUrl, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
useFindAndModify: false,
|
||||
|
||||
@@ -9,7 +9,7 @@ const serialChecker = (serial, type = 'guaranteeSerial', g = 1) => {
|
||||
if (type === 'guaranteeSerial') exelsPath = guaranteeSerialsPath + `/${g}`;
|
||||
if (type === 'orginality') exelsPath = productSerialsPath + `/${g}`;
|
||||
|
||||
console.log("s");
|
||||
|
||||
|
||||
const lowerSerial = serial.toString().toLowerCase().trim().replace("-", "")
|
||||
|
||||
@@ -19,14 +19,14 @@ console.log("s");
|
||||
// eslint-disable-next-line prefer-promise-reject-errors
|
||||
reject("این کد در سامانه موجود نیست")
|
||||
}
|
||||
|
||||
|
||||
serialFiles.forEach(async (file, i) => {
|
||||
if (file.split('.').some(item => ['xlsx', 'xltx', 'xlsm', 'xlsb'].includes(item))) {
|
||||
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
|
||||
console.log(file);
|
||||
|
||||
for (const row of exelFile) {
|
||||
console.log(row);
|
||||
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if ((row[1].toString()).toLowerCase().trim() == lowerSerial) {
|
||||
resolve(row[2]);
|
||||
|
||||
Reference in New Issue
Block a user