Commit ca42d68d authored by 高雅喆's avatar 高雅喆

第三版的画像,离线更新存储改为redis,之前为gmkv

parent 1605975a
......@@ -118,12 +118,13 @@ def get_user_service_portrait(cl_id, all_word_tags, all_tag_tag_type, all_3tag_2
gm_kv_cli.set(cl_id_portrait_key, tag_id_list_json)
gm_kv_cli.expire(cl_id_portrait_key, time=30 * 24 * 60 * 60)
# 写redis
redis_client = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN9@172.16.40.173:6379')
cl_id_portrait_key2 = "user:service_portrait_tags2:cl_id:" + str(cl_id)
tag_id_list_json2 = json.dumps(gmkv_tag_score2_sum_dict)
gm_kv_cli.set(cl_id_portrait_key2, tag_id_list_json2)
gm_kv_cli.expire(cl_id_portrait_key2, time=30 * 24 * 60 * 60)
redis_client.hmset(cl_id_portrait_key2, gmkv_tag_score2_sum_dict)
redis_client.expire(cl_id_portrait_key2, time=30 * 24 * 60 * 60)
# 写tidb,redis同步
# 写tidb,gmkv同步
stat_date = datetime.datetime.today().strftime('%Y-%m-%d')
replace_sql = """replace into user_service_portrait_tags (stat_date, cl_id, tag_list) values("{stat_date}","{cl_id}","{tag_list}")"""\
.format(stat_date=stat_date, cl_id=cl_id, tag_list=gmkv_tag_score_sum)
......
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