Commit 44fc82f9 by lichenggang

update

parent e4b0ddd3
......@@ -4,7 +4,7 @@ url = 'https://hk.element14.com/browse-for-products'
# url='http://httpbin.org/ip'
a = Module_Base()
headers = {
"authority": "cn.element14.com",
"authority": "hk.element14.com",
"method": "GET",
"path": "/browse-for-products",
"scheme": "https",
......@@ -12,7 +12,7 @@ headers = {
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9",
"cache-control": "max-age=0",
"referer": "https://cn.element14.com/",
"referer": "https://hk.element14.com/",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
}
......@@ -40,5 +40,5 @@ for content_dom in content_sections:
level2['level'] = 2
level2['islast'] = 1
level1['level2_list'].append(level2)
# print('二级分类',level2['cat_name'])
print('二级分类',level2['cat_name'])
levels.append(level1)
......@@ -20,10 +20,10 @@ class Updater():
def update(self, cat_id, url, islast, level, parent_id=0,is_show=1):
with self.operator.db.cursor() as cursor:
sql = 'UPDATE lie_category SET url=%s,islast=%s,level=%s,is_show=%s, parent_id=%s where cat_id=%s'
data=(url,islast, level, is_show,cat_id,parent_id)
data=(url,islast, level, is_show,parent_id,cat_id)
cursor.execute(sql, data)
def insert(self, cat_name, url, islast, level, parent_id=0, is_show=1, sort_order=50, page_count=1):
def insert(self, cat_name, url, islast, level, parent_id=0, is_show=1 , sort_order=50, page_count=1):
with self.operator.db.cursor() as cursor:
sql = 'INSERT into lie_category(cat_name,parent_id,sort_order,is_show,url,islast,level,page_count) values' \
......@@ -54,3 +54,11 @@ class Updater():
pass #TODO 增加三级分类
self.operator.db.commit()
# if __name__ == '__main__':
# uper = MySqlOperator('element14')
#
# with uper.db.cursor() as cursor:
# sql = 'UPDATE lie_category SET url=%s,islast=%s,level=%s,is_show=%s, parent_id=%s where cat_id=%s'
# cursor.execute(sql,('https://hk.element14.com/c/test-measurement/spectrometers',1,2,1,2379,'2391'))
# uper.db.commit()
\ No newline at end of file
......@@ -566,24 +566,3 @@ class MySqlOperator(object):
self.db.commit()
if __name__ == '__main__':
# pass
d = MySqlOperator('chip1stop')
with d.db.cursor() as cursor:
sql = "SELECT goods_id FROM lie_goods WHERE goods_name=%s and goods_name_style=%s"
cursor.execute(sql, ('AD976AR', 'AD01-0000139'))
result = cursor.fetchone()
result = result[0] if result else None
print(result)
# print(d.get_ext_id_by_goods_id_attr_name(18000500790, 'Product Category'))
# data = (('SO180219037', '蔡**', '19**62A', 1519055525, '2018-02-19 23:52:05', 100, '已付3', '好好', '待取货3', 1519055525,
# 2519055525),
# ('SO180219035', '蔡**', '19**62A', 1519055525, '2018-02-19 23:52:05', 100, '衣付3', '好好', '待取货3', 1519055525,
# 2519055525))
# d.insert_lcsz_order_list(data)
# data1 = (
# ('SO180219034_3', 'SO180219037', '91383', '4.7nH ±0.3nH 编带', '高频电感', '0402', 500, 0.019, 0.0118, 1519055525),
# ('SO180219034_4', 'SO180219037', '91383', '4.7nH ±0.3nH 编带', '高频电感', '0402', 500, 0.019, 0.0118, 1519055525),
# )
# d.insert_lcsz_order_details(data1)
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 sign in to comment