Commit b1700260 by Peng

no message

parent c9653dca
...@@ -173,7 +173,7 @@ class ConnectSpider: ...@@ -173,7 +173,7 @@ class ConnectSpider:
try: try:
table_name = "stock_image_summary_wj" table_name = "stock_image_summary_wj"
# 修改查询语句以匹配你的数据表名称和列名称 # 修改查询语句以匹配你的数据表名称和列名称
query = f"""SELECT account_id,account_secret FROM {table_name} where id = {item_id}""" query = f"""SELECT account_id,account_secret FROM {table_name} where id = {item_id} and state=1"""
print(query) print(query)
df_status = self.db_engine192.read_sql(query) df_status = self.db_engine192.read_sql(query)
if len(df_status) > 0: if len(df_status) > 0:
...@@ -192,7 +192,7 @@ class ConnectSpider: ...@@ -192,7 +192,7 @@ class ConnectSpider:
for i in range(5): for i in range(5):
try: try:
table_name = "stock_image_detail_wj" # 全部下载完成之后删除这个条件 table_name = "stock_image_detail_wj" # 全部下载完成之后删除这个条件
sql_query = f"SELECT image_id FROM {table_name} where created_time>'2025-12-12'" sql_query = f"SELECT image_id FROM {table_name}"
df_status = self.db_engine192.read_sql(sql_query) df_status = self.db_engine192.read_sql(sql_query)
image_id = list(df_status['image_id'].astype(str)) image_id = list(df_status['image_id'].astype(str))
return image_id return image_id
...@@ -206,7 +206,7 @@ class ConnectSpider: ...@@ -206,7 +206,7 @@ class ConnectSpider:
with self.db_engine192.begin() as connection: with self.db_engine192.begin() as connection:
table_name = "stock_image_detail_wj" table_name = "stock_image_detail_wj"
sql_update = f"UPDATE {table_name} SET state = 3 WHERE image_id ='{image_id}' and state = 2" sql_update = f"UPDATE {table_name} SET state = 3 WHERE image_id ='{image_id}' and state = 2"
print(sql_update,'234343434343434343434343434') print(sql_update,'下载完成修改状态为3 .条件为2 的')
connection.execute(sql_update) connection.execute(sql_update)
break break
except Exception as e: except Exception as e:
...@@ -223,8 +223,8 @@ class ConnectSpider: ...@@ -223,8 +223,8 @@ class ConnectSpider:
result_df = self.db_engine192.read_then_update( result_df = self.db_engine192.read_then_update(
select_sql=query, select_sql=query,
update_table=table_name, update_table=table_name,
set_values={"state": 2}, # 把库存清零 set_values={"state": 2}, # 修改状态下载中。状态为2
where_keys=["id"], # WHERE sku = :sku where_keys=["id"]
) )
# print(result_df) # print(result_df)
result_list = result_df.values.tolist() result_list = result_df.values.tolist()
......
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