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):
if category in computer_cat:
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:
pass
else:
cpu = cpu.split('-')[0]
cpu_attr_list.append(cpu)
new_df['CPU属性'] = cpu_attr_list
else:
continue
......@@ -1463,7 +1464,10 @@ def create_to_db(path,std_value_dict):
continue
else:
name += " "
name += str(row[spu_param])
try:
name += str(tuple(std_value_dict[id_][spu_param])[0])
except:
name += str(row[spu_param])
name = name + " " +str(row['zi_subcategoryname'])#spu名称
......
......@@ -1332,7 +1332,7 @@ def create_to_db(path,std_value_dict):
new_df_combine_list = list()
for category in point_category_list:
try:
point_category = category.replace('/','_')
cat_df = pd.read_excel(path,sheetname = f"{point_category}参数数据",converters = {'productcode':str})
......@@ -1378,7 +1378,8 @@ def create_to_db(path,std_value_dict):
id_ = int(row['id'])
skuname = ''
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]
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):
if category in computer_cat:
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:
pass
else:
cpu = cpu.split('-')[0]
cpu_attr_list.append(cpu)
new_df['CPU属性'] = cpu_attr_list
else:
continue
......@@ -1604,7 +1606,10 @@ def create_to_db(path,std_value_dict):
continue
else:
name += " "
name += str(row[spu_param])
try:
name += str(tuple(std_value_dict[id_][spu_param])[0])
except:
name += str(row[spu_param])
name = name + " " +str(row['zi_subcategoryname'])#spu名称
new_name_2 = name.replace("'","''")
......@@ -1870,7 +1875,7 @@ def price_to_db(batch, channel_alias):
sku_list = df['productcode'].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()
channelId_list = [sup_en2code_dict[ele] for ele in df['channel_alias'].tolist()]
......@@ -2122,7 +2127,7 @@ def get_data_all():
mssql = MSSQL('123.57.45.119','ZI_Service')
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()
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