This commit is contained in:
aozhiwei 2020-10-28 16:59:47 +08:00
parent 933ed5c972
commit f9776ebd7c

View File

@ -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 {