Mike преди 4 години
родител
ревизия
43a89948e1
променени са 1 файла, в които са добавени 40 реда и са изтрити 8 реда
  1. 40 8
      is_close_changed_notice.py

+ 40 - 8
is_close_changed_notice.py

@@ -99,8 +99,8 @@ class Execute(BaseModel):
     is_close: str # 是否結案 (N: 未結案,Y: 已結案,T: 未上線,D: 續約,E: 不續約延期,F: 不續約需下線,G: 已到期未續約)
     price: str
 
-@app.get("/is_close_changed_notice")
-async def is_close_changed_notice(exf_id: str = 0, is_close: str = ''):
+@app.post("/is_close_changed_notice")
+async def is_close_changed_notice(e: Execute):
     html = """
         <!DOCTYPE html>
         <head>
@@ -108,15 +108,15 @@ async def is_close_changed_notice(exf_id: str = 0, is_close: str = ''):
         </head>
         <body>
         """
-    html += "<div>exf_id = " + exf_id + ", is_close = " + is_close + "</div>";
+    html += "<div>exf_id = " + e.exf_id + ", is_close = " + e.is_close + "</div>";
     
-    if is_close == 'D':
+    if e.is_close == 'D':
         html += "D: 續約"
-    elif is_close == 'E':
+    elif e.is_close == 'E':
         html += "E: 不續約延期"
-    elif is_close == 'F':
+    elif e.is_close == 'F':
         html += "F: 不續約需下線"
-    elif is_close == 'G':
+    elif e.is_close == 'G':
         html += "G: 已到期未續約"
 
     html += """
@@ -129,4 +129,36 @@ async def is_close_changed_notice(exf_id: str = 0, is_close: str = ''):
 
     # 寄送逾期執行表單Email通知
     for email in email_list:
-        hhh_send_mail(email, html)
+        hhh_send_mail(email, html)
+
+# @app.get("/is_close_changed_notice")
+# async def is_close_changed_notice(exf_id: str = 0, is_close: str = ''):
+#     html = """
+#         <!DOCTYPE html>
+#         <head>
+#             <meta charset="UTF-8">
+#         </head>
+#         <body>
+#         """
+#     html += "<div>exf_id = " + exf_id + ", is_close = " + is_close + "</div>";
+    
+#     if is_close == 'D':
+#         html += "D: 續約"
+#     elif is_close == 'E':
+#         html += "E: 不續約延期"
+#     elif is_close == 'F':
+#         html += "F: 不續約需下線"
+#     elif is_close == 'G':
+#         html += "G: 已到期未續約"
+
+#     html += """
+#         </body>
+#         </html>
+#         """ 
+    
+#     # Email清單
+#     email_list = ['mike@choozmo.com']
+
+#     # 寄送逾期執行表單Email通知
+#     for email in email_list:
+#         hhh_send_mail(email, html)