into_workflow_progress=f"update workflow_progress set status_val=3,status='抓取结束' where page='店铺产品' and date_info='{self.year_month.replace('_', '-')}' and site_name='{self.site_name}' and date_type='month'"
into_workflow_progress=f"update workflow_progress set status_val=3,status='抓取结束' where page='店铺产品' and date_info='{self.year_month.replace('_', '-')}' and site_name='{self.site_name}' and date_type='month'"
print(into_workflow_progress)
print(into_workflow_progress)
cursor_us.execute(into_workflow_progress)
cursor_us.execute(into_workflow_progress)
...
@@ -436,7 +436,7 @@ class async_account_name_products(BaseUtils):
...
@@ -436,7 +436,7 @@ class async_account_name_products(BaseUtils):
}
}
try:
try:
requests.post(url=url,data=data,timeout=15)
requests.post(url=url,data=data,timeout=15)
except:
exceptException:
pass
pass
cursor_us.close()
cursor_us.close()
connect_us.close()
connect_us.close()
...
@@ -475,21 +475,21 @@ class async_account_name_products(BaseUtils):
...
@@ -475,21 +475,21 @@ class async_account_name_products(BaseUtils):
self.engine=self.mysql_connect()
self.engine=self.mysql_connect()
sql_read=f'SELECT account_name, id, seller_id FROM {self.db_seller_account_syn} WHERE product_state=1 LIMIT {self.read_size} for update;'
sql_read=f'SELECT account_name, id, seller_id FROM {self.db_seller_account_syn} WHERE product_state=1 LIMIT {self.read_size} for update;'
print(sql_read)
print(sql_read)
self.df_read=self.engine.read_sql(sql_read)
self.df_read=self.engine.read_then_update(
ifself.df_read.shape[0]==0:
select_sql=sql_read,
self.stop_item_queue=False
update_table=f"{self.db_seller_account_syn}",
return[]
set_values={"product_state":2},
withself.engine.begin()asconn:
where_keys=["id"],
self.index_tuple=tuple(self.df_read['id'])
)
iflen(self.index_tuple)==1:
ifself.df_read.shape[0]>0:
sql_update=f"""UPDATE {self.db_seller_account_syn} a set product_state=2 where a.id in ({self.index_tuple[0]})"""
else:
sql_update=f"""UPDATE {self.db_seller_account_syn} a set product_state=2 where a.id in {self.index_tuple}"""