A five-and-six-membered heterocyclic compound as represented by general formula I, pharmaceutically acceptable salt, metabolite, metabolic precursors or drug precursors thereof, preparation method, pharmaceutical composition, and use thereof the five-and-six-membered heterocyclic compound has activity as a Janus kinase (JAK) inhibitor, and can be used to prepare drugs for treating diseases caused by the abnormal activity of kinase, such as cell proliferation diseases like cancer.