You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
424 B

package utils
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"epur-pay/pkg/logger"
)
func EncodeMD5(value string) string {
m := md5.New()
m.Write([]byte(value))
return hex.EncodeToString(m.Sum(nil))
}
func ToJson(data interface{}) string {
if data == nil {
return ""
}
if e, err := json.Marshal(data); err != nil {
logger.AccessLogger.Warnln(err.Error())
} else {
return string(e)
}
return ""
}