check params
This commit is contained in:
@@ -52,3 +52,12 @@ func (b *BaseController) Out(w http.ResponseWriter, data any, cm Error) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_ = json.NewEncoder(w).Encode(out)
|
||||
}
|
||||
|
||||
func (b *BaseController) OutPut(w http.ResponseWriter, code int32, data any, msg string) {
|
||||
// 复制一份,避免并发请求改到包级 OK/Fail 单例
|
||||
out := NewError(int(code), msg).WithData(data)
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_ = json.NewEncoder(w).Encode(out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user