Antibiotic residues have become a significant challenge in food safety, threatening both ecosystem integrity and human health. To combat this problem, we developed an innovative photo-powered, self-powered aptasensor that employs a novel carbon-doped three-dimensional graphitic carbon nitride (3D-CN) combined with a metal-organic framework composed of N-doped copper(I) oxide-carbon (Cu2O@C) skeletons. The 3D-CN serves as the photoanode, offering stable photocurrent production due to its three-dimensional open framework structure. The N-doped Cu2O@C acts as the photocathode, providing oxidation protection for the metal core and enhancing light absorption due to its metal-organic framework structure. A key feature of our work is exploiting the Fermi level difference between the n-type photoanode and p-type photocathode, which facilitates faster migration of photogenerated electrons toward the photocathode, thereby enhancing the sensor's self-powered effect. Experimental results reveal that upon aptamer loading, the sensor can linearly detect tetracycline (TC) within a range of 0.5pmol/L to 300nmol/L, with a detection limit as low as 0.13pmol/L. It also demonstrates excellent selectivity, stability, and reproducibility, making it applicable to real samples such as milk and river water. Consequently, our research provides a highly efficient and sensitive method for monitoring TC in food, with significant practical implications and profound impacts on food safety.