The existing cycle-slip detection algorithm usually can not detect and repair cycle-slips correctly in the ionospheric activity phase or when magnetic storms happen, this paper proposes a new algorithm for the fitted residual of the ionospheric total electronic content(TEC) rate (TECR) based on data quality analysis. By analyzing the data quality of the fitted TECR residual, we determine the optimal fitted epoch count adaptively and with this fitted epochs count can obtain a fitted TECR to weaken the influence of ionospheric error effectively. In order to ensure that the repaired cycle-slip is correct, the repaired value is validated by search re-determination and TECR complementary detection. Measured data is used to validated this algorithm. The experimental results show that this algorithm can realize the zero-difference dynamic real-time cycle-slip detection and repair the ionospheric activity phase.