Commit 3d40e543 authored by rico.liu's avatar rico.liu

update

parent 93863ce1
......@@ -39,6 +39,10 @@ def checkData(check_data):
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'}
session = requests.Session()
if check_data.empty:
print('今日无新增数据')
return check_data
print('共'+str(len(check_data))+'条数据待审核')
result = []
......
......@@ -26,7 +26,6 @@ def initAPIData(base_frm):
conn = pymssql.connect(host='123.56.115.207', user='zgcprice3311',password='admin@2018@)!*',database= f'{base_frm}',autocommit=True)
cursor = conn.cursor()
source = base_frm.replace('_','').replace('ZH','')
if source == 'JD':
......@@ -61,10 +60,13 @@ def initAPIData(base_frm):
#筛选出待审核的数据
cursor.execute("select id,sku,name,url,source,price from product_all where ziying is null and productcode is null")
data = (cursor.fetchall())
check_data = pd.DataFrame(data,columns= ['id','sku','name','url','source','price'])
check_data_ = pd.DataFrame(data,columns= ['id','sku','name','url','source','price'])
#审核三大电商数据
check_data = checkData(check_data)
check_data = checkData(check_data_)
if check_data.empty:
return False
id_pass = []
id_no_ziying = []
......@@ -131,7 +133,7 @@ def initAPIData(base_frm):
print('完成')
print('数据初始化处理完成')
return None
return True
else:
......@@ -140,6 +142,10 @@ def initAPIData(base_frm):
data = (cursor.fetchall())
sku_list = pd.DataFrame(data,columns= ['sku'])['sku'].tolist()
if len(sku_list) == 0:
print('今日无新增数据')
return False
sku_check = matchSKU(sku_list,source)
print('sku排重中')
for k,v in sku_check.items():
......@@ -161,11 +167,11 @@ def initAPIData(base_frm):
conn.commit()
print('数据初始化处理完成')
return None
return True
if __name__ == "__main__":
initAPIData('ZH_SN')
if initAPIData('ZH_SN'):
data_api = data_fetch(model='LXWL_model',localhost=False,source='ZH_SN')
data_api_table = data_api.run()
\ No newline at end of file
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