Browse Source

项目数据统计规则调整

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 4 years ago
parent
commit
a0127420d0
2 changed files with 15 additions and 17 deletions
  1. 14 16
      jianye_report.py
  2. 1 1
      sql.py

+ 14 - 16
jianye_report.py

@@ -15,15 +15,15 @@ class JianYeReport(object):
     customer_mails = ['binrenzhang@qq.com']
 
     #
-    index_type = {
-        6: 'fenxianghuodian',
-        7: 'liebianhuodian',
-        8: 'saomadaofang',
-        9: 'quanminjingjiren',
-        10: 'laoyezhu',
-        11: 'baobeichenggong',
-        12: 'baobeidaofang'
-    }
+    index_type = [
+        'fenxianghuodian',
+        'liebianhuodian',
+        'saomadaofang',
+        'quanminjingjiren',
+        'laoyezhu',
+        'baobeichenggong',
+        'baobeidaofang'
+    ]
 
     head_1 = ['城市', '项目名称', '浏览量', '浏览人数', '新增用户', '新增获电', '推荐用户', '分享获电', '裂变获电', '扫码到访数', '全民经纪人注册数', '报备成功数', '报备到访数']
     brand_id = '13'
@@ -126,11 +126,10 @@ class JianYeReport(object):
         data_2.append(number_2)
         data_3 = []
 
-        for key in self.index_type.keys():
-            type_value = self.index_type.get(key)
+        for key in self.index_type:
             number = 0
             for x in self.db.select(Sql.sql_10, [time_range[0], time_range[1]]):
-                if str(x[0]) == str(type_value):
+                if str(x[0]) == str(key):
                    number = x[1]
             data_3.append(number)
         result.extend(data_1)
@@ -176,12 +175,11 @@ class JianYeReport(object):
                 # house_id, type, COUNT(DISTINCT customer_mobile)
                 if str(house_id) == str(x[0]):
                     sub.append(x)
-            house_data = []
-            for key in self.index_type.keys():
-                value = self.index_type.get(key)
+            house_data = [house_id]
+            for key in self.index_type:
                 number = 0
                 for x in sub:
-                    if str(value) == str(x[1]):
+                    if str(key) == str(x[1]):
                         number = x[2]
                 house_data.append(number)
             data_3.append(house_data)

+ 1 - 1
sql.py

@@ -153,7 +153,7 @@ class Sql:
         SELECT house_id, visit_new_uv_dtd FROM a_brand_customer_share_dtd where brand_id ='13' and report_d >= %s and report_d <= %s  order by report_d
     """
     sql_10 = """
-    select type, COUNT(DISTINCT customer_mobile) from f_dm_jianye_allagent_day where report_d >= %s and report_d <= group by type
+    select type, COUNT(DISTINCT customer_mobile) from f_dm_jianye_allagent_day where report_d >= %s and report_d <= %s and house_id = '0' group by type
     """
     sql_11 = """"
     select a.house_or_region, min(b.house_or_brand_id), sum(a.name) from report_push_customer_info a left join report_customer_authority_info b on a.id = b.customer_id group by house_or_region