Browse Source

去掉多余的接口返回值

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 4 years ago
parent
commit
4731e41de5
2 changed files with 7 additions and 16 deletions
  1. 6 2
      email_util.py
  2. 1 14
      jianye_report.py

+ 6 - 2
email_util.py

@@ -143,7 +143,11 @@ class EmailUtil(object):
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
     send_email = EmailUtil()
     send_email = EmailUtil()
-    result = send_email.send_mail_by_admin('移动案场订阅日报', MailContentText.text_1.format(1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, 31, 32), '1285211525@qq.com', r'D:\elab\elab_mvp\resources\report_data\2020-04-14\移动案场订阅周报_庞凌飞_单项目_2020-03-12至2020-03-13.xls', '移动案场订阅周报_庞凌飞_单项目_2020-03-12至2020-03-13.xls',
-                                           r'D:\elab\elab_mvp\resources\111.xlsx', '111.xlsx')
+    result = send_email.send_mail_by_admin('移动案场订阅日报', MailContentText.text_1.format(1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, 31, 32, 33, 34, 35, 36),
+                                           '1285211525@qq.com',
+                                           r'D:\elab-code\elab_mvp\resources\建业项目卡片信息合档-补id(1)(1).xlsx',
+                                           '建业项目卡片信息合档-补id(1)(1).xlsx',
+                                           r'D:\elab-code\elab_mvp\resources\tongce1.xlsx',
+                                           'tongce1.xlsx')
     print(result)
     print(result)
 
 

+ 1 - 14
jianye_report.py

@@ -233,6 +233,7 @@ class JianYeReport(object):
         customers = self.get_report_customers(task_key)
         customers = self.get_report_customers(task_key)
         message[0] = '客户信息获取成功'
         message[0] = '客户信息获取成功'
         try:
         try:
+            save_path = FileUtil().save_path_create()
             for customer in customers:
             for customer in customers:
                 # a.task_key, b.customer_type, b.name, b.mail, b.house_or_region, a.customer_id, GROUP_CONCAT(c.house_or_brand_id) as ids
                 # a.task_key, b.customer_type, b.name, b.mail, b.house_or_region, a.customer_id, GROUP_CONCAT(c.house_or_brand_id) as ids
                 name = customer[2]
                 name = customer[2]
@@ -242,18 +243,12 @@ class JianYeReport(object):
                 region_name = customer[4]
                 region_name = customer[4]
                 title = self.get_mail_title(customer_type, region_name, name)
                 title = self.get_mail_title(customer_type, region_name, name)
                 content = self.get_mail_content(customer_type)
                 content = self.get_mail_content(customer_type)
-                save_path = FileUtil().save_path_create()
                 file_path = save_path + '/' + title
                 file_path = save_path + '/' + title
-                message[11] = '邮件信息生成成功'
                 if customer_type == 2:
                 if customer_type == 2:
                     # 集团
                     # 集团
-                    message['99'] = '集团'
                     table_1 = self.brand_data()
                     table_1 = self.brand_data()
-                    message[33] = 'brand_data'
                     house_ids = self.get_house_id_by_brand_id(ids)
                     house_ids = self.get_house_id_by_brand_id(ids)
-                    message[55] = 'get_house_id_by_brand_id'
                     table_2 = self.house_data(house_ids)
                     table_2 = self.house_data(house_ids)
-                    message[66] = 'house_data'
                     # data, sheet_names, title, headers, save_path
                     # data, sheet_names, title, headers, save_path
                     content = content.format(table_1[0], table_1[1], table_1[2], table_1[3], table_1[4], table_1[5],
                     content = content.format(table_1[0], table_1[1], table_1[2], table_1[3], table_1[4], table_1[5],
                     table_1[6], table_1[7], table_1[8], table_1[9], table_1[10], table_1[11], table_1[12],table_1[13], table_1[14],
                     table_1[6], table_1[7], table_1[8], table_1[9], table_1[10], table_1[11], table_1[12],table_1[13], table_1[14],
@@ -266,24 +261,17 @@ class JianYeReport(object):
                     rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
                     rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
                 elif customer_type == 1:
                 elif customer_type == 1:
                     # 项目
                     # 项目
-                    message[111] = '项目'
                     table_2 = self.house_data(self.get_house_ids(ids))
                     table_2 = self.house_data(self.get_house_ids(ids))
-                    message[222] = 'house_data'
-                    message[99999] = table_2
                     rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
                     rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
                 elif customer_type == 3:
                 elif customer_type == 3:
                     # 区域
                     # 区域
-                    message[333] = '区域'
                     table_2 = self.house_data(self.get_house_ids(ids))
                     table_2 = self.house_data(self.get_house_ids(ids))
-                    message[444] = 'self.house_data'
                     rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
                     rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
                 else:
                 else:
                     pass
                     pass
                 send_mail_info.append([title, content, mail, file_path, title + '.xlsx', name])
                 send_mail_info.append([title, content, mail, file_path, title + '.xlsx', name])
-                message[1] = '数据查询和excel生成完毕'
             # 发送邮件
             # 发送邮件
             send_mail_log = []
             send_mail_log = []
-            message[0000] = '客户数据数量;{}'.format(len(send_mail_info))
             for mail in send_mail_info:
             for mail in send_mail_info:
                 try:
                 try:
                     for m in self.customer_mails:
                     for m in self.customer_mails:
@@ -297,7 +285,6 @@ class JianYeReport(object):
                     print(str(e))
                     print(str(e))
                     send_mail_log.append([mail[5], mail[2], mail[3], -1, str(e)])
                     send_mail_log.append([mail[5], mail[2], mail[3], -1, str(e)])
             self.db.add_some(send_mail_log, Sql.sql_12)
             self.db.add_some(send_mail_log, Sql.sql_12)
-            message[2] = '遇见发送完毕, 共:{}份邮件'.format(len(send_mail_info))
         except Exception as e:
         except Exception as e:
             message['error'] = str(e)
             message['error'] = str(e)
         finally:
         finally: