Fix: revised php code to maestro app typing list

This commit is contained in:
2018-07-12 11:14:29 +09:00
parent f23665a5f0
commit 07b65f004b
4 changed files with 103 additions and 173 deletions
+17 -15
View File
@@ -1,24 +1,26 @@
<?php
header('Content-Type: application/json');
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$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();
set_error_message("등록된 마우스 앱 없음");
send_result_fail();
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();
set_data("appList", $mouse_app_list);
set_data("activatedAppList", $activated_mouse_app_list);
send_result_success();
exit;
function get_mouse_app_list() {
@@ -35,9 +37,9 @@ function get_mouse_app_list() {
$playerList = array();
while($stmt->fetch()) {
$player['AppID'] = $appID;
$player['AppName'] = $appName;
$player['KoreanName'] = $koreanName;
$player["appID"] = $appID;
$player["appName"] = $appName;
$player["koreanName"] = $koreanName;
array_push($playerList, $player);
}
@@ -53,13 +55,13 @@ function get_activated_mouse_app_list($maestroID) {
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->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($appID);
$playerList = array();
while($stmt->fetch()) {
$player['AppID'] = $appID;
$player["appID"] = $appID;
array_push($playerList, $player);
}
+17 -15
View File
@@ -1,24 +1,26 @@
<?php
header('Content-Type: application/json');
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroID = $_POST["maestro_id"];
include "./../setup/connect_db.php";
$typing_app_list = get_typing_app_list();
if($typing_app_list.length === 0) {
send_error_message($replyJSON, "등록된 타자 앱 없음");
$db_conn->close();
set_error_message("등록된 타자 앱 없음");
send_result_fail();
exit;
}
$activated_typing_app_list = get_activated_typing_app_list($maestroID);
$replyJSON["List"] = $typing_app_list;
$replyJSON["ActivatedList"] = $activated_typing_app_list;
$replyJSON["RESULT"] = "ok";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
set_data("appList", $typing_app_list);
set_data("activatedAppList", $activated_typing_app_list);
send_result_success();
exit;
function get_typing_app_list() {
@@ -35,9 +37,9 @@ function get_typing_app_list() {
$playerList = array();
while($stmt->fetch()) {
$player['AppID'] = $appID;
$player['AppName'] = $appName;
$player['KoreanName'] = $koreanName;
$player["appID"] = $appID;
$player["appName"] = $appName;
$player["koreanName"] = $koreanName;
array_push($playerList, $player);
}
@@ -53,13 +55,13 @@ function get_activated_typing_app_list($maestroID) {
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->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($appID);
$playerList = array();
while($stmt->fetch()) {
$player['AppID'] = $appID;
$player["appID"] = $appID;
array_push($playerList, $player);
}