Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대선
/
Recruitment_Information_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김대선
2021-06-08 21:39:00 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8dba3ba89bd3b15d75e0235ebaaa9141b3c5976a
8dba3ba8
1 parent
b8c21a8f
데이터 로드시 당일 데이터가 없을 때 전일 데이터 가져옴
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletions
functions/dataFunctions.js
functions/dataFunctions.js
View file @
8dba3ba
...
...
@@ -7,8 +7,31 @@ const read = () =>{
let
tags
=
[]
let
url
=
""
let
companyName
=
""
// const today = new Date()
const
today
=
new
Date
()
const
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()}
.
${
today
.
getMonth
()}
.
${
today
.
getDate
()}
`
,
'utf-8'
,
'r'
)
let
string
try
{
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()}
.
${
today
.
getMonth
()}
.
${
today
.
getDate
()}
`
,
'utf-8'
,
'r'
)
}
catch
(
error
)
{
if
(
today
.
getDate
()
-
1
==
0
){
if
([
1
,
3
,
5
,
7
,
8
,
10
,
12
].
includes
(
today
.
getMonth
()
-
1
)){
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()}
.
${
today
.
getMonth
()
-
1
}
.
${
31
}
`
,
'utf-8'
,
'r'
)
}
else
if
([
4
,
6
,
9
,
11
].
includes
(
today
.
getMonth
()
-
1
)){
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()}
.
${
today
.
getMonth
()}
.
${
30
}
`
,
'utf-8'
,
'r'
)
}
else
if
(
2
==
today
.
getMonth
()
-
1
){
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()}
.
${
today
.
getMonth
()}
.
${
28
}
`
,
'utf-8'
,
'r'
)
}
else
if
(
0
==
today
.
getMonth
()
-
1
){
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()
-
1
}
.
${
12
}
.
${
31
}
`
,
'utf-8'
,
'r'
)
}
}
else
{
string
=
fs
.
readFileSync
(
`./datas/
${
today
.
getFullYear
()}
.
${
today
.
getMonth
()}
.
${
today
.
getDate
()
-
1
}
`
,
'utf-8'
,
'r'
)
}
}
return
string
const
stringArray
=
string
.
split
(
'\n'
)
const
size
=
stringArray
.
length
for
(
let
i
=
0
;
i
<
size
;
i
++
){
...
...
Please
register
or
login
to post a comment