|
@@ -19,7 +19,7 @@ fs.readFile(dataPath, (err, buf) => {
|
|
|
console.error(err)
|
|
|
return
|
|
|
}
|
|
|
- STATIC_DATA = buf.toString().replace('\n', '')
|
|
|
+ STATIC_DATA = buf.toString().replace('\n', '').split(',')
|
|
|
})
|
|
|
|
|
|
fs.watchFile(dataPath, watchFileOptions, (curr, prev) => {
|
|
@@ -84,7 +84,7 @@ router.get('/list', (ctx, next) => {
|
|
|
if (cache.has(code)) {
|
|
|
data = cache.get(code)
|
|
|
} else {
|
|
|
- const jsonData = STATIC_DATA || []
|
|
|
+ const jsonData = STATIC_DATA || ''
|
|
|
const len = 25
|
|
|
const sum = jsonData.length - len
|
|
|
const arr = new Array(25).fill(1).map(el => Math.floor(Math.random() * sum))
|