Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit c2cb269

Browse files
authored
Merge pull request #20 from archan0621/stage
9월 1주차 스프린트 main 머지
2 parents 01d59f7 + 60dd6ac commit c2cb269

12 files changed

+114
-30
lines changed

admin_control/add_match_player.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
}
1919

2020
if ($responseData['result'] == 'fail') {
21-
echo "<script>alert('".$responseData['message']."');</script>";
22-
header("Location: ../admin_view/match");
21+
echo "<script>alert('".$responseData['message']."');;history.back();</script>";
2322
} elseif ($responseData['result'] == 'success') {
2423
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2524
}

admin_control/match_create.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@
4141
$_SESSION['token']);
4242
}
4343

44-
if ($responseData['result'] == 'fail') {
45-
echo "<script>alert('".$responseData['message']."');</script>";
46-
header("Location: ../admin_view/match");
44+
if ($responseData['result'] == 'fail') {
45+
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
4746
} elseif ($responseData['result'] == 'success') {
48-
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
47+
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
4948
}
5049
}
5150
?>

admin_control/match_delete.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
$_SESSION['token']);
1515

1616
if ($responseData['result'] == 'fail') {
17-
echo "<script>alert('".$responseData['message']."');</script>";
18-
header("Location: ../admin_view/match");
17+
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
1918
} elseif ($responseData['result'] == 'success') {
2019
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
2120
}

admin_control/match_update.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
}
4747

4848
if ($responseData['result'] == 'fail') {
49-
echo "<script>alert('".$responseData['message']."');</script>";
50-
header("Location: ../admin_view/match");
49+
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
5150
} elseif ($responseData['result'] == 'success') {
52-
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
51+
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match_detail?event_id=$id';</script>";
5352
}
5453
}
5554

admin_control/minus_match_player.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
}
1919

2020
if ($responseData['result'] == 'fail') {
21-
echo "<script>alert('".$responseData['message']."');</script>";
22-
header("Location: ../admin_view/match");
21+
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2322
} elseif ($responseData['result'] == 'success') {
2423
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2524
}

admin_view/match_detail.php

+36-3
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,11 @@ function html_body() {
9797
<div class="match_address_wrap">
9898
<div class="match_address">
9999
<div class="icon"><i class="fa-solid fa-map-pin"></i></div>
100-
<div class="match_address_txt"><?=$event_info['event_dto_location']?></div>
100+
<div id="match_address_txt" class="match_address_txt"><?=$event_info['event_dto_location']?></div>
101101
</div>
102102
</div>
103103
<div class="match_map_wrap">
104-
<div class="match_map">
105-
</div>
104+
<div id="map" class="match_map"></div>
106105
</div>
107106
</div>
108107
</div>
@@ -244,6 +243,40 @@ function match_change() {
244243
lity('#match_change_lity');
245244
$('.match_change_lity').parent().parent().addClass('match_change_lity_wrap');
246245
}
246+
function matchLocation() {
247+
var address = document.getElementById('match_address_txt').textContent;
248+
var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);
249+
var map = new naver.maps.Map('map', {
250+
center: centerCoord,
251+
zoom: 15
252+
});
253+
254+
naver.maps.Service.geocode({
255+
address: address
256+
}, function(status, response) {
257+
if (status === naver.maps.Service.Status.OK) {
258+
var result = response.result;
259+
var firstItem = result.items[0];
260+
var coords = new naver.maps.LatLng(firstItem.point.y, firstItem.point.x);
261+
262+
map.setCenter(coords);
263+
264+
var marker = new naver.maps.Marker({
265+
position: coords,
266+
map: map
267+
});
268+
269+
naver.maps.Event.addListener(marker, 'click', function() {
270+
var naverMapURL = 'https://map.naver.com/?dlevel=11&lat=' + coords._lat + '&lng=' + coords._lng;
271+
window.open(naverMapURL, '_blank');
272+
});
273+
} else {
274+
alert('주소를 찾을 수 없습니다.');
275+
}
276+
});
277+
}
278+
window.onload = matchLocation;
279+
naver.maps.onJSContentLoaded = matchLocation;
247280
</script>
248281
<?php
249282
}

config/config.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
$real_api = "https://sellstory.kro.kr:30621/";
33
$test_api = "https://sellstory.kro.kr:30622/";
4-
$my_host = $_SERVER['HTTP_HOST'];
54
$my_api = "";
5+
$real_mode = false;
66

7-
if ($my_host == 'seulchuksaeng.com') {
7+
if ($real_mode) {
88
$my_api = $real_api;
99
} else {
1010
$my_api = $test_api;

model/JwtApiCall.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ function JwtApiCall($url, $httpMethod, $param, $access_token) {
2828

2929
if ($responseData['result'] == 'fail' && $responseData['message'] == '만료된 토큰으로 JWT 요청시도') {
3030
echo "<script>alert('세션이 만료되었습니다. 다시 로그인해주세요.');location.href='../view_control/signout';</script>";
31-
} elseif ($responseData['result'] == 'fail') {
32-
echo "<script>alert('".$responseData['message']."');history.back();</script>";
33-
return $responseData;
34-
} elseif ($responseData['result'] == 'success') {
31+
} elseif ($responseData['result'] == 'fail' || $responseData['result'] == 'success') {
3532
return $responseData;
3633
} else {
3734
echo "<script>alert('서버와 연결이 불안정합니다.');location.href='../view_control/signout';</script>";

style/admin.css

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
}
8888
.match_create_wrap input {
8989
-webkit-appearance: none;
90+
appearance: none;
9091
width: 100%;
9192
box-sizing: border-box;
9293
border-radius: 8px;
@@ -158,4 +159,7 @@
158159
border: 1px solid #000;
159160
border-radius: 6px;
160161
padding: 4px 12px;
162+
}
163+
.expenses_ok_btn:not(:first-child) {
164+
margin-top: 6px;
161165
}

tpl/body_tpl.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<script src="https://kit.fontawesome.com/c73bb93925.js" crossorigin="anonymous"></script>
2424
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
2525
<script src="https://cdnjs.cloudflare.com/ajax/libs/lity/2.4.1/lity.min.js"></script>
26+
<script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=oekl5d5mdq&submodules=geocoder"></script>
2627
</head>
2728
<body>
2829
<?=html_body();?>

view/match.php

+54-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function get_event_location() {
152152
</div>
153153
<div class="member_check_wrap">
154154
<div class="member_check">
155-
<a href="../view_control/attendance_check?eventId=<?=$event_dto_id?>&memberId=<?=$_SESSION['member_id']?>" class="attendance_check">
155+
<a href="javascript:;" onclick="attendance_check()" class="attendance_check">
156156
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
157157
<div class="attendance_check_txt"><p>출석 확인</p></div>
158158
</a>
@@ -175,7 +175,7 @@ public function get_event_location() {
175175
<div class="match_address_wrap">
176176
<div class="match_address">
177177
<div class="icon"><i class="fa-solid fa-map-pin"></i></div>
178-
<div class="match_address_txt"><?=$event_dto_location?></div>
178+
<div id="match_address_txt" class="match_address_txt"><?=$event_dto_location?></div>
179179
</div>
180180
</div>
181181
<div class="match_map_wrap">
@@ -206,6 +206,58 @@ public function get_event_location() {
206206
function player_check_lity() {
207207
lity('#player_check_lity');
208208
}
209+
function attendance_check() {
210+
if ("geolocation" in navigator) {
211+
navigator.geolocation.getCurrentPosition(function(position) {
212+
var latitude = position.coords.latitude; // 위도
213+
var longitude = position.coords.longitude; // 경도
214+
$.ajax({
215+
url: '../view_control/attendance_check',
216+
method: 'POST',
217+
data: { eventId: <?=$event_dto_id?>, latitude: latitude, longitude: longitude },
218+
success: function(response) {
219+
alert(response);
220+
}
221+
});
222+
});
223+
} else {
224+
alert("위치정보를 지원하지 않는 브라우저입니다.");
225+
}
226+
}
227+
function matchLocation() {
228+
var address = document.getElementById('match_address_txt').textContent;
229+
var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);
230+
var map = new naver.maps.Map('map', {
231+
center: centerCoord,
232+
zoom: 15
233+
});
234+
235+
naver.maps.Service.geocode({
236+
address: address
237+
}, function(status, response) {
238+
if (status === naver.maps.Service.Status.OK) {
239+
var result = response.result;
240+
var firstItem = result.items[0];
241+
var coords = new naver.maps.LatLng(firstItem.point.y, firstItem.point.x);
242+
243+
map.setCenter(coords);
244+
245+
var marker = new naver.maps.Marker({
246+
position: coords,
247+
map: map
248+
});
249+
250+
naver.maps.Event.addListener(marker, 'click', function() {
251+
var naverMapURL = 'https://map.naver.com/?dlevel=11&lat=' + coords._lat + '&lng=' + coords._lng;
252+
window.open(naverMapURL, '_blank');
253+
});
254+
} else {
255+
alert('주소를 찾을 수 없습니다.');
256+
}
257+
});
258+
}
259+
window.onload = matchLocation;
260+
naver.maps.onJSContentLoaded = matchLocation;
209261
</script>
210262
<?php
211263
}

view_control/attendance_check.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
44
global $my_api;
55

6-
$eventId = $_GET['eventId'];
7-
$memberId = $_GET['memberId'];
6+
$eventId = $_POST['eventId'];
7+
$latitude = $_POST['latitude'];
8+
$longitude = $_POST['longitude'];
89

9-
if (isset($eventId) && isset($memberId)) {
10+
if (isset($eventId) && isset($latitude) && isset($longitude)) {
1011
$responseData = JwtApiCall($my_api."event/memberAttend",
1112
"POST",
1213
array(
1314
"eventId" => $eventId,
14-
"memberId" => $memberId
15+
"lat" => $latitude,
16+
"lng" => $longitude,
1517
),
1618
$_SESSION['token']);
1719

1820
if ($responseData['result'] == 'fail') {
19-
echo "<script>alert('".$responseData['message']."');history.back();</script>";
21+
echo $responseData['message'];
2022
} elseif ($responseData['result'] == 'success') {
21-
echo "<script>alert('".$responseData['message']."');history.back();</script>";
23+
echo $responseData['message'];
2224
}
2325
}
2426

0 commit comments

Comments
 (0)