Based on the ring resonator and microcavity, this paper designs a new method for realizing all-optical logic gates. Firstly, manufacture defects in complete triangular lattice silicon to produce waveguide coupling and linear interference effect. Secondly, the proposed structure was simulated by plane wave expansion method and finite difference time domain method. Finally, view the simulation results and analyze the performance index parameters of the proposed all-optical logic gate in combination with experimental data. The results show that the extinction ratio of the proposed all-optical logic AND gate can reach 8dB, the structure size is small, the response time can reach 2.42ps. At the same time, the value of the proposed all-optical logic OR gate output can reach 0.72, the structure size is small, and the response time can reach 2.41ps. The performance is favorable and meets the experimental requirements.