Add: show availableActivateDateTime of maestro
This commit is contained in:
@@ -2,6 +2,7 @@ function MaestroInfo() {
|
|||||||
this.maestroID = sessionStorage.getItem("maestroID");
|
this.maestroID = sessionStorage.getItem("maestroID");
|
||||||
this.maestroName = "";
|
this.maestroName = "";
|
||||||
this.accountType = 0;
|
this.accountType = 0;
|
||||||
|
this.availableActivateDateTime = "";
|
||||||
this.playerCount = 0;
|
this.playerCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ MaestroInfo.prototype.loadMaestroInfo = function(onSuccess, onFail) {
|
|||||||
function(jsonData) {
|
function(jsonData) {
|
||||||
self.maestroName = jsonData["name"];
|
self.maestroName = jsonData["name"];
|
||||||
self.accountType = jsonData["accountType"];
|
self.accountType = jsonData["accountType"];
|
||||||
|
self.availableActivateDateTime = jsonData["availableActivateDateTime"];
|
||||||
self.playerCount = jsonData["playerCount"];
|
self.playerCount = jsonData["playerCount"];
|
||||||
|
|
||||||
onSuccess();
|
onSuccess();
|
||||||
|
|||||||
@@ -22,9 +22,26 @@ function isExperienceMaestroAccount() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showEndDate(date) {
|
||||||
|
var endDateArray = date.split(" ");
|
||||||
|
var endDate = endDateArray[0]; // "YY-MM_DD"
|
||||||
|
|
||||||
|
var today = new Date();
|
||||||
|
var endDay = new Date(endDate);
|
||||||
|
var diffDay = (endDay.getTime() - today.getTime()) / (1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
|
$("#maestro_count_down_date").html("~ " + endDate + "<br/>유효 기간 : " + Math.ceil(diffDay) + "일");
|
||||||
|
if(diffDay < 30)
|
||||||
|
$("#maestro_count_down_date").addClass("text-danger");
|
||||||
|
else if(diffDay < 10)
|
||||||
|
$("#maestro_count_down_date").addClass("bg-danger text-light");
|
||||||
|
else if(diffDay < 0)
|
||||||
|
$("#maestro_count_down_date").addClass("bg-secondary text-light");
|
||||||
|
}
|
||||||
|
|
||||||
function onLoadSuccessMaestroInfo() {
|
function onLoadSuccessMaestroInfo() {
|
||||||
$("#maestro_info_id").text(maestroInfo.maestroName + "님, 환영합니다.");
|
$("#maestro_info_id").text("[ " + maestroInfo.maestroName + " ] 님, 환영합니다.");
|
||||||
|
showEndDate(maestroInfo.availableActivateDateTime);
|
||||||
$("#maestro_info_player_count").val("학생수 : " + maestroInfo.getRegisteredPlayerCount() + " / " + maestroInfo.getMaxPlayerCount());
|
$("#maestro_info_player_count").val("학생수 : " + maestroInfo.getRegisteredPlayerCount() + " / " + maestroInfo.getMaxPlayerCount());
|
||||||
|
|
||||||
if(maestroInfo.getRegisteredPlayerCount() === maestroInfo.getMaxPlayerCount()) {
|
if(maestroInfo.getRegisteredPlayerCount() === maestroInfo.getMaxPlayerCount()) {
|
||||||
@@ -120,8 +137,9 @@ function deactivateApp(appID) {
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row border border-primary rounded py-2 mx-1 my-2">
|
<div class="row border border-primary rounded py-2 mx-1 my-2">
|
||||||
<div id="maestro_info_id" class="col my-auto"></div>
|
<div id="maestro_info_id" class="col-sm my-auto"></div>
|
||||||
<div id="maestro_url" class="col my-auto"></div>
|
<!-- <div id="maestro_url" class="col my-auto"></div> -->
|
||||||
|
<div id="maestro_count_down_date" class="col-sm-2 my-auto mx-1 text-center"></div>
|
||||||
|
|
||||||
<div class="eyebrow ml-auto mt-0 d-md-flex align-items-center">
|
<div class="eyebrow ml-auto mt-0 d-md-flex align-items-center">
|
||||||
<div class="input-group my-auto">
|
<div class="input-group my-auto">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ $playerCount = getPlayerCount($maestroID);
|
|||||||
set_data("name", $info["name"]);
|
set_data("name", $info["name"]);
|
||||||
set_data("email", $info["email"]);
|
set_data("email", $info["email"]);
|
||||||
set_data("accountType", $info["accountType"]);
|
set_data("accountType", $info["accountType"]);
|
||||||
|
set_data("availableActivateDateTime", $info["availableActivateDateTime"]);
|
||||||
set_data("playerCount", $playerCount);
|
set_data("playerCount", $playerCount);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
@@ -27,14 +28,14 @@ function get_maestro_info($maestroID) {
|
|||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT Name, Email, AccountType, PlayerCount
|
SELECT Name, Email, AccountType, AvailableActivateDateTime, PlayerCount
|
||||||
FROM maestro
|
FROM maestro
|
||||||
WHERE MaestroID = ?
|
WHERE MaestroID = ?
|
||||||
";
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param("s", $maestroID);
|
$stmt->bind_param("s", $maestroID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($name, $email, $accountType, $playerCount);
|
$stmt->bind_result($name, $email, $accountType, $availableActivateDateTime, $playerCount);
|
||||||
// while($stmt->fetch())
|
// while($stmt->fetch())
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
@@ -42,6 +43,7 @@ function get_maestro_info($maestroID) {
|
|||||||
$info["name"] = $name;
|
$info["name"] = $name;
|
||||||
$info["email"] = $email;
|
$info["email"] = $email;
|
||||||
$info["accountType"] = $accountType;
|
$info["accountType"] = $accountType;
|
||||||
|
$info["availableActivateDateTime"] = $availableActivateDateTime;
|
||||||
$info["playerCount"] = $playerCount;
|
$info["playerCount"] = $playerCount;
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
|
|||||||
Reference in New Issue
Block a user