|
@@ -40,7 +40,7 @@ app.add_middleware(
|
|
|
)
|
|
|
|
|
|
# 寄送逾期執行表單Email通知
|
|
|
-def hhh_send_mail(email, html):
|
|
|
+def hhh_send_mail(email, subject, html):
|
|
|
SENDER = "Gorgeous Space <noreply@hhh.com.tw>"
|
|
|
RECIPIENT = email
|
|
|
AWS_REGION = "us-east-1"
|
|
@@ -50,7 +50,7 @@ def hhh_send_mail(email, html):
|
|
|
try:
|
|
|
msg = MIMEMultipart()
|
|
|
# msg["Subject"] = "逾期執行表單通知_" + str(datetime.date.today())
|
|
|
- msg["Subject"] = "逾期執行表單通知_" + (datetime.now() + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M")
|
|
|
+ msg["Subject"] = subject
|
|
|
msg["From"] = "noreply@hhh.com.tw"
|
|
|
msg["To"] = email
|
|
|
|
|
@@ -101,9 +101,9 @@ db = dataset.connect('mysql://hhh7796hhh:lYmWsu^ujcA1@hhh-v57-cluster.cluster-cm
|
|
|
|
|
|
|
|
|
@app.get("/is_close_changed_notice")
|
|
|
-async def is_close_changed_notice(exf_id: str = '', is_close: str = ''):
|
|
|
- subject = '[合約狀態修改]:' + r['company'] + ' (合約編號:' + r['num'] + ')_' + datetime.now().strftime("%Y-%m-%d %H:%M")
|
|
|
-
|
|
|
+async def is_close_changed_notice(exf_id: str = '', is_close: str = ''):
|
|
|
+ subject = ""
|
|
|
+
|
|
|
# 取得合約資料
|
|
|
q = "SELECT * \
|
|
|
FROM execute_form \
|
|
@@ -113,8 +113,10 @@ async def is_close_changed_notice(exf_id: str = '', is_close: str = ''):
|
|
|
|
|
|
if q_result_count == 0: # 無合約資料
|
|
|
return
|
|
|
-
|
|
|
+
|
|
|
for r in db.query(q):
|
|
|
+ subject = '[合約狀態修改]:' + r['company'] + ' (合約編號:' + r['num'] + ')_' + datetime.now().strftime("%Y-%m-%d %H:%M")
|
|
|
+
|
|
|
html = """
|
|
|
<!DOCTYPE html>
|
|
|
<head>
|
|
@@ -137,9 +139,9 @@ async def is_close_changed_notice(exf_id: str = '', is_close: str = ''):
|
|
|
</html>
|
|
|
"""
|
|
|
|
|
|
- # Email清單
|
|
|
- email_list = ['mike@choozmo.com']
|
|
|
+ # Email清單
|
|
|
+ email_list = ['mike@choozmo.com']
|
|
|
|
|
|
- # 寄送逾期執行表單Email通知
|
|
|
- for email in email_list:
|
|
|
- hhh_send_mail(email, html)
|
|
|
+ # 寄送逾期執行表單Email通知
|
|
|
+ for email in email_list:
|
|
|
+ hhh_send_mail(email, subject, html)
|