Add: maestro DB - AvailableActivateDateTime

This commit is contained in:
2018-07-19 10:57:04 +09:00
parent 0bf3adb4ed
commit c2f478c97f
5 changed files with 39 additions and 25 deletions
+5 -1
View File
@@ -7,7 +7,11 @@ include "./../setup/connect_db.php";
$maestro_id = $_POST["maestro_id"];
$query = "UPDATE moty_maestro SET ActivateStatus=1 WHERE MaestroID=?";
$query = "
UPDATE moty_maestro
SET ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
@@ -29,7 +29,8 @@ function get_maestro_list() {
global $db_conn;
$query = "
SELECT MaestroID, Name, AccountType FROM moty_maestro
SELECT MaestroID, Name, AccountType
FROM moty_maestro
WHERE ActivateStatus=0
ORDER BY MaestroID DESC
";
@@ -54,7 +55,8 @@ function get_maestro_list_by_name($maestroName) {
global $db_conn;
$query = "
SELECT MaestroID, Name, AccountType FROM moty_maestro
SELECT MaestroID, Name, AccountType
FROM moty_maestro
WHERE Name LIKE CONCAT('%', ?, '%') AND ActivateStatus=0
ORDER BY MaestroID DESC
";
+5 -1
View File
@@ -44,7 +44,11 @@ exit;
function hasMaestroName($maestroName) {
global $db_conn;
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$query = "
SELECT MaestroID
FROM moty_maestro
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $maestroName);
$stmt->execute();
+23 -20
View File
@@ -1,20 +1,13 @@
<?php
header('Content-Type: application/json');
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroName = $_POST["maestro_name"];
$name = $_POST["name"];
$enterCode = $_POST["enter_code"];
/*
if(!is_numeric($enterCode)) {
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
exit;
} else if(strlen($enterCode) != 6) {
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
exit;
}
*/
include "./../setup/connect_db.php";
$maestroID = get_maestro_id($maestroName);
if($maestroID === null) {
@@ -23,21 +16,27 @@ if($maestroID === null) {
exit;
}
$replyJSON = get_login_data($maestroID, $name, $enterCode);
if($replyJSON["PlayerID"] === null) {
$playerID = get_login_data($maestroID, $name, $enterCode);
if($playerID === null) {
send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다");
$db_conn->close();
exit;
}
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_data("PlayerID", $playerID);
send_result_success();
exit;
function get_maestro_id($maestroName) {
global $db_conn;
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$query = "
SELECT MaestroID
FROM moty_maestro
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('s', $maestroName);
$stmt->execute();
@@ -54,19 +53,23 @@ function get_maestro_id($maestroName) {
function get_login_data($maestroID, $name, $enterCode) {
global $db_conn;
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
$query = "
SELECT PlayerID
FROM moty_player
WHERE MaestroID = ? AND Name = ? AND EnterCode = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('iss', $maestroID, $name, $enterCode);
$stmt->execute();
$stmt->bind_result($player_id);
$stmt->bind_result($playerID);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
$replyJSON["MaestroID"] = $maestroID;
$replyJSON["PlayerID"] = $player_id;
// $replyJSON["MaestroID"] = $maestroID;
// $replyJSON["PlayerID"] = $playerID;
return $replyJSON;
return $playerID;
}
?>