import redis

r = redis.Redis(host="114.115.236.206", port=6379, password='clbzzsn',db=3)
# 获取所有键
# keys = r.keys('*')
# # print(keys)
# for key in keys:
#     f_key = key.decode()
#     print(f_key)
    # print("----------")
    # r.srem(f_key,'[]')
    # r.srem(f_key,'')
def check_date(com_code,info_date):
    r = redis.Redis(host="114.115.236.206", port=6379, password='clbzzsn', db=3)
    res = r.sismember('com_caiwushuju_code::'+com_code, info_date)  # 注意是 保存set的方式
    if res:
        return True
    else:
        return False

def add_date():
    date_list = ['2023-06-30']
    r = redis.Redis(host="114.115.236.206", port=6379, password='clbzzsn',db=3)
    #遍历date_list 放入redis
    for date in date_list:
        res = r.sadd('com_caiwushuju_code::'+'123456',date)
# check_date('sh601398','2023-03-31')
add_date()
