From 36660c920010d49a47501e7bf7b990147f7dbda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Fri, 3 May 2019 18:37:57 +0900 Subject: [PATCH] Fix: require __DIR__. --- src/web/php/send_mail_to_unpaid_maestro.php | 52 +++++++++++++++++++ .../chocomae/send_mail_to_unpaid_maestro.py | 43 ++++++++------- 2 files changed, 75 insertions(+), 20 deletions(-) create mode 100644 src/web/php/send_mail_to_unpaid_maestro.php diff --git a/src/web/php/send_mail_to_unpaid_maestro.php b/src/web/php/send_mail_to_unpaid_maestro.php new file mode 100644 index 0000000..7d15c3b --- /dev/null +++ b/src/web/php/send_mail_to_unpaid_maestro.php @@ -0,0 +1,52 @@ + $maestroName, + "register_date" => $registerDate, +); + +$recipientParam = array( + "maestro_name" => $maestroName +); + + +$nCloudSetting = new MailSetting(); +$chocomae = new ChocomaeInfo(); + +$mailSender = new MailSender(); +$mailSender->setMailSetting($nCloudSetting); +$mailSender->setSenderInfo($chocomae->sender_name, $chocomae->sender_email); + +$mailSender->makePostParam(337); +$mailSender->setParameters($parameters); +$mailSender->addRecipient($maestroEmail, $maestroName, "R", $recipientParam); +$mailSender->addRecipient($chocomae->sender_bcc, $chocomae->sender_name, "B", $recipientParam); + +// $mailSender->showSettings(); +$mailSender->send(); + +?> diff --git a/src/web/python/chocomae/send_mail_to_unpaid_maestro.py b/src/web/python/chocomae/send_mail_to_unpaid_maestro.py index 89e8ed9..6ab7c5e 100644 --- a/src/web/python/chocomae/send_mail_to_unpaid_maestro.py +++ b/src/web/python/chocomae/send_mail_to_unpaid_maestro.py @@ -18,30 +18,33 @@ def print_items(list): def send_mail(email, name, register_date): - space = ' ' - command = 'mysqldump' + space - user = '-u root' + space - password = '-p52napark!' + space - transaction = '--single-transaction' + space - db = 'chocomae' + space - table = 'maestro' + space - where_clause = '--where="DATE(NOW()) - INTERVAL 7 DAY > AcceptClausesDateTime AND ActivateStatus = 0"' + space - output_directory = '/home/chocomae/unregister-user-backup/' + filename = 'send_mail_to_unpaid_maestro.php' + path = '' if mode == 'mac': - output_directory = '' - today = datetime.today().strftime('%Y%m%d-%H%M%S') - output_filename = '> ' + output_directory + today + '.sql' - - command_db_backup = command + user + password + transaction + db + table + where_clause + output_filename - # 'mysqldump -u "${DBUSER}" -p"${DBPASS}" --single-transaction "${DBNAME}" "${filename}" --where="DATE(${record_date})=CURDATE()" > "${filename}.dump.bydate.sql"' - if mode == 'mac': - print(command_db_backup) + path = '/Applications/MAMP/htdocs/mouse_typing/src/web/php/' else: - subprocess.call(command_db_backup) + path = '/var/www/html/mouse_typing/src/web/php/' + + command_send_mail = [] + command_send_mail.append('/usr/bin/php') + command_send_mail.append(path + filename) + command_send_mail.append(email) + command_send_mail.append(name) + date = register_date.strftime('%Y%m%d') + command_send_mail.append(date) + print(command_send_mail) + + # command_move_dir = ['cd', path] + # print(command_move_dir) + # subprocess.call(command_move_dir) + command_move_pwd = ['pwd'] + subprocess.call(command_move_pwd) + subprocess.call(command_send_mail) +# insert log and delete from DB unpaidMaestroMan = UnpaidMaestroManager(mode) maestro_list = unpaidMaestroMan.get_unpaid_7days_maestro_list() # print_items(maestro_list) - -backup_unregister_maestro_table_file() +for maestro in maestro_list: + send_mail(maestro['Email'], maestro['Name'], maestro['AcceptClausesDateTime'])