This commit is contained in:
2025-06-17 11:53:31 +08:00
parent 5c8182cdf9
commit 417d0671de
10 changed files with 87 additions and 114 deletions

View File

@@ -39,14 +39,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: count,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(count, res))
default:
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
}

View File

@@ -44,14 +44,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: count,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(count, res))
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}

View File

@@ -44,14 +44,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: count,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(count, res))
default:
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
}

View File

@@ -38,14 +38,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: count,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(count, res))
default:
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
}

View File

@@ -54,14 +54,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: 0,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(0, res))
default:
a.render.JSONErr(w, "method not allowed")
}

View File

@@ -48,14 +48,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: count,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(count, res))
default:
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
}

View File

@@ -56,8 +56,8 @@ func (a *app) edit(w http.ResponseWriter, r *http.Request) {
vm := &systemmodel.User{}
if id > 0 {
if u, err := a.userService.Get(ctx, id); err == nil {
vm.HashedPassword = []byte("********")
vm = u
vm.HashedPassword = []byte("********")
}
}
a.render.Render(ctx, w, user.Edit(ctx, vm))
@@ -122,14 +122,7 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.JSONErr(w, err.Error())
return
}
data := render.ResponseList{
Code: 0,
Message: "ok",
Count: count,
Data: res,
}
a.render.JSON(w, data)
a.render.JSON(w, render.NewResponseList(count, res))
default:
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
}