package utils import ( "crypto/md5" "gd_gateway/common.in/jsonrpc2" "encoding/hex" "encoding/json" "fmt" "strings" "time" ) func GetUniqueLogID(cmd string) string { return fmt.Sprintf("%d_%s", time.Now().Unix(), cmd) } // 获取args对应的json字符串 func MarshalJsonString(args ...interface{}) (result string) { if len(args) > 0 { if r, err := json.Marshal(args); err == nil { result = string(r) } } return } func MD5(text string) string { h := md5.New() h.Write([]byte(text)) return hex.EncodeToString(h.Sum(nil)) } func CheckPlateCity(plateNo, filter string) error { citys := strings.Split(filter, ",") for _, city := range citys { if strings.HasPrefix(plateNo, city) { return nil } } return jsonrpc2.NewJsonError(20004, "参数错误,不支持该省份") }