marketSearch.js
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { daangnMultiSearch } = require("./daangnSearch");
const { bunjangMultiSearch } = require("./bunjangSearch");
const { joongnaMultiSearch } = require("./joongnaSearch");
const setCarouselMessage = require("../message/setCarouselMessage");
const marketMultiSearch = (keyword) => {
const result = [];
return new Promise((resolve, reject) => {
daangnMultiSearch(keyword).then((res) => {
console.log(`daangn: ${res}`);
if (res !== undefined && res !== null) {
for (let i = 0; i < res.length && i < 4; i++) {
result.push(res[i]);
}
}
bunjangMultiSearch(keyword).then((res) => {
console.log(`bunjang: ${res}`);
if (res !== undefined && res !== null) {
for (let i = 0; i < res.length && i < 4; i++) {
result.push(res[i]);
}
}
joongnaMultiSearch(keyword).then((res) => {
console.log(`joongna: ${res}`);
if (res !== undefined && res !== null) {
for (let i = 0; i < res.length && i < 4; i++) {
result.push(res[i]);
}
}
resolve(result);
});
});
});
});
};
module.exports = { marketMultiSearch };