调整项目架构,让框架更优化

This commit is contained in:
2026-07-20 21:39:01 +08:00
parent 987b16fd41
commit 121928733b
16 changed files with 866 additions and 689 deletions

View File

@@ -30,8 +30,7 @@ func main() {
func listUsers(w http.ResponseWriter, r *http.Request) {
app := factory.Default()
i18n, _ := app.I18n()
h := commonhttp.NewHandler(w, r, commonhttp.WithI18n(i18n))
h := app.NewHandler(w, r)
var req struct {
Keyword string `json:"keyword"`
@@ -42,11 +41,9 @@ func listUsers(w http.ResponseWriter, r *http.Request) {
return
}
p := h.Pagination()
users := []User{
{ID: 1, Name: "User1", Email: "user1@example.com"},
{ID: 2, Name: "User2", Email: "user2@example.com"},
}
h.SuccessPage(users, 100)
_ = p
}