add ResponseErr
This commit is contained in:
parent
1e70d9f893
commit
56027b3c56
@ -54,6 +54,13 @@ func ResponseOk(w* http.ResponseWriter) {
|
||||
(*w).Write([]byte(`{"errcode":0, "errmsg":""}`))
|
||||
}
|
||||
|
||||
func ResponseErr(w* http.ResponseWriter, errCode int32, errMsg string) {
|
||||
respObj := NewMxoObject()
|
||||
respObj.SetXValue("errcode", NewXInt32(errCode))
|
||||
respObj.SetXValue("errmsg", NewXString(errMsg))
|
||||
Response(w, respObj.ToJsonStr())
|
||||
}
|
||||
|
||||
func ResponseInt32Ok(w* http.ResponseWriter, key string, val int32) {
|
||||
(*w).Write([]byte(fmt.Sprintf(`{"errcode":0, "errmsg":"", "%s":%d}`, key, val)))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user