A Method for Enhancing the Safety of Large Model Generation Based on Multi-dimensional Attack and Defense