Provided are a nitrogen-containing heterocyclic compound, a preparation method therefor, and an application in inhibiting kinase activity. The formula of the nitrogen-containing heterocyclic compound is as shown in formula I or formula I, wherein: R1, R2, R3 and R4 are independently selected from any one of hydrogen, a halogen, a cyano group, a hydroxy group, an amino group and a substituted or unsubstituted C1-C6 alkyl group, and any two groups within R1, R2, R3 and R4 may form a 3-10 membered ring system M1, M2 and M3 are independently selected from CRa or N, and at least one of M1, M2 and M3 is N W is selected from a substituted or unsubstituted C1-C6 alkyl group, a substituted or unsubstituted C2-C6 chain alkenyl group, an unsubstituted or halogenated 4-8 membered chain alkynyl group, a substituted or unsubstituted C3-C8 cycloalkyl group, a substituted or unsubstituted 4-8 membered heterocyclyl group, a 5-10 membered aryl group or heteroaryl group, a substituted carbonyl group, a substituted sulfonyl group and a substituted or unsubstituted amino group. The heterocyclic compound may inhibit EGFR mutant kinase activity or ALK kinase activity, and is multi-target tumour treatment drug having an all-new mechanism of action.Linvention concerne un composé hétérocyclique azoté, un procédé de préparation associé, et une application dans linhibition de lactivité kinase. La formule du composé hétérocyclique azoté est telle que représentée dans la formule I ou formule I, dans laquelle : R1, R2, R3 et R4 sont sélectionnés indépendamment parmi lun quelconque : hydrogène, halogène, un groupe cyano, un groupe hydroxy, un groupe amino et un groupe alkyle C1-C6 substitué ou non substitué, et deux groupes quelconques parmi R1, R2, R3 et R4 pouvant former un système cycle à 3-10 chaînons M1, M2 et M3 sont sélectionnés indépendamment entre CRa et N, et M1, et/ou M2 et/ou M3 représentant N W est sélectionné parmi un groupe alkyle C1-C6 substitué ou non substitué, un groupe alcényle