LDM$^2$: A Large Decision Model Imitating Human Cognition with Dynamic Memory Enhancement