The solvothermal reactions via the self-assemble approach produced two new metal-organic compounds, i.e, [Zn(4-cptpy)(HCOO)(H2O)]n·n(DMF) (1) and [Cd3(btc)2(4-cptpyH)(DMF)(H2O)3]n (2) (DMF is N,N’-dimethylformamide, H3btc is benzene-1,3,5-tricarboxylic acid, and 4-Hcptpy is 4-[2,6-bis(pyridine-4-yl)pyridine-4-yl]benzoic acid). Furthermore, the compounds’ luminescent performances have also been studied. As a result, compounds 1-2 show intense luminescence at room temperature. The evaluation of their application values against postoperative infectious endophthalmitis (PIE) was implemented and their specific mechanism was investigated. First of all, the real time reverse transcription-polymerase chain reaction (RT-PCR) was performed and the nuclear factor kappa-B (NF-κb) signaling pathway activation levels were measured. In addition to this, the inflammatory cytokines content released after the cataract surgery was determined through exploiting the enzyme linked immunosorbent assay (ELISA) detection kit.