Add: mouse_app_list
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$mouse_app_list = get_mouse_app_list();
|
||||
if($mouse_app_list.length === 0) {
|
||||
send_error_message($replyJSON, "등록된 마우스 앱 없음");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$activated_mouse_app_list = get_activated_mouse_app_list($maestroID);
|
||||
$replyJSON["List"] = $mouse_app_list;
|
||||
$replyJSON["ActivatedList"] = $activated_mouse_app_list;
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_mouse_app_list() {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT AppID, AppName, KoreanName FROM moty_app
|
||||
WHERE AppType=100
|
||||
ORDER BY AppID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($appID, $appName, $koreanName);
|
||||
|
||||
$playerList = array();
|
||||
while($stmt->fetch()) {
|
||||
$player['AppID'] = $appID;
|
||||
$player['AppName'] = $appName;
|
||||
$player['KoreanName'] = $koreanName;
|
||||
array_push($playerList, $player);
|
||||
}
|
||||
|
||||
return $playerList;
|
||||
}
|
||||
|
||||
function get_activated_mouse_app_list($maestroID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT A.AppID
|
||||
FROM moty_app AS A
|
||||
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 100 AND AA.MaestroID=?"
|
||||
;
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('i', $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($appID);
|
||||
|
||||
$playerList = array();
|
||||
while($stmt->fetch()) {
|
||||
$player['AppID'] = $appID;
|
||||
array_push($playerList, $player);
|
||||
}
|
||||
|
||||
return $playerList;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user