sql_ZIdatabase.cursor.execute(f"select SubTitle from VW_Relation_Property where SubCategoryCode='{categorycode}' and (Isimportant = '1' or Ispeijian = '1')")
sql_ZIdatabase.cursor.execute(f"select SubTitle from VW_Relation_Property where SubCategoryCode='{categorycode}' and (Isimportant = '1' or Ispeijian = '1')")
sql_zi_zh.cursor(f"insert into filestep(period,step,initfilename,filepath) values('{StyleTime}','3','{self.source}_data_category_data_{StyleTime}.xlsx','/root/program/newProductCheck/online_progrom/code/data/{StyleTime}_step3_needs_check')")#存入数据库,页面获取下载。
sql_zi_zh.cursor(f"insert into filestep(period,step,initfilename,filepath) values('{StyleTime}','3','{self.source}_data_category_data_{StyleTime}.xlsx','/root/program/newProductCheck/online_progrom/code/data/{StyleTime}_step3_needs_check')")#存入数据库,页面获取下载。
returndata_table
returndata_table
'''
class myThread_crawl(threading.Thread):
class myThread_crawl(threading.Thread):
def __init__(self, channel):
def __init__(self, channel):
threading.Thread.__init__(self)
threading.Thread.__init__(self)
...
@@ -605,6 +649,23 @@ class myThread_crawl(threading.Thread):
...
@@ -605,6 +649,23 @@ class myThread_crawl(threading.Thread):
self.sql_crawl.cursor.execute(f"select product_id from product_all where productcode is null and state='1' and (ziying='1' or ziying is null) and (dingzhi='1' or ziying is null) and source='{self.channel}'")
self.sql_crawl.cursor.execute(f"select product_id,sku from product_all where productcode is null and state='1' and (ziying='1' or ziying is null) and (dingzhi='1' or ziying is null) and source='{self.channel}'")
else:
else:
self.sql_crawl.cursor.execute(f"select product_id from product_all where productcode is null and state='1' and (ziying='1' or ziying is null) and (dingzhi='1' or ziying is null) and (source <> 'JD' and source <> 'GM' and source <>'SN')")
self.sql_crawl.cursor.execute(f"select product_id,sku from product_all where productcode is null and state='1' and (ziying='1' or ziying is null) and (dingzhi='1' or ziying is null) and (source <> 'JD' and source <> 'GM' and source <>'SN')")
sku_data=self.sql_crawl.cursor.fetchall()
sku_data=self.sql_crawl.cursor.fetchall()
product_id_list=[]
sku_list=[]
sku_list=[]
forskuinsku_data:
forelementinsku_data:
sku=sku[0]
product_id=element[0]
sku=element[1]
product_id_list.append(product_id)
sku_list.append(sku)
sku_list.append(sku)
sku_set=list(set(sku_list))
returnsku_set
returnproduct_id_list,sku_list
defget_data_crawl(self,product_id):
defget_data_crawl(self,product_id):
self.sql_crawl.cursor.execute(f"select channel_sku,brand,product_name,channel_product_classify,create_time,channel_id,id,channel_product_id from product where product_id='{product_id}'")
self.sql_crawl.cursor.execute(f"select channel_sku,brand,product_name,channel_product_classify,create_time,channel_id,id,channel_product_id from product where product_id='{product_id}'")
...
@@ -963,11 +1044,16 @@ class crawl_data_fetch():
...
@@ -963,11 +1044,16 @@ class crawl_data_fetch():
returndata
returndata
defrun(self):
defrun(self):
sku_list=self.get_crawl_sku()
product_id_list,sku_list=self.get_crawl_sku()
data_dict={}
data_dict={}
foriinrange(len(sku_list)):
foriinrange(len(sku_list)):
try:
try:
data=self.get_data_crawl(sku_list[i])
sku=sku_list[i]
self.sql_crawl.cursor.execute(f"select count(sku) from product_all where sku='{sku}'")