Browse Source

修改测试方法,可以收发指任务客户的邮件

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 4 years ago
parent
commit
155d92bc62
2 changed files with 8 additions and 3 deletions
  1. 2 1
      flask_app.py
  2. 6 2
      jianye_report.py

+ 2 - 1
flask_app.py

@@ -272,7 +272,8 @@ def send_mail_to_customer():
     try:
         customer_id = request.args.get('id', default=0, type=int)
         mail = request.args.get('mail', default=None, type=str)
-        data = rj.send_mail_for_customer_id(customer_id, mail)
+        task_key = request.args.get('key', default=None, type=str)
+        data = rj.send_mail_for_customer_id(customer_id, task_key, mail)
         result['data'] = data
         pass
     except Exception as e:

+ 6 - 2
jianye_report.py

@@ -385,7 +385,7 @@ class JianYeReport(object):
     def get_customer_info_by_id(self, customer_id):
         return self.db.select(Sql.sql_14, [customer_id])
 
-    def send_mail_for_customer_id(self, customer_id, new_mail=None):
+    def send_mail_for_customer_id(self, customer_id, task_key=None, new_mail=None):
         """
             获取指定客户的邮件信息
         :param customer_id:
@@ -393,7 +393,11 @@ class JianYeReport(object):
         :return:
         """
         message = {}
-        customers = self.get_customer_info_by_id(customer_id)
+        customers = []
+        if task_key:
+            customers = self.get_report_customers(task_key)
+        else:
+            customers = self.get_customer_info_by_id(customer_id)
         message['customer'] = str(customer_id)
         send_data = []
         if customers: