Browse Source

文件路径修改

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 4 years ago
parent
commit
b612b76410
2 changed files with 5 additions and 3 deletions
  1. 3 1
      flask_app.py
  2. 2 2
      jianye_report.py

+ 3 - 1
flask_app.py

@@ -238,7 +238,9 @@ def report_test():
 @app.route('/report_jianye', methods=['GET', 'POST'])
 def report_jianye():
     report_jianye = JianYeReport()
-    result = report_jianye.send_mail_to_customer(5)
+    task_id = request.args.get('id', default=0, type=int)
+    result = report_jianye.send_mail_to_customer(task_id)
+    report_jianye.db.close()
     return json.dumps(result, ensure_ascii=False, cls=DecimalEncoder)
 
 

+ 2 - 2
jianye_report.py

@@ -49,7 +49,7 @@ class JianYeReport(object):
         """
         month_day = rpfu.get_montho_day()
         if type == 1:
-            return '[{}]{}数据报表_{}'.format(month_day, region_name,name)
+            return '[{}]{}数据报表_{}'.format(month_day, region_name, name)
         elif type == 2:
             return '[{}]建业云集团数据报表_{}'.format(month_day, name)
         elif type == 3:
@@ -243,7 +243,7 @@ class JianYeReport(object):
                 region_name = customer[4]
                 title = self.get_mail_title(customer_type, region_name, name)
                 content = self.get_mail_content(customer_type)
-                file_path = save_path + '/' + title
+                file_path = save_path + '/' + title + '.xlsx'
                 if customer_type == 2:
                     # 集团
                     table_1 = self.brand_data()