Add: maestro_info
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
function get_max_player_count($accountType) {
|
||||
switch($accountType) {
|
||||
case 1:
|
||||
return 20;
|
||||
case 2:
|
||||
return 50;
|
||||
case 3:
|
||||
return 100;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
|
||||
|
||||
$info = get_maestro_info($maestroID);
|
||||
if($info === null) {
|
||||
set_error_message("마에스트로 계정 정보를 가져올 수 없습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
set_data("name", $info["name"]);
|
||||
set_data("accountType", $info["accountType"]);
|
||||
set_data("playerCount", $info["playerCount"]);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function get_maestro_info($maestroID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT Name, AccountType, PlayerCount
|
||||
FROM moty_maestro
|
||||
WHERE MaestroID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("s", $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($name, $accountType, $playerCount);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
$info["name"] = $name;
|
||||
$info["accountType"] = $accountType;
|
||||
$info["playerCount"] = $playerCount;
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,6 +2,7 @@
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../lib/maestro_account_type.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
@@ -27,7 +28,7 @@ if($result !== null) {
|
||||
|
||||
$maestroAccountType = get_maestro_account_type($maestroID);
|
||||
$playerCount = get_player_count($maestroID);
|
||||
if($playerCount >= $maestroAccountType * 10) {
|
||||
if($playerCount >= get_max_player_count($maestroAccountType)) {
|
||||
set_error_message("학생을 더 이상 추가할 수 없습니다. (더 많은 학생수로 업그레이드 하세요)");
|
||||
send_result_fail();
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user