Commit 4f543957 by larosa

add push to mq

parent 45aeadfb
Showing with 27 additions and 2 deletions
......@@ -70,5 +70,30 @@ def post_msg(conf: dict):
# {"goods_id":1170115972487102103,"spu_id":2170115972437912400,"platform":1,"shop_id":1}
def post_jd_is_null(conf: dict):
"""
将 lie_shop_picture中 pdf 为空的 推送到队列中
"""
db = pymysql.connect(host=conf["mysql"]["host"], port=3306, user=conf["mysql"]["user"], password=conf["mysql"]["password"], database=conf["mysql"]["database"])
cursor = db.cursor()
sql = "select spu_id from lie_shop_picture WHERE jd_pdf = '' and spu_id != 0 ORDER BY create_time desc"
cursor.execute(query=sql)
db_result = cursor.fetchall()
for i in range(len(db_result)):
spu_id = db_result[i][0]
platform = 1
shop_id = 2
data = {
"spu_id": spu_id,
"goods_id": 0,
"platform": platform,
"shop_id": shop_id
}
msg_str = json.dumps(data, ensure_ascii=False)
push_mq(msg_str)
if __name__ == '__main__':
post_msg(config_prod)
\ No newline at end of file
post_jd_is_null(config_prod)
\ 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