diff --git a/sysutils.go b/sysutils.go index 5872d87..8ac0788 100644 --- a/sysutils.go +++ b/sysutils.go @@ -3,6 +3,7 @@ package q5 import ( "os" "net" + "fmt" "net/http" "time" "io/ioutil" @@ -45,6 +46,14 @@ func Request(r *http.Request, name string) *XValue { return NewXString("") } +func ResponseOk(w http.ResponseWriter) { + w.Write([]byte(`{"errcode":0, "errmsg":""}`)) +} + +func ResponseInt32Ok(w http.ResponseWriter, key string, val int32) { + w.Write([]byte(fmt.Sprintf(`{"errcode":0, "errmsg":"", "%s":%d}`, key, val))) +} + func GetPostBody(r *http.Request) *XValue { body, err := ioutil.ReadAll(r.Body) if err != nil {