This commit is contained in:
aozhiwei 2020-11-03 17:22:58 +08:00
parent 80edf5bfe5
commit 1e70d9f893

View File

@ -1,10 +1,13 @@
package q5 package q5
import "io" import (
import "strings" "io"
import "crypto/md5" "strings"
import "encoding/hex" "crypto/md5"
import "hash/crc32" "encoding/hex"
"encoding/json"
"hash/crc32"
)
const ( const (
JSON_NONE = 0 JSON_NONE = 0
@ -45,3 +48,11 @@ func JsonStrType(data string) int32 {
} }
} }
} }
func EncodeJson(p interface{}) string {
if jsonBytes, err := json.Marshal(p); err == nil {
return string(jsonBytes)
} else {
return ""
}
}