28 lines
537 B
Plaintext
28 lines
537 B
Plaintext
|
|
package httpServer
|
||
|
|
|
||
|
|
import (
|
||
|
|
"common/webServer"
|
||
|
|
"encoding/json"
|
||
|
|
"fmt"
|
||
|
|
"goutil/logUtilPlus"
|
||
|
|
"net/http"
|
||
|
|
"strconv"
|
||
|
|
)
|
||
|
|
|
||
|
|
// responseResult
|
||
|
|
// @description: responseResult
|
||
|
|
// parameter:
|
||
|
|
// @w: w
|
||
|
|
// @responseObj: responseObj
|
||
|
|
// return:
|
||
|
|
func responseResult(w http.ResponseWriter, responseObj *webServer.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)
|
||
|
|
}
|