A compound of formula, or a deuterated compound, or a pharmaceutically acceptable salt thereof: wherein: R is amino; M is C or N, and when M is N, R 2 is none; R 1 is selected from the group consisting of -H, halogen, hydroxyl, cyano, C 1-4 alkyl (optionally substituted by halogen, hydroxyl, C 1-4 alkoxy, trifluoromethoxyl, mono or di C 1-4 alkylamino), C 1-4 alkoxy (optionally substituted by halogen, hydroxyl, C 1-4 alkoxyl, amino, mono or di C 1-4 alkylamino), amino, mono or di C 1-4 alkylamino, C 1-4 alkylamido, C 3-6 cycloalkylamido, and C 2-4 alkenylamido optionally substituted by mono or di C 1-4 alkylamino; R 2 is selected from -H, or halogen; R 3 is selected from -H, halogen, cyano, an optionally halogenated C 1-4 alkyl, or C 1-4 alkoxy; R 4 is a C 1-4 alkyl or oxyl substituted by a 5- or 6-membered aliphatic heterocyclyl having 1-2 N atoms on the ring, wherein the 5- or 6-membered aliphatic heterocyclyl is optionally substituted by C 1-4 alkyl; each of theheteroaryl, heteroaryl ring is independently and optionally substituted by one or more substituents selected from the group consisting of halogen, oxo, and alkyl; the alkyl is a saturated aliphatic straight or branched alkyl group having 1-6 carbon atoms; the halogen is each independently selected from the group consisting of F, Cl, Br, and I;the heteroaryl or heteroaryl ring is a 5-10 membered aromatic monocyclic or fused bicyclic ring having one or more heteroatoms selected from N, O, and S; the cycloalkyl is a saturated or unsaturated 3-10 membered monocyclic or polycyclic alicyclic ring; the cycloalkylene is a saturated or unsaturated 3-10 membered monocyclic or polycyclic aliphatic cycloalkylene; the heterocyclyl is a saturated or unsaturated 3-10 membered monocyclic or polycyclic aliphatic heterocycle containing one or more heteroatoms selected from N, O, and S; the heterocyclylene is a saturated or unsaturated 3-10 membered monocyclic or polycyclic aliphatic heterocyclylene containing one or more heteroatoms selected from N, O, and S; preferably, the pharmaceutically acceptable salt comprises hydrochloride, methanesulfonate, maleate or the like. R is amino; M is C or N, and when M is N, R 2 is none; R 1 is selected from the group consisting of -H, halogen, hydroxyl, cyano, C 1-4 alkyl (optionally substituted by halogen, hydroxyl, C 1-4 alkoxy, trifluoromethoxyl, mono or di C 1-4 alkylamino), C 1-4 alkoxy (optionally substituted by halogen, hydroxyl, C 1-4 alkoxyl, amino, mono or di C 1-4 alkylamino), amino, mono or di C 1-4 alkylamino, C 1-4 alkylamido, C 3-6 cycloalkylamido, and C 2-4 alkenylamido optionally substituted by mono or di C 1-4 alkylamino; R 2 is selected from -H, or halogen; R 3 is selected from -H, halogen, cyano, an optionally halogenated C 1-4 alkyl, or C 1-4 alkoxy; R 4 is a C 1-4 alkyl or oxyl substituted by a 5- or 6-membered aliphatic heterocyclyl having 1-2 N atoms on the ring, wherein the 5- or 6-membered aliphatic heterocyclyl is optionally substituted by C 1-4 alkyl; each of theheteroaryl, heteroaryl ring is independently and optionally substituted by one or more substituents selected from the group consisting of halogen, oxo, and alkyl; the alkyl is a saturated aliphatic straight or branched alkyl group having 1-6 carbon atoms; the halogen is each independently selected from the group consisting of F, Cl, Br, and I;the heteroaryl or heteroaryl ring is a 5-10 membered aromatic monocyclic or fused bicyclic ring having one or more heteroatoms selected from N, O, and S; the cycloalkyl is a saturated or unsaturated 3-10 membered monocyclic or polycyclic alicyclic ring; the cycloalkylene is a saturated or unsaturated 3-10 membered monocyclic or polycyclic aliphatic cycloalkylene; the heterocyclyl is a saturated or unsaturated 3-10 membered monocyclic or polycyclic aliphatic heterocycle containing one or more heteroatoms selected from N, O, and S; the heterocyclylene is a saturated or unsaturated 3-10 membered monocyclic or polycyclic aliphatic heterocyclylene containing one or more heteroatoms selected from N, O, and S; preferably, the pharmaceutically acceptable salt comprises hydrochloride, methanesulfonate, maleate or the like.