|  | @@ -11,8 +11,8 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |      """
 | 
	
		
			
				|  |  |          建业报表数据处理
 | 
	
		
			
				|  |  |      """
 | 
	
		
			
				|  |  | -    customer_mails = ['liutt@elab-plus.com', 'binrenzhang@qq.com', 'plf@centralchina.com']
 | 
	
		
			
				|  |  | -    # customer_mails = ['binrenzhang@qq.com']
 | 
	
		
			
				|  |  | +    # customer_mails = ['liutt@elab-plus.com', 'binrenzhang@qq.com', 'plf@centralchina.com']
 | 
	
		
			
				|  |  | +    customer_mails = ['binrenzhang@qq.com']
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      #
 | 
	
		
			
				|  |  |      index_type = [
 | 
	
	
		
			
				|  | @@ -26,7 +26,7 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |      ]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      head_1 = ['城市', '项目名称', '浏览量', '浏览人数', '新增用户', '新增获电', '推荐用户', '分享获电', '裂变获电',
 | 
	
		
			
				|  |  | -              '扫码到访数', '全民经纪人注册数', '老业主注册数','报备成功数', '报备到访数']
 | 
	
		
			
				|  |  | +              '扫码到访数', '全民经纪人注册数', '老业主注册数', '报备成功数', '报备到访数']
 | 
	
		
			
				|  |  |      brand_id = '13'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      sheet_names_1 = ['当日数据', '当月数据', '上线以来所有数据']
 | 
	
	
		
			
				|  | @@ -40,7 +40,7 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |      def get_report_customers(self, task_key):
 | 
	
		
			
				|  |  |          return self.db.select(Sql.sql_2, [task_key])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    def get_mail_title(self, type, region_name,name):
 | 
	
		
			
				|  |  | +    def get_mail_title(self, type, region_name, name):
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  |              获取邮件名称
 | 
	
		
			
				|  |  |          :param type:1:项目,2:集团,3:区域
 | 
	
	
		
			
				|  | @@ -87,7 +87,8 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |          number_1 = rpfu.add(number_1_1, number_1_2)
 | 
	
		
			
				|  |  |          result.append(number_1)
 | 
	
		
			
				|  |  |          # 2: 总浏览人数
 | 
	
		
			
				|  |  | -        data_2 = self.db.select(Sql.sql_5, [time_range[0], time_range[1], house_ids, time_range[0], time_range[1], house_ids])
 | 
	
		
			
				|  |  | +        data_2 = self.db.select(Sql.sql_5,
 | 
	
		
			
				|  |  | +                                [time_range[0], time_range[1], house_ids, time_range[0], time_range[1], house_ids])
 | 
	
		
			
				|  |  |          number_2 = data_2[0][0]
 | 
	
		
			
				|  |  |          result.append(number_2)
 | 
	
		
			
				|  |  |          # 3:新增获客
 | 
	
	
		
			
				|  | @@ -131,7 +132,7 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |              number = 0
 | 
	
		
			
				|  |  |              for x in self.db.select(Sql.sql_10, [time_range[0], time_range[1]]):
 | 
	
		
			
				|  |  |                  if str(x[0]) == str(key):
 | 
	
		
			
				|  |  | -                   number = x[1]
 | 
	
		
			
				|  |  | +                    number = x[1]
 | 
	
		
			
				|  |  |              data_3.append(number)
 | 
	
		
			
				|  |  |          result.extend(data_1)
 | 
	
		
			
				|  |  |          result.extend(data_2)
 | 
	
	
		
			
				|  | @@ -254,28 +255,36 @@ 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[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]
 | 
	
		
			
				|  |  | -                                                    )
 | 
	
		
			
				|  |  | -                    send_data.append([table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path, content, name, mail])
 | 
	
		
			
				|  |  | +                                             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]
 | 
	
		
			
				|  |  | +                                             )
 | 
	
		
			
				|  |  | +                    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))
 | 
	
		
			
				|  |  | -                    send_data.append([table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path, content, name, mail])
 | 
	
		
			
				|  |  | +                    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))
 | 
	
		
			
				|  |  |                      send_data.append(
 | 
	
		
			
				|  |  | -                    [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path, content, name, mail])
 | 
	
		
			
				|  |  | +                        [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
 | 
	
		
			
				|  |  | -                break
 | 
	
		
			
				|  |  | +            message['query_data'] = 'success'
 | 
	
		
			
				|  |  |              # 生成文件
 | 
	
		
			
				|  |  |              for data in send_data:
 | 
	
		
			
				|  |  |                  try:
 | 
	
	
		
			
				|  | @@ -284,6 +293,7 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |                      send_mail_info.append([data[2], data[5], data[7], data[4], data[2] + '.xlsx', data[6]])
 | 
	
		
			
				|  |  |                  except Exception as e:
 | 
	
		
			
				|  |  |                      print(e)
 | 
	
		
			
				|  |  | +            message['file'] = 'success'
 | 
	
		
			
				|  |  |              # 发送邮件
 | 
	
		
			
				|  |  |              send_mail_log = []
 | 
	
		
			
				|  |  |              for mail in send_mail_info:
 | 
	
	
		
			
				|  | @@ -299,8 +309,10 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |                      print(str(e))
 | 
	
		
			
				|  |  |                      message['error1'] = str(e)
 | 
	
		
			
				|  |  |                      send_mail_log.append([mail[5], mail[2], mail[3], -1, str(e)])
 | 
	
		
			
				|  |  | +            message['mail'] = 'success'
 | 
	
		
			
				|  |  |              # 写入日志
 | 
	
		
			
				|  |  |              self.db.add_some(send_mail_log, Sql.sql_12)
 | 
	
		
			
				|  |  | +            message['log'] = 'success'
 | 
	
		
			
				|  |  |          except Exception as e:
 | 
	
		
			
				|  |  |              message['error'] = str(e)
 | 
	
		
			
				|  |  |          finally:
 | 
	
	
		
			
				|  | @@ -314,4 +326,4 @@ class JianYeReport(object):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  if __name__ == '__main__':
 | 
	
		
			
				|  |  | -    pass
 | 
	
		
			
				|  |  | +    pass
 |