Commit 90e3a5bb by Aeolus

update

parent 3caa622f
...@@ -314,7 +314,9 @@ def run_month_bill(): ...@@ -314,7 +314,9 @@ def run_month_bill():
left join business on business.id = rent.business_id left join business on business.id = rent.business_id
""" """
where_sql = " WHERE 0=0 " now = datetime.datetime.now().date()
this_month_start = datetime.datetime(now.year, now.month, 1)
where_sql = " WHERE 0=0 and rent.created_at < '{}'".format(this_month_start.strftime("%Y-%m-%d %H:%M:%S"))
if start_date is not None: if start_date is not None:
where_sql += " and rent.created_at > '{}'".format(start_date) where_sql += " and rent.created_at > '{}'".format(start_date)
...@@ -329,7 +331,7 @@ def run_month_bill(): ...@@ -329,7 +331,7 @@ def run_month_bill():
where_sql += """ and admin_business.user_id = '{}' and admin_business.status = 1 and admin_business.rate > 0 where_sql += """ and admin_business.user_id = '{}' and admin_business.status = 1 and admin_business.rate > 0
""".format(g.user.id) """.format(g.user.id)
group_sql = " group by MONTH(rent.created_at), rent.business_id " group_sql = """ group by DATE_FORMAT(rent.created_at,"%Y-%m") , rent.business_id """
order_sql = " ORDER BY rent.created_at DESC, rent.created_at desc" order_sql = " ORDER BY rent.created_at DESC, rent.created_at desc"
limit_sql = " LIMIT {offset} , {page_size}".format(offset=(page - 1) * page_size, page_size=page_size) limit_sql = " LIMIT {offset} , {page_size}".format(offset=(page - 1) * page_size, page_size=page_size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment