| 1234567891011121314151617181920212223242526272829303132333435 |
- from tw.config import conn, table
- def clear_orders():
- sqls = [
- 'DELETE FROM {}'.format(table('store_order_batch')),
- 'DELETE FROM {}'.format(table('store_order')),
- 'DELETE FROM {}'.format(table('store_order_cart_info')),
- 'DELETE FROM {}'.format(table('store_order_status')),
- 'DELETE FROM {}'.format(table('user_bill')),
- ]
- with conn:
- with conn.cursor() as cs:
- try:
- for sql in sqls:
- print(sql)
- cs.execute(sql)
- conn.commit()
- except Exception as e:
- print(e)
- def remove_order(orderId:list) -> bool:
- sql1 = ''' DELETE FROM {} WHERE id={}'''.format(table('store_order'), orderId)
- sql2 = ''' DELETE FROM {} WHERE oid={}'''.format(table('store_order_cart_info'), orderId)
- sql3 = ''' DELETE FROM {} WHERE oid={}'''.format(table('store_status'), orderId)
- def remove_porder(porder):
- pass
- if __name__ == '__main__':
- clear_orders()
|