// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package v1 import ( json2 "encoding/json" ) // 替换encoding/json包 type JsonStruct struct { } func (p *JsonStruct)MarshalToString(v interface{}) (string, error) { bytes, err := json2.Marshal(v) return string(bytes), err } func (p *JsonStruct)Marshal(v interface{}) ([]byte, error) { bytes, err := json2.Marshal(v) return bytes, err } func (p *JsonStruct)Unmarshal(bytes []byte, v interface{}) (error) { err := json2.Unmarshal(bytes, v) return err } var json = &JsonStruct{} // Controller type Controller struct { } // NewController return a new controller func NewController() *Controller { return &Controller{} }