|  | @@ -235,6 +235,8 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |          message[0] = '客户信息获取成功'
 | 
	
		
			
				|  |  |          try:
 | 
	
		
			
				|  |  |              save_path = FileUtil().save_path_create()
 | 
	
		
			
				|  |  | +            send_data = []
 | 
	
		
			
				|  |  | +            # 查询数据
 | 
	
		
			
				|  |  |              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
 | 
	
		
			
				|  |  |                  name = customer[2]
 | 
	
	
		
			
				|  | @@ -252,24 +254,35 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |                      table_2 = self.house_data(house_ids)
 | 
	
		
			
				|  |  |                      # 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],
 | 
	
		
			
				|  |  | -                    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],
 | 
	
		
			
				|  |  |                                                      table_1[15], table_1[16], table_1[17], table_1[18],
 | 
	
		
			
				|  |  |                      table_1[19], table_1[20], table_1[21], table_1[22], table_1[23], table_1[24], table_1[25],
 | 
	
		
			
				|  |  |                                                      table_1[26], table_1[27], table_1[28], table_1[29], table_1[30], table_1[31],
 | 
	
		
			
				|  |  |                                                      table_1[32], table_1[33], table_1[34], table_1[35]
 | 
	
		
			
				|  |  |                                                      )
 | 
	
		
			
				|  |  | -                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
	
		
			
				|  |  | +                    send_data.append([table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path, content, name, mail])
 | 
	
		
			
				|  |  | +                    # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
	
		
			
				|  |  |                  elif customer_type == 1:
 | 
	
		
			
				|  |  |                      # 项目
 | 
	
		
			
				|  |  |                      table_2 = self.house_data(self.get_house_ids(ids))
 | 
	
		
			
				|  |  | -                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
	
		
			
				|  |  | +                    send_data.append([table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path, content, name, mail])
 | 
	
		
			
				|  |  | +                    # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
	
		
			
				|  |  |                  elif customer_type == 3:
 | 
	
		
			
				|  |  |                      # 区域
 | 
	
		
			
				|  |  |                      table_2 = self.house_data(self.get_house_ids(ids))
 | 
	
		
			
				|  |  | -                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
	
		
			
				|  |  | +                    send_data.append(
 | 
	
		
			
				|  |  | +                    [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path, content, name, mail])
 | 
	
		
			
				|  |  | +                    # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
	
		
			
				|  |  |                  else:
 | 
	
		
			
				|  |  |                      pass
 | 
	
		
			
				|  |  | -                send_mail_info.append([title, content, mail, file_path, title + '.xlsx', name])
 | 
	
		
			
				|  |  | +            # 生成文件
 | 
	
		
			
				|  |  | +            for data in send_data:
 | 
	
		
			
				|  |  | +                try:
 | 
	
		
			
				|  |  | +                    rfu.create_excel_file(data[0], data[1], data[2], data[3], data[4])
 | 
	
		
			
				|  |  | +                    # [title, content, mail, file_path, title + '.xlsx', name]
 | 
	
		
			
				|  |  | +                    send_mail_info.append([data[2], data[5], data[7], data[5], data[2] + '.xlsx', data[6]])
 | 
	
		
			
				|  |  | +                except Exception as e:
 | 
	
		
			
				|  |  | +                    print(e)
 | 
	
		
			
				|  |  |              # 发送邮件
 | 
	
		
			
				|  |  |              send_mail_log = []
 | 
	
		
			
				|  |  |              for mail in send_mail_info:
 | 
	
	
		
			
				|  | @@ -285,6 +298,7 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |                      print(str(e))
 | 
	
		
			
				|  |  |                      message['error1'] = 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)
 | 
	
		
			
				|  |  |          except Exception as e:
 | 
	
		
			
				|  |  |              message['error'] = str(e)
 |