1
This commit is contained in:
parent
0644461bc7
commit
7bffd9a638
21
sysutils.go
21
sysutils.go
@ -6,8 +6,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
//"io/ioutil"
|
"io/ioutil"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetDaySeconds(seconds int64, timeZone int64) int64 {
|
func GetDaySeconds(seconds int64, timeZone int64) int64 {
|
||||||
@ -54,26 +55,24 @@ func ResponseOk(w* http.ResponseWriter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ResponseErr(w* http.ResponseWriter, errCode int32, errMsg string) {
|
func ResponseErr(w* http.ResponseWriter, errCode int32, errMsg string) {
|
||||||
/*respObj := NewMxoObject()
|
rspObj := map[string]interface{}{}
|
||||||
respObj.SetXValue("errcode", NewXInt32(errCode))
|
rspObj["errcode"] = errCode
|
||||||
respObj.SetXValue("errmsg", NewXString(errMsg))
|
rspObj["errmsg"] = errMsg
|
||||||
Response(w, respObj.ToJsonStr())*/
|
jsonObj, _ := json.Marshal(rspObj)
|
||||||
|
Response(w, string(jsonObj))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResponseInt32Ok(w* http.ResponseWriter, key string, val int32) {
|
func ResponseInt32Ok(w* http.ResponseWriter, key string, val int32) {
|
||||||
(*w).Write([]byte(fmt.Sprintf(`{"errcode":0, "errmsg":"", "%s":%d}`, key, val)))
|
(*w).Write([]byte(fmt.Sprintf(`{"errcode":0, "errmsg":"", "%s":%d}`, key, val)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
func GetPostBody(r *http.Request) string {
|
||||||
func GetPostBody(r *http.Request) *XValue {
|
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
body, err := ioutil.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewXString("")
|
return ""
|
||||||
}
|
}
|
||||||
v := NewXString(string(body))
|
return string(body)
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
func GetRequestRemoteAddr(r *http.Request) string {
|
func GetRequestRemoteAddr(r *http.Request) string {
|
||||||
remoteAddr := r.RemoteAddr
|
remoteAddr := r.RemoteAddr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user