Pārlūkot izejas kodu

逻辑调整

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 gadi atpakaļ
vecāks
revīzija
a27f4688f9
1 mainītis faili ar 10 papildinājumiem un 7 dzēšanām
  1. 10 7
      report_push.py

+ 10 - 7
report_push.py

@@ -443,6 +443,7 @@ class ReportPush(object):
         customers = self.db.select(self.sql_4, [task_key])
         # a.task_key, a.customer_id, b.customer_type, b.`name`, b.mail, GROUP_CONCAT(c.house_or_brand_id)
         time_range = self.get_time_range(task_key)
+        result['time'] = time_range
         all_time_rang = self.get_time_range(4)
         # 有限时间范围内的数据
         xcx_top_data = self.xcx_top(time_range)
@@ -504,13 +505,15 @@ class ReportPush(object):
             if customer_type == 2:
                 for index, x2 in enumerate(brand_top_data_part):
                     if x2[1] in house_ids or x2[0] in brand_id_list:
-                        result_data_5.append([index, x2[2], x2[3], x2[4], x2[5], x2[5], x2[6]])
+                        result_data_5.append([index, x2[2], x2[3], x2[4], x2[5], x2[6]])
                     pass
                 pass
-            else:
+            elif customer_type == 1:
                 for index, x1 in enumerate(brand_top_data_part):
                     if x1[1] in house_ids:
-                        result_data_5.append([index, x1[2], x1[3], x1[4], x1[5], x1[5], x1[6]])
+                        result_data_5.append([index, x1[2], x1[3], x1[4], x1[5], x1[6]])
+            else:
+                pass
             # 2: 项目数据排行榜
             house_with_brand_data = self.house_with_brand(xcx_top_data_part, brand_top_data_part)
             for index, x in enumerate(house_with_brand_data):
@@ -886,8 +889,8 @@ class ReportPush(object):
         brand_ids = self.db.select(self.sql_8, [house_ids])
         ids = []
         for x in brand_ids:
-            if x:
-               ids.append(x)
+            if x and x[0]:
+               ids.append(x[0])
         return ids
 
     def get_house_ids_by_brand_ids(self, brand_ids):
@@ -923,6 +926,6 @@ class ReportPush(object):
 
 if __name__ == '__main__':
     rp = ReportPush('linshi')
-    sql = "select house_id from t_house_management"
+    sql = "select house_id from mvp_crowd_info limit 10"
     for x in rp.db.select(sql):
-        print(x[0])
+        print(x)