Add: admin - maestro all list page
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-85912788-2"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-85912788-2');
|
||||
</script>
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-N8PB4F3');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
|
||||
<title>마우스 타자 관리자 페이지</title>
|
||||
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
|
||||
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
|
||||
<script type="text/javascript" src="./../js/main.js"></script>
|
||||
<script type="text/javascript" src="./../js/request_server.js"></script>
|
||||
<script type="text/javascript" src="./../../game/lib/util/number_util.js"></script>
|
||||
<script type="text/javascript" src="./../js/lib/account_info.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#search_name").keydown(function(key) {
|
||||
if(key.keyCode == 13) {
|
||||
searchMaestro();
|
||||
}
|
||||
});
|
||||
|
||||
$("#header").load("admin_header.html");
|
||||
|
||||
loadMaestroList("");
|
||||
});
|
||||
|
||||
function searchMaestro() {
|
||||
var maestroName = $("#search_name").val();
|
||||
console.log("searchMaestro : " + maestroName);
|
||||
|
||||
if(maestroName.length === 0) {
|
||||
showErrorMessage("검색할 마에스트로 아이디를 입력하세요.", "error");
|
||||
$("#search_name").focus();
|
||||
}
|
||||
|
||||
loadMaestroList(maestroName);
|
||||
}
|
||||
|
||||
function loadMaestroList(maestroName) {
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/admin/maestro_all_list.php",
|
||||
"maestro_name=" + maestroName,
|
||||
|
||||
function(jsonData) {
|
||||
updateMaestroList(jsonData["maestroList"]);
|
||||
},
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessag, "error");
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
function updateMaestroList(jsonList) {
|
||||
$("#maestro_list_result_contents").empty();
|
||||
printContents(jsonList);
|
||||
}
|
||||
|
||||
function printContents(jsonList) {
|
||||
if(jsonList === undefined || jsonList.length === 0) {
|
||||
$("#maestro_list_result_contents").append(
|
||||
"<div class='alert alert-danger text-center' role='alert'>"
|
||||
+ "마에스트로 계정 정보가 없습니다."
|
||||
+ "</div>"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
for(var i = 0; i < jsonList.length; i++) {
|
||||
var maestroInfo = jsonList[i];
|
||||
var status = accountStatus(jsonList[i].accountType, jsonList[i].activateStatus);
|
||||
var statusBgColor = accountStatusColorClass(status);
|
||||
var type = accountType(jsonList[i].accountType);
|
||||
var registerDate = jsonList[i].acceptClausesDateTime.substring(0, 10);
|
||||
|
||||
$("#maestro_list_result_contents").append(
|
||||
"<div class='form-group player-list row mx-2 mb-1'>"
|
||||
+ " <input type='text' class='maestro_id d-none' value='" + jsonList[i].maestroID + "'>"
|
||||
+ " <input type='text' class='col-sm-1" + statusBgColor + "' value='" + status + "'>"
|
||||
+ " <input type='text' class='col-sm' value='" + jsonList[i].maestroName + "'>"
|
||||
+ " <input type='text' class='col-sm' value='" + type + "'>"
|
||||
+ " <input type='text' class='col-sm' value='" + registerDate + "'>"
|
||||
+ " <input type='text' class='col-sm-1' value='" + jsonList[i].playerCount + "'>"
|
||||
+ " <input type='button' class='col-sm-1' value='-' onClick=';''>"
|
||||
+ "</div>"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function register(inputButton) {
|
||||
// var id = $(inputButton).siblings(".maestro_id d-none");
|
||||
// var maestroID = id.text();
|
||||
|
||||
var children = inputButton.parentElement.childNodes;
|
||||
var maestroID = "";
|
||||
for (var i=0; i < children.length; i++) {
|
||||
// console.log(children);
|
||||
if (children[i].className == "maestro_id d-none") {
|
||||
maestroID = children[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// console.log(maestroID);
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/admin/register_maestro.php",
|
||||
"maestro_id=" + maestroID,
|
||||
|
||||
function(jsonData) {
|
||||
showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
|
||||
loadMaestroList("");
|
||||
},
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<header id="header"></header>
|
||||
|
||||
<div class="container mt-3">
|
||||
<div class="row mx-1">
|
||||
<h3 class="my-3">마에스트로 전체 목록</h3>
|
||||
</div>
|
||||
|
||||
<div id="message_box"></div>
|
||||
|
||||
<div class="row mx-1">
|
||||
<div class="col">
|
||||
<h5 class="my-3">마에스트로 검색</h5>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary" onClick="searchMaestro()">검색 실행</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mx-1">
|
||||
<div class="col border border-warning rounded" style="background-color: #ffeab6">
|
||||
<h5 class="my-3">검색 결과</h5>
|
||||
|
||||
<form id="search_player_list">
|
||||
<div class="form-group row mx-2 mb-0 font-weight-bold">
|
||||
<label class="col-form-label col-sm-1 text-center">타입</label>
|
||||
<label class="col-form-label d-none">ID</label>
|
||||
<label class="col-form-label col-sm text-center">마에스트로 아이디</label>
|
||||
<label class="col-form-label col-sm text-center">계정 타입</label>
|
||||
<label class="col-form-label col-sm text-center">등록 날짜</label>
|
||||
<label class="col-form-label col-sm-1 text-center">학생수</label>
|
||||
<label class="col-form-label col-sm-1 text-center">비활성화</label>
|
||||
</div>
|
||||
<div id="maestro_list_result_contents"></div>
|
||||
</form>
|
||||
</div> <!-- 학생 목록 -->
|
||||
</div>
|
||||
|
||||
</div> <!-- container -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -35,6 +35,7 @@
|
||||
</div>
|
||||
|
||||
<div class="eyebrow ml-auto mt-0 d-md-flex align-items-center">
|
||||
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_all_list.html">전체 목록</a>
|
||||
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_register_list.html">등록 목록</a>
|
||||
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_upgrade_list.html">업그레이드 목록</a>
|
||||
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_expiration_list.html">계정 만료 목록</a>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"admin_name=" + name + "&password=" + password,
|
||||
|
||||
function(jsonData) {
|
||||
location.href = 'admin_register_list.html';
|
||||
location.href = 'admin_all_list.html';
|
||||
},
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
function accoutType(accountType) {
|
||||
function accountType(accountType) {
|
||||
switch(accountType) {
|
||||
case 1:
|
||||
return "20명 (1만원)";
|
||||
@@ -40,6 +40,58 @@ function accoutType(accountType) {
|
||||
return accountType + "? (N/A)";
|
||||
}
|
||||
|
||||
function accountStatus(accountType, activateStatus) {
|
||||
if(activateStatus == 0)
|
||||
return "입금대기";
|
||||
else if(activateStatus == 100)
|
||||
return "취소";
|
||||
|
||||
switch(accountType) {
|
||||
case 1:
|
||||
return "20명";
|
||||
|
||||
case 2:
|
||||
return "50명";
|
||||
|
||||
case 3:
|
||||
return "100명";
|
||||
|
||||
case 4:
|
||||
return "500명";
|
||||
|
||||
case 5:
|
||||
return "1,000명";
|
||||
|
||||
case 100:
|
||||
return "학생체험";
|
||||
|
||||
case 101:
|
||||
return "마에체험";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function accountStatusColorClass(status) {
|
||||
switch(status) {
|
||||
case "비활성화":
|
||||
return " text-muted";
|
||||
|
||||
case "취소":
|
||||
return " text-white bg-danger";
|
||||
|
||||
case "입금대기":
|
||||
return " bg-warning";
|
||||
|
||||
case "학생체험":
|
||||
case "마에체험":
|
||||
return " text-success";
|
||||
|
||||
default:
|
||||
return " text-primary";
|
||||
}
|
||||
}
|
||||
|
||||
function accountTypePrice(accountType) {
|
||||
switch(accountType) {
|
||||
case 1:
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroName = $_POST["maestro_name"];
|
||||
|
||||
|
||||
$maestroList = null;
|
||||
if(strlen($maestroName) === 0)
|
||||
$maestroList = get_maestro_list();
|
||||
else
|
||||
$maestroList = get_maestro_list_by_name($maestroName);
|
||||
|
||||
if(strlen($maestroList) === 0) {
|
||||
set_error_message("오늘의 랭킹 기록 없음");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
set_data("maestroList", $maestroList);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function get_maestro_list() {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT MaestroID, Name, AccountType, ActivateStatus, AcceptClausesDateTime, PlayerCount
|
||||
FROM maestro
|
||||
ORDER BY MaestroID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
// $stmt->bind_param("ii", $maestroName, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID, $name, $accountType, $activateStatus, $acceptClausesDateTime, $playerCount);
|
||||
|
||||
$maestroList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro["maestroID"] = $maestroID;
|
||||
$maestro["maestroName"] = $name;
|
||||
$maestro["accountType"] = $accountType;
|
||||
$maestro["activateStatus"] = $activateStatus;
|
||||
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
|
||||
$maestro["playerCount"] = $playerCount;
|
||||
array_push($maestroList, $maestro);
|
||||
}
|
||||
|
||||
return $maestroList;
|
||||
}
|
||||
|
||||
function get_maestro_list_by_name($maestroName) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT MaestroID, Name, AccountType, ActivateStatus, AcceptClausesDateTime, PlayerCount
|
||||
FROM maestro
|
||||
WHERE Name LIKE CONCAT('%', ?, '%')
|
||||
ORDER BY MaestroID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param("s", $maestroName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID, $name, $accountType, $activateStatus, $acceptClausesDateTime, $playerCount);
|
||||
|
||||
$maestroList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro["maestroID"] = $maestroID;
|
||||
$maestro["maestroName"] = $name;
|
||||
$maestro["accountType"] = $accountType;
|
||||
$maestro["activateStatus"] = $activateStatus;
|
||||
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
|
||||
$maestro["playerCount"] = $playerCount;
|
||||
array_push($maestroList, $maestro);
|
||||
}
|
||||
|
||||
return $maestroList;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user