Ubuntu

Translate stock name to stock code 22

Showing 1 changed file with 34 additions and 7 deletions
......@@ -8,8 +8,9 @@ const HTTPS = require('https');
const domain = "2020105648.oss2021.tk"
const sslport = 23023;
const bodyParser = require('body-parser');
const fs = require('fs');
var app = express();
//var lan = "en"
var stock_code = "005930"
app.use(bodyParser.json());
......@@ -20,7 +21,29 @@ app.post('/hook', function (req, res) {
var message = eventObj.message;
let storkList = []
let stockList = [];
import './stock_names.txt';
fs.readFile('./stock_names.txt', 'utf8', (err,data) => {
if (err){
console.error(err)
return
}
console.log(data)
})
// fs.readFile('./stock_names.txt', 'utf8', (err,data) => {
// if (err){
// console.error(err)
// return
// }
// var stockList = data.toString().split("\n");
// for (i in stockList) {
// console.log(stockList[i]);
// }
// })
// ########
// file import
......@@ -28,12 +51,16 @@ app.post('/hook', function (req, res) {
// [000660, SK하이닉스]
// stockList = [[000660, sk하이닉스], []]
}
//}
for (let i=0; i<stockList.length; i++){
if (stockList[i][1] == SK하이닉스)
return stickList[i][0]
}
// for (let i=0; i<stockList.length; i++){
// if (eventObj.message.text == stockList[i][1]){
// stock_code = stockList[i][0]
// }
// else{
// print('Not in list');
// }
// }
// ############
// request log
......