Browse Source

处理集团邮件正文格式化问题

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 4 năm trước cách đây
mục cha
commit
e040cc6584
3 tập tin đã thay đổi với 17 bổ sung6 xóa
  1. 5 4
      jianye_report.py
  2. 1 1
      mail_content_text.py
  3. 11 1
      report_public_funs_utils.py

+ 5 - 4
jianye_report.py

@@ -32,8 +32,8 @@ class JianYeReport(object):
     sheet_names_1 = ['当日数据', '当月数据', '上线以来所有数据']
 
     def __init__(self):
-        self.db = MysqlDB('bi_report')
-
+        #self.db = MysqlDB('bi_report')
+        pass
     def get_city_house_id(self):
         return self.db.select(Sql.sql_1)
 
@@ -326,9 +326,10 @@ class JianYeReport(object):
 
     def get_brand_content(self, content, brand_table_one):
 
-        content = content.format(brand_table_one[0], brand_table_one[1], brand_table_one[2], brand_table_one[3],
+        content = content.format(rpfu.get_montho_day(),
+            brand_table_one[0], brand_table_one[1], brand_table_one[2], brand_table_one[3],
                                  brand_table_one[4], brand_table_one[5],
-                                 brand_table_one[6], brand_table_one[8], brand_table_one[10], brand_table_one[11],
+                                 brand_table_one[6], brand_table_one[8], brand_table_one[10], brand_table_one[11], rpfu.get_month(),
                                  brand_table_one[12], brand_table_one[13], brand_table_one[14], brand_table_one[15],
                                  brand_table_one[16],
                                  brand_table_one[17],

+ 1 - 1
mail_content_text.py

@@ -9,7 +9,7 @@ class MailContentText(object):
         <title>elab数据报表推送服务</title>
         </head>
         <body>
-            <h4 style="font-family: 'Microsoft YaHei UI'; font-size: 20px"><b>集团{}月{}日数据概览</b></h4>
+            <h4 style="font-family: 'Microsoft YaHei UI'; font-size: 20px"><b>集团{}数据概览</b></h4>
             <ul style="font-family: 'Microsoft YaHei UI'; font-size: 20px">
                  <li>总浏览量:{},总浏览人数: {}</li>
                  <li>新增获客: {}, 新增获电: {}</li>

+ 11 - 1
report_public_funs_utils.py

@@ -44,6 +44,16 @@ class ReportPublicFunsUtils:
         day = now.day - 1
         return '{}月{}日'.format(month, day)
 
+    @staticmethod
+    def get_month():
+        now = datetime.datetime.now()
+        return str(now.month)
+
+    @staticmethod
+    def get_pre_day():
+        now = datetime.datetime.now()
+        return str(now.day - 1)
+
     @staticmethod
     def add(a=None, b=None):
         """
@@ -62,4 +72,4 @@ class ReportPublicFunsUtils:
 
 
 if __name__ == '__main__':
-    print(ReportPublicFunsUtils.get_prd_day())
+    print(ReportPublicFunsUtils.get_month())