Apply .gitignore rules
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package webServer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"goutil/logUtilPlus"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// responseResult
|
||||
// @description: responseResult
|
||||
// parameter:
|
||||
// @w: w
|
||||
// @responseObj: responseObj
|
||||
// return:
|
||||
func responseResult(w http.ResponseWriter, responseObj *ResponseObject) {
|
||||
b, err := json.Marshal(responseObj)
|
||||
if err != nil {
|
||||
logUtilPlus.ErrorLog(fmt.Sprintf("序列化输出结果%v出错", responseObj))
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Add("Content-Length", strconv.Itoa(len(b)))
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
// responseResultByJson
|
||||
// @description: responseResult
|
||||
// parameter:
|
||||
// @w: w
|
||||
// @responseObj: responseObj
|
||||
// return:
|
||||
func responseResultByJson(w http.ResponseWriter, responseObj *ResponseObject) {
|
||||
b, err := json.Marshal(responseObj)
|
||||
if err != nil {
|
||||
logUtilPlus.ErrorLog(fmt.Sprintf("序列化输出结果%v出错", responseObj))
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Add("Content-Length", strconv.Itoa(len(b)))
|
||||
w.Write(b)
|
||||
}
|
||||
Reference in New Issue
Block a user