Ubuntu

add client love state and add probability 1.24

......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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> -->
......
......@@ -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",
......
......@@ -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;">
......
......@@ -62,6 +62,7 @@
let client_data = {
birth: "<%=birth%>",
name: "<%=name%>",
love: "<%=love%>",
city: "<%=city%>",
county: "<%=county%>",
village: "<%=village%>"
......