调整项目结构,factory只负责暴露方法,不实现业务细节

This commit is contained in:
2025-12-07 00:04:01 +08:00
parent b66f345281
commit 339920a940
23 changed files with 2165 additions and 1231 deletions

View File

@@ -21,13 +21,11 @@ func main() {
// 定义API处理器
http.Handle("/api/hello", chain.ThenFunc(func(w http.ResponseWriter, r *http.Request) {
h := commonhttp.NewHandler(w, r)
// 获取时区(使用公共方法)
timezone := commonhttp.GetTimezone(r)
// 获取时区
timezone := h.GetTimezone()
// 返回响应
h.Success(map[string]interface{}{
// 返回响应(使用公共方法)
commonhttp.Success(w, map[string]interface{}{
"message": "Hello, World!",
"timezone": timezone,
})