Understanding bitcoin-cli commands walletlock and walletpassphrase
No, use encryptwallet to encrypt the wallet, read this document:

Examples:

Encrypt your wallet


  bitcoin-cli encryptwallet "my pass phrase"


Now set the passphrase to use the wallet, such as for signing or sending bitcoin


  bitcoin-cli walletpassphrase "my pass phrase"


Now we can do something like sign


  bitcoin-cli signmessage "address" "test message"


Now lock the wallet again by removing the passphrase


  bitcoin-cli walletlock