Commit 693e034b authored by rico.liu's avatar rico.liu

update

parent b64173e6
...@@ -1415,16 +1415,17 @@ def create_to_db(path,std_value_dict): ...@@ -1415,16 +1415,17 @@ def create_to_db(path,std_value_dict):
if category in computer_cat: if category in computer_cat:
cpu_attr_list = [] cpu_attr_list = []
for cpu in new_df['CPU型号'].tolist():
for index,row in df.iterrows():
cpu = tuple(std_value_dict[int(row['id'])]['CPU型号'])[0]
if '飞腾' in cpu or '龙芯' in cpu or '兆芯' in cpu: if '飞腾' in cpu or '龙芯' in cpu or '兆芯' in cpu:
pass pass
else: else:
cpu = cpu.split('-')[0] cpu = cpu.split('-')[0]
cpu_attr_list.append(cpu) cpu_attr_list.append(cpu)
new_df['CPU属性'] = cpu_attr_list new_df['CPU属性'] = cpu_attr_list
else: else:
continue continue
...@@ -1463,6 +1464,9 @@ def create_to_db(path,std_value_dict): ...@@ -1463,6 +1464,9 @@ def create_to_db(path,std_value_dict):
continue continue
else: else:
name += " " name += " "
try:
name += str(tuple(std_value_dict[id_][spu_param])[0])
except:
name += str(row[spu_param]) name += str(row[spu_param])
name = name + " " +str(row['zi_subcategoryname'])#spu名称 name = name + " " +str(row['zi_subcategoryname'])#spu名称
......
...@@ -1378,7 +1378,8 @@ def create_to_db(path,std_value_dict): ...@@ -1378,7 +1378,8 @@ def create_to_db(path,std_value_dict):
id_ = int(row['id']) id_ = int(row['id'])
skuname = '' skuname = ''
brandname = row['zi_brandname'] brandname = row['zi_brandname']
cursor_zi_new.execute(f"select id from p_brand where name = '{brandname}' and id not in (select distinct pid from p_brand)") #cursor_zi_new.execute(f"select id from p_brand where name = '{brandname}' and id not in (select distinct pid from p_brand)")
cursor_zi_new.execute(f"select id from p_brand where name = '{brandname}'")
brand_code = cursor_zi_new.fetchone()[0] brand_code = cursor_zi_new.fetchone()[0]
cursor_zi_new.execute(f"select pid from p_brand where id = {brand_code}") cursor_zi_new.execute(f"select pid from p_brand where id = {brand_code}")
...@@ -1556,16 +1557,17 @@ def create_to_db(path,std_value_dict): ...@@ -1556,16 +1557,17 @@ def create_to_db(path,std_value_dict):
if category in computer_cat: if category in computer_cat:
cpu_attr_list = [] cpu_attr_list = []
for cpu in new_df['CPU型号'].tolist():
for index,row in df.iterrows():
cpu = tuple(std_value_dict[int(row['id'])]['CPU型号'])[0]
if '飞腾' in cpu or '龙芯' in cpu or '兆芯' in cpu: if '飞腾' in cpu or '龙芯' in cpu or '兆芯' in cpu:
pass pass
else: else:
cpu = cpu.split('-')[0] cpu = cpu.split('-')[0]
cpu_attr_list.append(cpu) cpu_attr_list.append(cpu)
new_df['CPU属性'] = cpu_attr_list new_df['CPU属性'] = cpu_attr_list
else: else:
continue continue
...@@ -1604,6 +1606,9 @@ def create_to_db(path,std_value_dict): ...@@ -1604,6 +1606,9 @@ def create_to_db(path,std_value_dict):
continue continue
else: else:
name += " " name += " "
try:
name += str(tuple(std_value_dict[id_][spu_param])[0])
except:
name += str(row[spu_param]) name += str(row[spu_param])
name = name + " " +str(row['zi_subcategoryname'])#spu名称 name = name + " " +str(row['zi_subcategoryname'])#spu名称
...@@ -1870,7 +1875,7 @@ def price_to_db(batch, channel_alias): ...@@ -1870,7 +1875,7 @@ def price_to_db(batch, channel_alias):
sku_list = df['productcode'].tolist() sku_list = df['productcode'].tolist()
source_name_list = df['name'].replace("'","''").tolist() source_name_list = df['name'].replace("'","''").tolist()
price_list = df['url_price'].replace("['","").replace("']","").tolist() price_list = df['price'].replace("['","").replace("']","").tolist()
url_list = df['url'].replace("['","").replace("']","").tolist() url_list = df['url'].replace("['","").replace("']","").tolist()
channelId_list = [sup_en2code_dict[ele] for ele in df['channel_alias'].tolist()] channelId_list = [sup_en2code_dict[ele] for ele in df['channel_alias'].tolist()]
...@@ -2122,7 +2127,7 @@ def get_data_all(): ...@@ -2122,7 +2127,7 @@ def get_data_all():
mssql = MSSQL('123.57.45.119','ZI_Service') mssql = MSSQL('123.57.45.119','ZI_Service')
cursor_zi_service = mssql._cur cursor_zi_service = mssql._cur
cursor_zi_service.execute(f"select * from product_all where state = '9' and (cal_price is Null or new_name is Null)") cursor_zi_service.execute(f"select id,productcode from product_all where state = '9' and (cal_price is Null or new_name is Null)")
data = cursor_zi_service.fetchall() data = cursor_zi_service.fetchall()
df = pd.DataFrame(data, columns=[tuple[0] for tuple in cursor_zi_service.description]) df = pd.DataFrame(data, columns=[tuple[0] for tuple in cursor_zi_service.description])
......
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