change layout
CI / changes (push) Successful in 5s
CI / docker-bff (push) Failing after 7s
CI / docker-product (push) Failing after 5s
CI / docker-admin (push) Failing after 4s
CI / docker-user (push) Failing after 6s

This commit is contained in:
2026-08-20 15:41:44 +08:00
parent 57e04be304
commit be8f89f449
176 changed files with 7009 additions and 4498 deletions
+5 -5
View File
@@ -1,11 +1,11 @@
package response
import (
"encoding/json"
"fmt"
"lone-services/pkg/utils"
"net/http"
"pkg.local/utils"
jsoniter "github.com/json-iterator/go"
)
type BaseController struct{}
@@ -27,12 +27,12 @@ func (b *BaseController) Out(w http.ResponseWriter, data any, cm Error) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(out)
_ = jsoniter.NewEncoder(w).Encode(out)
}
func (b *BaseController) OutPut(w http.ResponseWriter, code int32, data any, msg string) {
if code == utils.Ok.Code && !utils.GetConfigBool("encrypt.debug") {
jsonData, err := json.Marshal(data)
jsonData, err := jsoniter.Marshal(data)
if err != nil {
fmt.Printf("response encrypt: json.Marshal failed: %v\n", err)
msg = utils.ErrorEncryptAesError.Msg
@@ -56,5 +56,5 @@ func (b *BaseController) OutPut(w http.ResponseWriter, code int32, data any, msg
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(out)
_ = jsoniter.NewEncoder(w).Encode(out)
}