check params
CI / changes (push) Successful in 1s
CI / docker-bff (push) Successful in 1s
CI / docker-product (push) Failing after 1s

This commit is contained in:
2026-08-06 22:20:48 +08:00
parent e7e3aa12c3
commit 95d4c7bdc2
11 changed files with 188 additions and 44 deletions
+9
View File
@@ -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)
}