|
@@ -269,6 +269,7 @@ class JianYeReport(object):
|
|
|
message[111] = '项目'
|
|
|
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)
|
|
|
elif customer_type == 3:
|
|
|
# 区域
|
|
@@ -278,24 +279,25 @@ 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)
|
|
|
else:
|
|
|
pass
|
|
|
- send_mail_info.append([title, content, mail, file_path, title + '.xlsx'])
|
|
|
+ send_mail_info.append([title, content, mail, file_path, title + '.xlsx', name])
|
|
|
message[1] = '数据查询和excel生成完毕'
|
|
|
- # 发送邮件
|
|
|
- send_mail_log = []
|
|
|
- for mail in send_mail_info:
|
|
|
- try:
|
|
|
- for m in self.customer_mails:
|
|
|
- result = mail_util.send_mail_by_admin(mail[0], mail[1], m, mail[3], mail[4])
|
|
|
- if result:
|
|
|
- # name, mail, report_name, push_time, send_status, status, error_message
|
|
|
- send_mail_log.append([name, mail[2], mail[3], 1, 'success'])
|
|
|
- else:
|
|
|
- send_mail_log.append([name, mail[2], mail[3], -1, 'fail'])
|
|
|
- except Exception as e:
|
|
|
- print(str(e))
|
|
|
- send_mail_log.append([name, mail[2], mail[3], -1, str(e)])
|
|
|
- self.db.add_some(send_mail_info, Sql.sql_12)
|
|
|
- message[2] = '遇见发送完毕, 共:{}份邮件'.format(len(send_mail_info))
|
|
|
+ break
|
|
|
+ # 发送邮件
|
|
|
+ send_mail_log = []
|
|
|
+ for mail in send_mail_info:
|
|
|
+ try:
|
|
|
+ for m in self.customer_mails:
|
|
|
+ result = mail_util.send_mail_by_admin(mail[0], mail[1], m, mail[3], mail[4])
|
|
|
+ if result:
|
|
|
+ # name, mail, report_name, push_time, send_status, status, error_message
|
|
|
+ send_mail_log.append([mail[5], mail[2], mail[3], 1, 'success'])
|
|
|
+ else:
|
|
|
+ send_mail_log.append([mail[5], mail[2], mail[3], -1, 'fail'])
|
|
|
+ except Exception as e:
|
|
|
+ print(str(e))
|
|
|
+ send_mail_log.append([mail[5], mail[2], mail[3], -1, str(e)])
|
|
|
+ self.db.add_some(send_mail_info, Sql.sql_12)
|
|
|
+ message[2] = '遇见发送完毕, 共:{}份邮件'.format(len(send_mail_info))
|
|
|
except Exception as e:
|
|
|
message['error'] = str(e)
|
|
|
finally:
|