Commit 6efd5a86 authored by rico.liu's avatar rico.liu

update

parent 69fa1067
......@@ -61,6 +61,8 @@ def checkData(check_data):
main_url = df['url'].strip()
source = df['source']
price = df['price']
brand = df['brand']
subcategory = df['subcategory']
print(main_url)
if "jd" in str(main_url):
try:
......@@ -92,9 +94,9 @@ def checkData(check_data):
if "自营" in str(ziying):
name = html.xpath(
"//div[@class='sku-name']/text()")
if ("定制"in str(name)) or ("防弹"in str(name)) or ("射击"in str(name)) or ("订制"in str(name)) or ("卫星"in str(name)) or ("靶"in str(name)) or ("企业定制"in str(name)) or ("军迷"in str(name)) or ("携行具"in str(name)) or ("出版社"in str(name)) or ("书籍"in str(name)):
print("定制/专用类产品暂不通过")
result.append("定制/专用类产品暂不通过")
if ("定制"in str(name)) or ("防弹"in str(name)) or ("射击"in str(name)) or ("订制"in str(name)) or ("卫星"in str(name)) or ("靶"in str(name)) or ("企业定制"in str(name)) or ("军迷"in str(name)) or ("携行具"in str(name)) or ("出版社"in str(name)) or ("书籍"in str(name)) or ("出版社" in str(brand)) or ("书籍" in str(subcategory)):
print("定制/专用/书籍类产品暂不通过")
result.append("定制/专用/书籍类产品暂不通过")
id_all.append(date_id)
sku_list.append(sku)
name_list.append(name)
......@@ -182,9 +184,9 @@ def checkData(check_data):
if len(ziying) == 1:
name = html.xpath(
"//*[@id='gm-prd-main']/div[1]/h1/text()")
if ("定制"in str(name)) or ("防弹"in str(name)) or ("射击"in str(name)) or ("订制"in str(name)) or ("卫星"in str(name)) or ("靶"in str(name)) or ("企业定制"in str(name)) or ("出版社"in str(name)) or ("书籍"in str(name)):
print("定制/专用类产品暂不通过")
result.append("定制/专用类产品暂不通过")
if ("定制"in str(name)) or ("防弹"in str(name)) or ("射击"in str(name)) or ("订制"in str(name)) or ("卫星"in str(name)) or ("靶"in str(name)) or ("企业定制"in str(name)) or ("出版社"in str(name)) or ("书籍"in str(name)) or ("出版社" in str(brand)) or ("书籍" in str(subcategory)):
print("定制/专用/书籍类产品暂不通过")
result.append("定制/专用/书籍类产品暂不通过")
id_all.append(date_id)
sku_list.append(sku)
name_list.append(name)
......@@ -263,9 +265,10 @@ def checkData(check_data):
or ("订制"in str(product_name)) or ("卫星"in str(product_name)) \
or ("靶"in str(product_name)) or ("企业定制"in str(product_name)) \
or ("军迷"in str(product_name)) or ("携行具"in str(product_name)) \
or ("出版社"in str(name)) or ("书籍"in str(name)):
print("定制/专用类产品暂不通过")
result.append("定制/专用类产品暂不通过")
or ("出版社"in str(name)) or ("书籍"in str(name)) \
or ("出版社" in str(brand)) or ("书籍" in str(subcategory)):
print("定制/专用/书籍类产品暂不通过")
result.append("定制/专用/书籍类产品暂不通过")
price_list.append(sn_price)
id_all.append(date_id)
sku_list.append(sku)
......
......@@ -19,15 +19,42 @@ def matchSKU(sku_list,frm):
cursor = conn.cursor()
print('正在删除库中产品状态为6的sku,稍等。。。')#首先将库中错误状态产品的JD/SN/GM的SKU删除
cursor.execute("DELETE from productcode_sku where productcode in (select productcode from info_product where state='6')")
print('正在删除库中重复的SKU,稍等。。。')#需先删除库中重复的SKU,避免匹配相同的编码
cursor.execute("declare OperCursor Cursor for\
SELECT productcode,sku,frm,count(*) ca FROM productcode_sku\
GROUP BY productcode,sku,frm\
HAVING COUNT(*)>1\
open OperCursor\
declare @PRODUCTCODE as nvarchar(20)\
declare @sku as nvarchar(50)\
declare @frm as nvarchar(20)\
declare @ca as int\
declare @return_value as int\
fetch next from OperCursor into @PRODUCTCODE,@sku,@frm,@ca\
IF @@fetch_status=0\
delete from productcode_sku\
where id in (select top (@ca-1) id from productcode_sku\
where productcode=@PRODUCTCODE and sku=@sku and frm=@frm)\
\
while @@fetch_status=0\
begin\
fetch next from OperCursor into @PRODUCTCODE,@sku,@frm,@ca\
IF @@fetch_status=0\
delete from productcode_sku\
where id in (select top (@ca-1) id from productcode_sku\
where productcode=@PRODUCTCODE and sku=@sku and frm=@frm)\
end\
close OperCursor\
deallocate OperCursor")
conn.commit()
print('正在获取当前库中所有sku,请稍等.....')#获取库中所有的SKU,以供检查
try:
get_all_sku = f"select * from productcode_sku where frm in {frm}"
get_all_sku = f"select * from productcode_sku where frm in {frm} and productcode not like '78%' "
cursor.execute(get_all_sku)
data_sku = (cursor.fetchall())
data_sku_file = pd.DataFrame(data_sku,columns=['id','productcode','sku','skuname','createddate','frm'])
except:
get_all_sku = f"select * from productcode_sku where frm='{frm}'"
get_all_sku = f"select * from productcode_sku where frm='{frm}' and productcode not like '78%' "
cursor.execute(get_all_sku)
data_sku = (cursor.fetchall())
data_sku_file = pd.DataFrame(data_sku,columns=['id','productcode','sku','skuname','createddate','frm'])
......
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