Real-time automatic detection of solar flares is crucial for space weather operational forecasting. However, traditional rule-based flare detection algorithms face challenges including complex background noise interference and difficulties in identifying nested events during the solar maximum period. To address these issues,this study designs an improved physical threshold detection algorithm. Using X-ray flux data from the GOES series satellites, a dual-channel trigger model of "fast-rising" and "slow-rising" is developed to adapt to the morphological differences between short-duration pulse-type flares and long-duration gradual flares during the rising phase.Additionally, a nested event segmentation mechanism is introduced to accurately identify secondary flares during the decay phase of the previous flare. In this study, an automatic flare recognition algorithm was developed using X-ray flux data from May 2024 and its performance was verified with data from 2025. The results show that the algorithm achieved a complete detection for X-class flares, with an F1 score of 0.969 and a precision of 97.3% for M-class flares. In terms of flare timing determination, the mean absolute errors(MAE) for start time,end time,and duration were approximately 2.3 min, 2.2 min and 4.3min,respectively.This algorithm is based on pure time series morphological analysis, has strong physical interpretability, and requires extremely low computational resources. It can meet the low-power deployment requirements of on-board processors or edge computing devices, thereby providing an effective monitoring tool for flare operational forecasting.