Add: maestro log DB

This commit is contained in:
2018-10-30 12:27:55 +09:00
parent 90c8ffa3a6
commit 542afc69d9
6 changed files with 95 additions and 3 deletions
@@ -5,6 +5,7 @@ include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
include "./../lib/maestro_account_info.php"; include "./../lib/maestro_account_info.php";
include "./../lib/db_maestro.php"; include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
include "./../mail/mail_setting.php"; include "./../mail/mail_setting.php";
include "./../mail/send_mail.php"; include "./../mail/send_mail.php";
@@ -41,6 +42,7 @@ update_count_registered_player($maestroID, $count);
$maestro_data = get_maestro_data($maestroID); $maestro_data = get_maestro_data($maestroID);
sendMailRegisterDone($maestro_data["name"], $maestro_data["email"]); sendMailRegisterDone($maestro_data["name"], $maestro_data["email"]);
insertMaestroLog("register_maestro", $maestroID, $maestro_data["name"]." / ".$maestro_data["email"]);
send_result_success(); send_result_success();
exit; exit;
+2
View File
@@ -4,6 +4,7 @@ header("Content-Type: application/json");
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php"; include "./../lib/send_reply_json.php";
include "./../lib/db_maestro.php"; include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
include "./../lib/maestro_account_info.php"; include "./../lib/maestro_account_info.php";
include "./../mail/mail_setting.php"; include "./../mail/mail_setting.php";
include "./../mail/send_mail.php"; include "./../mail/send_mail.php";
@@ -20,6 +21,7 @@ change_upgrade_request_status_to_applied($maestro_upgrade_id);
$maestro_data = get_maestro_data($maestro_id); $maestro_data = get_maestro_data($maestro_id);
sendMailUpgradeDone($maestro_data["name"], $maestro_data["email"], $registered_account_type, $upgrade_account_type); sendMailUpgradeDone($maestro_data["name"], $maestro_data["email"], $registered_account_type, $upgrade_account_type);
insertMaestroLog("upgrade_maestro", $maestro_id, $registered_account_type." -> ".$upgrade_account_type);
// set_data("maestro_upgrade_id", $maestro_upgrade_id); // set_data("maestro_upgrade_id", $maestro_upgrade_id);
// set_data("maestro_id", $maestro_id); // set_data("maestro_id", $maestro_id);
+72
View File
@@ -0,0 +1,72 @@
<?php
function insertMaestroLog($type, $maestro_id, $remark) {
global $db_conn;
// echo("\n$type");
// echo("\n$maestro_id");
// echo("\n$remark");
$query = "
INSERT INTO maestro_log (Type, MaestroID, LogDateTime, Remark)
VALUES (?, ?, NOW(), ?);
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('sis', $type, $maestro_id, $remark);
$stmt->execute();
// echo "\ninsertMaestroLog";
}
/*
function get_app_highest_record($maestro_id, $app_id, $player_id) {
global $db_conn;
$query = "
SELECT HighestRecord
FROM app_highest_record
WHERE MaestroID = ? AND AppID = ? AND PlayerID = ?;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
$stmt->execute();
$stmt->bind_result($app_highest_record);
$stmt->fetch();
$stmt->close();
return $app_highest_record;
// echo "\nget_app_highest_record : $app_highest_record";
}
function remove_app_highest_record($maestro_id, $app_id, $player_id) {
global $db_conn;
$query = "
DELETE FROM app_highest_record
WHERE MaestroID = ? AND AppID = ? AND PlayerID = ?;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
$stmt->execute();
// echo "\ndelete_app_highest_record";
}
function insert_app_highest_record($maestro_id, $app_id, $player_id, $app_highest_record) {
global $db_conn;
$query = "
INSERT INTO app_highest_record (MaestroID, PlayerID, AppID, HighestRecord, RecordDateTime)
VALUES (?, ?, ?, ?, NOW());
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('iiid', $maestro_id, $player_id, $app_id, $app_highest_record);
$stmt->execute();
// echo "\ninsert_app_highest_record";
}
*/
?>
+2
View File
@@ -5,6 +5,7 @@ include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php"; include "./../lib/send_reply_json.php";
include "./../lib/maestro_account_info.php"; include "./../lib/maestro_account_info.php";
include "./../lib/db_maestro.php"; include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
include "./../mail/mail_setting.php"; include "./../mail/mail_setting.php";
include "./../mail/send_mail.php"; include "./../mail/send_mail.php";
@@ -32,6 +33,7 @@ if($maestroID === null) {
} }
sendMailRegisterBankInfo($maestro_name, $email, $account_type); sendMailRegisterBankInfo($maestro_name, $email, $account_type);
insertMaestroLog("add_maestro", $maestroID, $maestro_name." / ".$email." / ".$account_type);
send_result_success(); send_result_success();
exit; exit;
@@ -5,6 +5,7 @@ include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
include "./../lib/maestro_account_info.php"; include "./../lib/maestro_account_info.php";
include "./../lib/db_maestro.php"; include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
include "./../mail/mail_setting.php"; include "./../mail/mail_setting.php";
include "./../mail/send_mail.php"; include "./../mail/send_mail.php";
@@ -25,11 +26,16 @@ $email_prev = $info["email"];
update_maestro_info($maestroID, $maestroName, $email); update_maestro_info($maestroID, $maestroName, $email);
if($maestroName != $maestro_name_prev)
sendMailUpdateMaestroName($maestroName, $maestro_name_prev, $email);
if($email != $email_prev) if($maestroName != $maestro_name_prev) {
sendMailUpdateMaestroName($maestroName, $maestro_name_prev, $email);
insertMaestroLog("update_maestro_name", $maestroID, $maestro_name_prev." -> ".$maestroName);
}
if($email != $email_prev) {
sendMailUpdateMaestroEmail($maestroName, $email, $email_prev); sendMailUpdateMaestroEmail($maestroName, $email, $email_prev);
insertMaestroLog("update_maestro_email", $maestroID, $email_prev." -> ".$email);
}
send_result_success(); send_result_success();
exit; exit;
+8
View File
@@ -106,3 +106,11 @@ CREATE TABLE banned_word (
BannedWordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, BannedWordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Word CHAR(50) NOT NULL Word CHAR(50) NOT NULL
); );
CREATE TABLE maestro_log (
MaestroLogID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Type CHAR(50) NOT NULL,
LogDateTime DATETIME NOT NULL,
MaestroID INT UNSIGNED NOT NULL,
Remark CHAR(100) NOT NULL
);