A heat recovery variable-frequency multi-connected heat pump system, comprising an outdoor unit and at least two indoor units, wherein the outdoor unit and the indoor units are connected through a high-pressure liquid pipe, a high-pressure gas pipe, and a low-pressure gas return pipe, wherein, the outdoor unit comprises an oil separator, a check valve, a four-way valve, an outdoor heat exchanger, an outdoor electronic expansion valve, a vapor-liquid separator, a first electromagnetic valve, a capillary, a second electromagnetic valve, a third electromagnetic valve, a liquid-side stop valve, a gas-side stop valve, and a discharge line valve, and at least one variable-frequency compressor; an exhaust end of the compressor is connected with an A end of the four-way valve; a B end of the four-way valve is connected with one end of the outdoor heat exchanger, and another end of the outdoor heat exchanger is connected with the a high-pressure liquid pipe through the outdoor electronic expansion valve; a C end of the four-way valve is connected with a suction end of the compressor; a D end of the four-way valve is connected with a low-pressure gas return pipe; the second electromagnetic valve is connected between the high-pressure gas pipe and the low-pressure gas return pipe; and one end of the first electromagnetic valve is connected with the A end of the four-way valve, wherein another end of the first electromagnetic valve is connected between the second electromagnetic valve and the high-pressure gas pipe; each of the indoor units comprises a first indoor heat exchanger, a first electronic expansion valve, a second indoor heat exchanger, and a second electronic expansion valve; and one end of the first indoor heat exchanger is connected with the high-pressure gas pipe, and another end of the first indoor heat exchanger is connected with the high-pressure liquid pipe through the first electronic expansion valve; and one end of the second indoor heat exchanger is connected with the low-pressure gas return pipe, and another end of the second indoor heat exchanger is connected with the high-pressure liquid pipe through the second electronic expansion valve. the outdoor unit comprises an oil separator, a check valve, a four-way valve, an outdoor heat exchanger, an outdoor electronic expansion valve, a vapor-liquid separator, a first electromagnetic valve, a capillary, a second electromagnetic valve, a third electromagnetic valve, a liquid-side stop valve, a gas-side stop valve, and a discharge line valve, and at least one variable-frequency compressor; an exhaust end of the compressor is connected with an A end of the four-way valve; a B end of the four-way valve is connected with one end of the outdoor heat exchanger, and another end of the outdoor heat exchanger is connected with the a high-pressure liquid pipe through the outdoor electronic expansion valve; a C end of the four-way valve is connected with a suction end of the compressor; a D end of the four-way valve is connected with a low-pressure gas return pipe; the second electromagnetic valve is connected between the high-pressure gas pipe and the low-pressure gas return pipe; and one end of the first electromagnetic valve is connected with the A end of the four-way valve, wherein another end of the first electromagnetic valve is connected between the second electromagnetic valve and the high-pressure gas pipe; each of the indoor units comprises a first indoor heat exchanger, a first electronic expansion valve, a second indoor heat exchanger, and a second electronic expansion valve; and one end of the first indoor heat exchanger is connected with the high-pressure gas pipe, and another end of the first indoor heat exchanger is connected with the high-pressure liquid pipe through the first electronic expansion valve; and one end of the second indoor heat exchanger is connected with the low-pressure gas return pipe, and another end of the second indoor heat exchanger is connected with the high-pressure liquid pipe through the second electronic expansion valve.