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

Commit

Permalink
Merge pull request #20 from archan0621/stage
Browse files Browse the repository at this point in the history
9월 1주차 스프린트 main 머지
  • Loading branch information
archan0621 authored Sep 13, 2023
2 parents 01d59f7 + 60dd6ac commit c2cb269
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 30 deletions.
3 changes: 1 addition & 2 deletions admin_control/add_match_player.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
}

if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');</script>";
header("Location: ../admin_view/match");
echo "<script>alert('".$responseData['message']."');;history.back();</script>";
} elseif ($responseData['result'] == 'success') {
echo "<script>alert('".$responseData['message']."');history.back();</script>";
}
Expand Down
7 changes: 3 additions & 4 deletions admin_control/match_create.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@
$_SESSION['token']);
}

if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');</script>";
header("Location: ../admin_view/match");
if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
} elseif ($responseData['result'] == 'success') {
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
}
}
?>
3 changes: 1 addition & 2 deletions admin_control/match_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
$_SESSION['token']);

if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');</script>";
header("Location: ../admin_view/match");
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
} elseif ($responseData['result'] == 'success') {
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
}
Expand Down
5 changes: 2 additions & 3 deletions admin_control/match_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
}

if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');</script>";
header("Location: ../admin_view/match");
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
} elseif ($responseData['result'] == 'success') {
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match_detail?event_id=$id';</script>";
}
}

Expand Down
3 changes: 1 addition & 2 deletions admin_control/minus_match_player.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
}

if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');</script>";
header("Location: ../admin_view/match");
echo "<script>alert('".$responseData['message']."');history.back();</script>";
} elseif ($responseData['result'] == 'success') {
echo "<script>alert('".$responseData['message']."');history.back();</script>";
}
Expand Down
39 changes: 36 additions & 3 deletions admin_view/match_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,11 @@ function html_body() {
<div class="match_address_wrap">
<div class="match_address">
<div class="icon"><i class="fa-solid fa-map-pin"></i></div>
<div class="match_address_txt"><?=$event_info['event_dto_location']?></div>
<div id="match_address_txt" class="match_address_txt"><?=$event_info['event_dto_location']?></div>
</div>
</div>
<div class="match_map_wrap">
<div class="match_map">
</div>
<div id="map" class="match_map"></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -244,6 +243,40 @@ function match_change() {
lity('#match_change_lity');
$('.match_change_lity').parent().parent().addClass('match_change_lity_wrap');
}
function matchLocation() {
var address = document.getElementById('match_address_txt').textContent;
var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);
var map = new naver.maps.Map('map', {
center: centerCoord,
zoom: 15
});

naver.maps.Service.geocode({
address: address
}, function(status, response) {
if (status === naver.maps.Service.Status.OK) {
var result = response.result;
var firstItem = result.items[0];
var coords = new naver.maps.LatLng(firstItem.point.y, firstItem.point.x);

map.setCenter(coords);

var marker = new naver.maps.Marker({
position: coords,
map: map
});

naver.maps.Event.addListener(marker, 'click', function() {
var naverMapURL = 'https://map.naver.com/?dlevel=11&lat=' + coords._lat + '&lng=' + coords._lng;
window.open(naverMapURL, '_blank');
});
} else {
alert('주소를 찾을 수 없습니다.');
}
});
}
window.onload = matchLocation;
naver.maps.onJSContentLoaded = matchLocation;
</script>
<?php
}
Expand Down
4 changes: 2 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
$real_api = "https://sellstory.kro.kr:30621/";
$test_api = "https://sellstory.kro.kr:30622/";
$my_host = $_SERVER['HTTP_HOST'];
$my_api = "";
$real_mode = false;

if ($my_host == 'seulchuksaeng.com') {
if ($real_mode) {
$my_api = $real_api;
} else {
$my_api = $test_api;
Expand Down
5 changes: 1 addition & 4 deletions model/JwtApiCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ function JwtApiCall($url, $httpMethod, $param, $access_token) {

if ($responseData['result'] == 'fail' && $responseData['message'] == '만료된 토큰으로 JWT 요청시도') {
echo "<script>alert('세션이 만료되었습니다. 다시 로그인해주세요.');location.href='../view_control/signout';</script>";
} elseif ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');history.back();</script>";
return $responseData;
} elseif ($responseData['result'] == 'success') {
} elseif ($responseData['result'] == 'fail' || $responseData['result'] == 'success') {
return $responseData;
} else {
echo "<script>alert('서버와 연결이 불안정합니다.');location.href='../view_control/signout';</script>";
Expand Down
4 changes: 4 additions & 0 deletions style/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
}
.match_create_wrap input {
-webkit-appearance: none;
appearance: none;
width: 100%;
box-sizing: border-box;
border-radius: 8px;
Expand Down Expand Up @@ -158,4 +159,7 @@
border: 1px solid #000;
border-radius: 6px;
padding: 4px 12px;
}
.expenses_ok_btn:not(:first-child) {
margin-top: 6px;
}
1 change: 1 addition & 0 deletions tpl/body_tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<script src="https://kit.fontawesome.com/c73bb93925.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lity/2.4.1/lity.min.js"></script>
<script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=oekl5d5mdq&submodules=geocoder"></script>
</head>
<body>
<?=html_body();?>
Expand Down
56 changes: 54 additions & 2 deletions view/match.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function get_event_location() {
</div>
<div class="member_check_wrap">
<div class="member_check">
<a href="../view_control/attendance_check?eventId=<?=$event_dto_id?>&memberId=<?=$_SESSION['member_id']?>" class="attendance_check">
<a href="javascript:;" onclick="attendance_check()" class="attendance_check">
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
<div class="attendance_check_txt"><p>출석 확인</p></div>
</a>
Expand All @@ -175,7 +175,7 @@ public function get_event_location() {
<div class="match_address_wrap">
<div class="match_address">
<div class="icon"><i class="fa-solid fa-map-pin"></i></div>
<div class="match_address_txt"><?=$event_dto_location?></div>
<div id="match_address_txt" class="match_address_txt"><?=$event_dto_location?></div>
</div>
</div>
<div class="match_map_wrap">
Expand Down Expand Up @@ -206,6 +206,58 @@ public function get_event_location() {
function player_check_lity() {
lity('#player_check_lity');
}
function attendance_check() {
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude; // 위도
var longitude = position.coords.longitude; // 경도
$.ajax({
url: '../view_control/attendance_check',
method: 'POST',
data: { eventId: <?=$event_dto_id?>, latitude: latitude, longitude: longitude },
success: function(response) {
alert(response);
}
});
});
} else {
alert("위치정보를 지원하지 않는 브라우저입니다.");
}
}
function matchLocation() {
var address = document.getElementById('match_address_txt').textContent;
var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);
var map = new naver.maps.Map('map', {
center: centerCoord,
zoom: 15
});

naver.maps.Service.geocode({
address: address
}, function(status, response) {
if (status === naver.maps.Service.Status.OK) {
var result = response.result;
var firstItem = result.items[0];
var coords = new naver.maps.LatLng(firstItem.point.y, firstItem.point.x);

map.setCenter(coords);

var marker = new naver.maps.Marker({
position: coords,
map: map
});

naver.maps.Event.addListener(marker, 'click', function() {
var naverMapURL = 'https://map.naver.com/?dlevel=11&lat=' + coords._lat + '&lng=' + coords._lng;
window.open(naverMapURL, '_blank');
});
} else {
alert('주소를 찾을 수 없습니다.');
}
});
}
window.onload = matchLocation;
naver.maps.onJSContentLoaded = matchLocation;
</script>
<?php
}
Expand Down
14 changes: 8 additions & 6 deletions view_control/attendance_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

$eventId = $_GET['eventId'];
$memberId = $_GET['memberId'];
$eventId = $_POST['eventId'];
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];

if (isset($eventId) && isset($memberId)) {
if (isset($eventId) && isset($latitude) && isset($longitude)) {
$responseData = JwtApiCall($my_api."event/memberAttend",
"POST",
array(
"eventId" => $eventId,
"memberId" => $memberId
"lat" => $latitude,
"lng" => $longitude,
),
$_SESSION['token']);

if ($responseData['result'] == 'fail') {
echo "<script>alert('".$responseData['message']."');history.back();</script>";
echo $responseData['message'];
} elseif ($responseData['result'] == 'success') {
echo "<script>alert('".$responseData['message']."');history.back();</script>";
echo $responseData['message'];
}
}

Expand Down

0 comments on commit c2cb269

Please sign in to comment.