Commit b55f357c by 岳巧源

add py

parent 71b0cc1f
Showing with 27 additions and 16 deletions
......@@ -3,8 +3,8 @@ create table lie_shop_picture (
spu_id bigint(19) unsigned default 0 not null comment 'SPUID',
sku_id bigint(19) unsigned default 0 not null comment 'SKUID',
class_id smallint unsigned default 0 not null comment '猎芯分类id',
lie_pic_url varchar(100) default '' not null comment '猎芯图片链接',
jd_pic_url varchar(100) default '' not null comment '京东图片链接',
lie_pic_url varchar(255) default '' not null comment '猎芯图片链接',
jd_pic_url varchar(255) default '' not null comment '京东图片链接',
shop_type smallint(1) unsigned default 0 not null comment '店铺类型 1-pop 2-vc',
state smallint(1) unsigned default 0 not null comment '图片状态 图片状态,0-未审核,1-审核通过(默认),2-审核不通过,3-图片空间逻辑删除,4-图片服务器逻辑删除,5-图片服务器物理删除,6-图片空间永久删除',
create_time int(10) unsigned default 0 not null comment '创建时间',
......
......@@ -27,7 +27,18 @@ config_dev = {
}
config_prod = {
"mysql": {
"host": "bigdata2.ichunt.db",
"port": 3306,
"user": "DsbuUx",
"password": "sfj09JjsfpQx0",
"database": "liexin_data_distribution"
},
"redis": {
"host": "172.18.137.38",
"port": 6379,
"password": "icDb29mLy2s"
}
}
......@@ -205,17 +216,17 @@ def update_ext_attr_by_class_ids(conf: dict):
print("暂时未兼容此种类型的拓展属性 input_type: " + str(input_type))
# 检查此分类的此拓展属性在 db 中是否已存在,未存在则 insert, 存在则 update
check_sql = "select id from lie_shop_attr where class_id = %s and attr_id = %s"
cursor.execute(query=check_sql, args=(class_id, attr_id,))
db_result = cursor.fetchall()
if len(db_result) == 0:
# 不存在时
insert_sql = "insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
cursor.execute(query=insert_sql, args=(class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time,))
db.commit()
print(insert_sql % (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time))
else:
update_sql = ""
# check_sql = "select id from lie_shop_attr where class_id = %s and attr_id = %s"
# cursor.execute(query=check_sql, args=(class_id, attr_id,))
# db_result = cursor.fetchall()
# if len(db_result) == 0:
# # 不存在时
# insert_sql = "insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
# cursor.execute(query=insert_sql, args=(class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time,))
# db.commit()
# print(insert_sql % (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time))
# else:
# update_sql = ""
insert_ext_attr_to_redis(class_attr_mapping, conf)
......@@ -264,4 +275,4 @@ if __name__ == '__main__':
elif environment == "prod":
config = config_prod
# update_jd_attr_by_class(conf=config)
# update_ext_attr_by_class_ids(conf=config)
\ No newline at end of file
update_ext_attr_by_class_ids(conf=config)
\ 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 sign in to comment