Showing
7 changed files
with
22 additions
and
7 deletions
... | @@ -20,8 +20,8 @@ app.use(express.urlencoded({ extended: false })); | ... | @@ -20,8 +20,8 @@ app.use(express.urlencoded({ extended: false })); |
20 | app.use(cookieParser()); | 20 | app.use(cookieParser()); |
21 | app.use('/',express.static(path.join(__dirname, 'public'))); | 21 | app.use('/',express.static(path.join(__dirname, 'public'))); |
22 | app.use('/',express.static(path.join(__dirname, 'code'))); | 22 | app.use('/',express.static(path.join(__dirname, 'code'))); |
23 | -app.use('/name/:name/birth/:birth/city/:city/county/:county/village/:village',express.static(path.join(__dirname, 'public'))); | 23 | +app.use('/name/:name/birth/:birth/love/:love/city/:city/county/:county/village/:village',express.static(path.join(__dirname, 'public'))); |
24 | -app.use('/name/:name/birth/:birth/city/:city/county/:county/village/:village',express.static(path.join(__dirname, 'code'))); | 24 | +app.use('/name/:name/birth/:birth/love/:love/city/:city/county/:county/village/:village',express.static(path.join(__dirname, 'code'))); |
25 | app.use('/', indexRouter); | 25 | app.use('/', indexRouter); |
26 | app.use('/users', usersRouter); | 26 | app.use('/users', usersRouter); |
27 | 27 | ... | ... |
... | @@ -18,6 +18,7 @@ module.exports = (server, app) => { | ... | @@ -18,6 +18,7 @@ module.exports = (server, app) => { |
18 | let client_send = {}; | 18 | let client_send = {}; |
19 | let client_name = ""; | 19 | let client_name = ""; |
20 | let client_birth ; | 20 | let client_birth ; |
21 | + let client_love = ""; | ||
21 | let Destiny; | 22 | let Destiny; |
22 | let sql; | 23 | let sql; |
23 | let city; | 24 | let city; |
... | @@ -95,6 +96,10 @@ console.log(Current_Weather); | ... | @@ -95,6 +96,10 @@ console.log(Current_Weather); |
95 | + info.windspd*1 + (info.rain / 10) + (Math.abs(info.current_temperature - 15) / 10) | 96 | + info.windspd*1 + (info.rain / 10) + (Math.abs(info.current_temperature - 15) / 10) |
96 | ); | 97 | ); |
97 | 98 | ||
99 | + if(client_love == "솔로") { | ||
100 | + info.death_prob *= 1.24; | ||
101 | + } | ||
102 | + | ||
98 | //이벤트 기반으로 일정 시간 간격으로 클라이언트에게 보낼 정보 | 103 | //이벤트 기반으로 일정 시간 간격으로 클라이언트에게 보낼 정보 |
99 | client_send = { | 104 | client_send = { |
100 | time: info.time, | 105 | time: info.time, |
... | @@ -154,6 +159,7 @@ console.log(Current_Weather); | ... | @@ -154,6 +159,7 @@ console.log(Current_Weather); |
154 | console.log("SOCKET CONNECTED"); | 159 | console.log("SOCKET CONNECTED"); |
155 | client_name = client_data.name; | 160 | client_name = client_data.name; |
156 | client_birth = client_data.birth; | 161 | client_birth = client_data.birth; |
162 | + client_love = client_data.love; | ||
157 | city = client_data.city; | 163 | city = client_data.city; |
158 | county = client_data.county; | 164 | county = client_data.county; |
159 | village = client_data.village; | 165 | village = client_data.village; | ... | ... |
... | @@ -5,7 +5,7 @@ var db = require('../lib/db'); | ... | @@ -5,7 +5,7 @@ var db = require('../lib/db'); |
5 | /* GET home page. */ | 5 | /* GET home page. */ |
6 | 6 | ||
7 | router.post('/starting' , (req,res) => { | 7 | router.post('/starting' , (req,res) => { |
8 | - res.redirect(`/name/${req.body.name}/birth/${req.body.birth}/city/${req.body.city}/county/${req.body.county}/village/${req.body.village}`); | 8 | + 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}`); |
9 | }) | 9 | }) |
10 | 10 | ||
11 | sql1 = "TRUNCATE weatherInfo"; | 11 | sql1 = "TRUNCATE weatherInfo"; |
... | @@ -16,7 +16,7 @@ if(err) | ... | @@ -16,7 +16,7 @@ if(err) |
16 | } | 16 | } |
17 | }); | 17 | }); |
18 | 18 | ||
19 | -router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village', (req,res) => { | 19 | +router.get('/name/:name/birth/:birth/love/:love/city/:city/county/:county/village/:village', (req,res) => { |
20 | 20 | ||
21 | // 렌더링 변수 | 21 | // 렌더링 변수 |
22 | var time = new Array(); // 타임스탬프 | 22 | var time = new Array(); // 타임스탬프 |
... | @@ -30,6 +30,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village' | ... | @@ -30,6 +30,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village' |
30 | var count = 0; | 30 | var count = 0; |
31 | const name = req.params.name; | 31 | const name = req.params.name; |
32 | const birth = req.params.birth; | 32 | const birth = req.params.birth; |
33 | + const love = req.params.love; | ||
33 | const city = req.params.city; | 34 | const city = req.params.city; |
34 | const county = req.params.county; | 35 | const county = req.params.county; |
35 | const village = req.params.village; | 36 | const village = req.params.village; |
... | @@ -75,6 +76,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village' | ... | @@ -75,6 +76,7 @@ router.get('/name/:name/birth/:birth/city/:city/county/:county/village/:village' |
75 | dataLen, | 76 | dataLen, |
76 | name, | 77 | name, |
77 | birth, | 78 | birth, |
79 | + love, | ||
78 | city, | 80 | city, |
79 | county, | 81 | county, |
80 | village | 82 | village | ... | ... |
... | @@ -59,7 +59,8 @@ | ... | @@ -59,7 +59,8 @@ |
59 | <script type="text/javascript"> | 59 | <script type="text/javascript"> |
60 | let client_data = { | 60 | let client_data = { |
61 | birth: "<%=birth%>", | 61 | birth: "<%=birth%>", |
62 | - name: "<%=name%>" | 62 | + name: "<%=name%>", |
63 | + love: "<%=love%>" | ||
63 | } | 64 | } |
64 | var socket = io.connect('/', { transports: ['websocket'], upgrade: false }); | 65 | var socket = io.connect('/', { transports: ['websocket'], upgrade: false }); |
65 | socket.emit("connection", client_data); | 66 | socket.emit("connection", client_data); |
... | @@ -624,4 +625,4 @@ plotOptions: { | ... | @@ -624,4 +625,4 @@ plotOptions: { |
624 | 625 | ||
625 | </body> | 626 | </body> |
626 | 627 | ||
627 | -</html> --> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
628 | +</html> --> | ... | ... |
... | @@ -62,6 +62,7 @@ | ... | @@ -62,6 +62,7 @@ |
62 | let client_data = { | 62 | let client_data = { |
63 | birth: "<%=birth%>", | 63 | birth: "<%=birth%>", |
64 | name: "<%=name%>", | 64 | name: "<%=name%>", |
65 | + love: "<%=love%>", | ||
65 | city: "<%=city%>", | 66 | city: "<%=city%>", |
66 | county: "<%=county%>", | 67 | county: "<%=county%>", |
67 | village: "<%=village%>" | 68 | village: "<%=village%>" |
... | @@ -93,7 +94,7 @@ | ... | @@ -93,7 +94,7 @@ |
93 | }, | 94 | }, |
94 | 95 | ||
95 | title: { | 96 | title: { |
96 | - text: "<%=name%>님의 실시간 사망 확률 In <%=city%> <%=county%> <%=village%>", | 97 | + text: "<%=love%>인 <%=name%>님의 실시간 사망 확률 In <%=city%> <%=county%> <%=village%>", |
97 | style: { | 98 | style: { |
98 | color: "#FFFFFF", | 99 | color: "#FFFFFF", |
99 | fontWeight: "bold", | 100 | fontWeight: "bold", | ... | ... |
... | @@ -85,6 +85,10 @@ | ... | @@ -85,6 +85,10 @@ |
85 |       | 85 |       |
86 | <label>생년월일</label> | 86 | <label>생년월일</label> |
87 | <input type="text" name="birth" class="form-control" placeholder="971009" style="width:200px;"> | 87 | <input type="text" name="birth" class="form-control" placeholder="971009" style="width:200px;"> |
88 | + | ||
89 | + <label>솔로/커플</label> | ||
90 | + <input type="text" name="love" class="form-control" placeholder="솔로" style="width:200px;"> | ||
91 | + | ||
88 | <br><br><br> | 92 | <br><br><br> |
89 | <label>현재 장소(시, 도)</label> | 93 | <label>현재 장소(시, 도)</label> |
90 | <input type="text" name="city" class="form-control" placeholder="서울" style="width:200px;"> | 94 | <input type="text" name="city" class="form-control" placeholder="서울" style="width:200px;"> | ... | ... |
... | @@ -62,6 +62,7 @@ | ... | @@ -62,6 +62,7 @@ |
62 | let client_data = { | 62 | let client_data = { |
63 | birth: "<%=birth%>", | 63 | birth: "<%=birth%>", |
64 | name: "<%=name%>", | 64 | name: "<%=name%>", |
65 | + love: "<%=love%>", | ||
65 | city: "<%=city%>", | 66 | city: "<%=city%>", |
66 | county: "<%=county%>", | 67 | county: "<%=county%>", |
67 | village: "<%=village%>" | 68 | village: "<%=village%>" | ... | ... |
-
Please register or login to post a comment