Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최은석
/
ossw-project
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
최은석
2022-06-04 10:09:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
daf2fb1403e6f5f968cef254215bfaf0c6124c53
daf2fb14
1 parent
cd914905
fix waiting with showing chat within 1 hour
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
server/Router/api.js
server/Router/api.js
View file @
daf2fb1
...
...
@@ -185,8 +185,22 @@ router.get('/api/waiting', async (req, res) => {
const
today
=
getCurrentDate
();
var
waitingList
=
await
waitingModel
.
findOne
({
date
:
today
});
if
(
waitingList
==
null
)
waitingList
=
[]
else
waitingList
=
waitingList
.
waiting
;
res
.
send
(
waitingList
);
else
waitingList
=
waitingList
.
waiting
;
const
date
=
new
Date
();
var
hour
=
date
.
getHours
();
hour
=
hour
<
10
?
'0'
+
hour
.
toString
()
:
hour
.
toString
();
var
minute
=
date
.
getMinutes
();
minute
=
minute
<
10
?
'0'
+
minute
.
toString
()
:
minute
.
toString
();
const
time
=
Number
(
hour
+
minute
);
var
result
=
[];
for
(
const
waiting
of
waitingList
){
if
(
time
-
Number
(
waiting
.
time
.
replace
(
':'
,
''
))
<=
100
){
result
.
push
(
waiting
)
}
}
res
.
send
(
result
);
}
catch
(
err
)
{
res
.
send
(
err
.
message
);
...
...
@@ -199,7 +213,11 @@ router.post('/api/waiting', async (req, res) => {
var
waitingList
=
await
waitingModel
.
findOne
({
date
:
today
});
const
date
=
new
Date
();
const
time
=
date
.
getHours
()
+
":"
+
date
.
getMinutes
();
var
hour
=
date
.
getHours
();
hour
=
hour
<
10
?
'0'
+
hour
.
toString
()
:
hour
.
toString
();
var
minute
=
date
.
getMinutes
();
minute
=
minute
<
10
?
'0'
+
minute
.
toString
()
:
minute
.
toString
();
const
time
=
hour
+
":"
+
minute
;
const
newWaiting
=
{
value
:
req
.
body
.
value
,
time
:
time
};
if
(
waitingList
==
null
)
await
waitingModel
({
date
:
today
,
waiting
:
[
newWaiting
]}).
save
();
...
...
@@ -217,6 +235,7 @@ router.post('/api/waiting', async (req, res) => {
});
function
setting
(
resultJson
){
var
result
=
{}
result
.
fo_date
=
[
resultJson
.
fo_date1
,
resultJson
.
fo_date2
,
resultJson
.
fo_date3
,
resultJson
.
fo_date4
,
resultJson
.
fo_date5
];
...
...
Please
register
or
login
to post a comment