123456789101112131415161718 |
- from libs.db_mysql import DbMysql
- class MysqlDyLiveCommodity(DbMysql):
- table = 'douyin_live_commodity_'
- # 获取直播数据
- def get_goods_info(self, room_id, product_id, pix):
- sql = 'SELECT id,sold_out_at,revise_price,created_at FROM ' + self.table + pix + ' WHERE `room_id`=%s and `product_id`=%s LIMIT 1'
- try:
- # 执行SQL
- self.cursor.execute(sql, [room_id, product_id])
- return self.cursor.fetchone()
- finally:
- self.db.commit() # 提交
- self.cursor.close() # 关闭cursor
- self.db.close() # 关闭db连接
|