Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김가영
/
Probability Death
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
Ubuntu
2019-05-29 03:25:47 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bfc98f9da0bd1896aace1873d92e4daf53e7fa0b
bfc98f9d
1 parent
fa9ee663
add client love state and add probability 1.24
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
7 deletions
app.js
lib/socketio.js
routes/index.js
views/index - 복사본.ejs
views/index.ejs
views/main.ejs
views/re.ejs
app.js
View file @
bfc98f9
...
...
@@ -20,8 +20,8 @@ app.use(express.urlencoded({ extended: false }));
app
.
use
(
cookieParser
());
app
.
use
(
'/'
,
express
.
static
(
path
.
join
(
__dirname
,
'public'
)));
app
.
use
(
'/'
,
express
.
static
(
path
.
join
(
__dirname
,
'code'
)));
app
.
use
(
'/name/:name/birth/:birth/city/:city/county/:county/village/:village'
,
express
.
static
(
path
.
join
(
__dirname
,
'public'
)));
app
.
use
(
'/name/:name/birth/:birth/city/:city/county/:county/village/:village'
,
express
.
static
(
path
.
join
(
__dirname
,
'code'
)));
app
.
use
(
'/name/:name/birth/:birth/
love/:love/
city/:city/county/:county/village/:village'
,
express
.
static
(
path
.
join
(
__dirname
,
'public'
)));
app
.
use
(
'/name/:name/birth/:birth/
love/:love/
city/:city/county/:county/village/:village'
,
express
.
static
(
path
.
join
(
__dirname
,
'code'
)));
app
.
use
(
'/'
,
indexRouter
);
app
.
use
(
'/users'
,
usersRouter
);
...
...
lib/socketio.js
View file @
bfc98f9
...
...
@@ -18,6 +18,7 @@ module.exports = (server, app) => {
let
client_send
=
{};
let
client_name
=
""
;
let
client_birth
;
let
client_love
=
""
;
let
Destiny
;
let
sql
;
let
city
;
...
...
@@ -95,6 +96,10 @@ console.log(Current_Weather);
+
info
.
windspd
*
1
+
(
info
.
rain
/
10
)
+
(
Math
.
abs
(
info
.
current_temperature
-
15
)
/
10
)
);
if
(
client_love
==
"솔로"
)
{
info
.
death_prob
*=
1.24
;
}
//이벤트 기반으로 일정 시간 간격으로 클라이언트에게 보낼 정보
client_send
=
{
time
:
info
.
time
,
...
...
@@ -154,6 +159,7 @@ console.log(Current_Weather);
console
.
log
(
"SOCKET CONNECTED"
);
client_name
=
client_data
.
name
;
client_birth
=
client_data
.
birth
;
client_love
=
client_data
.
love
;
city
=
client_data
.
city
;
county
=
client_data
.
county
;
village
=
client_data
.
village
;
...
...
routes/index.js
View file @
bfc98f9
...
...
@@ -5,7 +5,7 @@ var db = require('../lib/db');
/* GET home page. */
router
.
post
(
'/starting'
,
(
req
,
res
)
=>
{
res
.
redirect
(
`/name/
${
req
.
body
.
name
}
/birth/
${
req
.
body
.
birth
}
/city/
${
req
.
body
.
city
}
/county/
${
req
.
body
.
county
}
/village/
${
req
.
body
.
village
}
`
);
res
.
redirect
(
`/name/
${
req
.
body
.
name
}
/birth/
${
req
.
body
.
birth
}
/
love/
${
req
.
body
.
love
}
/
city/
${
req
.
body
.
city
}
/county/
${
req
.
body
.
county
}
/village/
${
req
.
body
.
village
}
`
);
})
sql1
=
"TRUNCATE weatherInfo"
;
...
...
@@ -16,7 +16,7 @@ if(err)
}
});
router
.
get
(
'/name/:name/birth/:birth/city/:city/county/:county/village/:village'
,
(
req
,
res
)
=>
{
router
.
get
(
'/name/:name/birth/:birth/
love/:love/
city/:city/county/:county/village/:village'
,
(
req
,
res
)
=>
{
// 렌더링 변수
var
time
=
new
Array
();
// 타임스탬프
...
...
@@ -30,6 +30,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village'
var
count
=
0
;
const
name
=
req
.
params
.
name
;
const
birth
=
req
.
params
.
birth
;
const
love
=
req
.
params
.
love
;
const
city
=
req
.
params
.
city
;
const
county
=
req
.
params
.
county
;
const
village
=
req
.
params
.
village
;
...
...
@@ -75,6 +76,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village'
dataLen
,
name
,
birth
,
love
,
city
,
county
,
village
...
...
views/index - 복사본.ejs
View file @
bfc98f9
...
...
@@ -59,7 +59,8 @@
<script
type=
"text/javascript"
>
let
client_data
=
{
birth
:
"<%=birth%>"
,
name
:
"<%=name%>"
name
:
"<%=name%>"
,
love
:
"<%=love%>"
}
var
socket
=
io
.
connect
(
'/'
,
{
transports
:
[
'websocket'
],
upgrade
:
false
});
socket
.
emit
(
"connection"
,
client_data
);
...
...
@@ -624,4 +625,4 @@ plotOptions: {
</body>
</html>
-->
\ No newline at end of file
</html>
-->
...
...
views/index.ejs
View file @
bfc98f9
...
...
@@ -62,6 +62,7 @@
let
client_data
=
{
birth
:
"<%=birth%>"
,
name
:
"<%=name%>"
,
love
:
"<%=love%>"
,
city
:
"<%=city%>"
,
county
:
"<%=county%>"
,
village
:
"<%=village%>"
...
...
@@ -93,7 +94,7 @@
},
title
:
{
text
:
"<%=name%>님의 실시간 사망 확률 In <%=city%> <%=county%> <%=village%>"
,
text
:
"<%=
love%>인 <%=
name%>님의 실시간 사망 확률 In <%=city%> <%=county%> <%=village%>"
,
style
:
{
color
:
"#FFFFFF"
,
fontWeight
:
"bold"
,
...
...
views/main.ejs
View file @
bfc98f9
...
...
@@ -85,6 +85,10 @@
&
nbsp
&
nbsp
&
nbsp
&
nbsp
<label>
생년월일
</label>
<input
type=
"text"
name=
"birth"
class=
"form-control"
placeholder=
"971009"
style=
"width:200px;"
>
<label>
솔로/커플
</label>
<input
type=
"text"
name=
"love"
class=
"form-control"
placeholder=
"솔로"
style=
"width:200px;"
>
<br><br><br>
<label>
현재 장소(시, 도)
</label>
<input
type=
"text"
name=
"city"
class=
"form-control"
placeholder=
"서울"
style=
"width:200px;"
>
...
...
views/re.ejs
View file @
bfc98f9
...
...
@@ -62,6 +62,7 @@
let
client_data
=
{
birth
:
"<%=birth%>"
,
name
:
"<%=name%>"
,
love
:
"<%=love%>"
,
city
:
"<%=city%>"
,
county
:
"<%=county%>"
,
village
:
"<%=village%>"
...
...
Please
register
or
login
to post a comment