完成游戏人生账号绑定、解绑、绑定信息的接口开发
This commit is contained in:
19
utility/encrypt/bs4.go
Normal file
19
utility/encrypt/bs4.go
Normal file
@ -0,0 +1,19 @@
|
||||
package encrypt
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
// Base64Encode 对字符串进行 base64 编码
|
||||
func Base64Encode(data []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(data)
|
||||
}
|
||||
|
||||
// Base64Decode 对 base64 编码的字符串进行解码
|
||||
func Base64Decode(encoded string) ([]byte, error) {
|
||||
decodedBytes, err := base64.StdEncoding.DecodeString(encoded)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodedBytes, nil
|
||||
}
|
||||
Reference in New Issue
Block a user