import random
import redis,json
import requests
r = redis.Redis()
import peizhi

def test111():
    list = r.lrange("zhiban",0,-1)
    r.delete('zhiban')
    print(list)
    if not list:
        list = ["张三","李四","王五","赵六","奉七","111"]


        little_list = random.sample(list,2)
        list.remove(little_list[0])
        list.remove(little_list[1])

        # little_list 是值班人员

        r.lpush("zhiban", *list)
    else:
        little_list = random.sample(list, 2)
        list.remove(little_list[0])
        list.remove(little_list[1])

        # little_list 是值班人员

        if list == []:
            pass
        else:
            r.lpush("zhiban", *list)






def demo222():
    ll = ["丙寅","奉龙"]
    phonenum = []
    for i in ll:
        phone = peizhi.Personnel_list_111.get(i)
        phonenum.append(phone)


    dd_url = "https://oapi.dingtalk.com/robot/send?access_token=b2f03936be10b15bd6395a2e567a4c41c0540a9f109c5046a4cdc3f85ac8e374"
    text = "报警周末值班，请查看邮件排查问题"
    json_text = {
        "msgtype": "text",
        "at": {
            "atMobiles": phonenum,
            # 变为true 就会@所有人
            # "isAtAll": False
            "isAtAll": False
        },
        "text": {
            "content": text
        }
    }

    requests.post(url=dd_url, json=json_text, verify=False)


def demo333():
    ll = ["1","2"]
    lll = ["1","2","3","5"]
    lll.remove(ll)
    print(lll)




if __name__ == '__main__':
    demo333()






    # 查出来明天休假开始 后面有多少天
    # 获取到天数
    # 根据天数 获取redis里面的人 如果人数不够 追加一个新列表




