还原: 撤销 fefbd4f5 的 go-zero stub 方案,回到 goctl 1.7.2 + gin 原生 routes
fefbd4f5(#104) 用本地 third_party/gozero stub 假冒 go-zero 依赖, 让 goctl 1.9.2 生成的 rest.Server/rest.Route 风格 routes.go 能编译, 但带来非标 vendor、Dockerfile 漏拷、新人误解等维护成本。 本次回到fefbd4f5之前的方案: - routes.go 用 gin 原生 publicUserGroupRouter.GET(...) 风格(goctl 1.7.2) - server.go 直接 handler.RegisterHandlers(r, svc),无需 rest.NewGinServer - svc/serviceContext.go 不再持有 AuthMiddleware/DeviceMiddleware/ServerMiddleware 字段 - go.mod 删除 zeromicro/go-zero require + replace 指令 - 删除 third_party/gozero/ stub 模块 - 删除fefbd4f5引入的 28 个 goctl 生成的空 stub 文件和 nodeserver/apple 转发器 - Dockerfile 不再需要 COPY third_party/ invite_sales 还原路由保留(gin 老风格写法)。
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
commonLogic "github.com/perfect-panel/server/internal/logic/common"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/perfect-panel/server/internal/types"
|
||||
"github.com/perfect-panel/server/pkg/constant"
|
||||
"github.com/perfect-panel/server/pkg/result"
|
||||
)
|
||||
|
||||
func CheckCodeLegacyHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
||||
return checkCodeLegacyHandler(svcCtx, false)
|
||||
}
|
||||
|
||||
func CheckCodeLegacyV2Handler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
||||
return checkCodeLegacyHandler(svcCtx, true)
|
||||
}
|
||||
|
||||
func checkCodeLegacyHandler(svcCtx *svc.ServiceContext, consume bool) func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
var req types.LegacyCheckVerificationCodeRequest
|
||||
_ = c.ShouldBind(&req)
|
||||
validateErr := svcCtx.Validate(&req)
|
||||
if validateErr != nil {
|
||||
result.ParamErrorResult(c, validateErr)
|
||||
return
|
||||
}
|
||||
|
||||
normalizedReq, legacyType3Mapped, err := commonLogic.NormalizeLegacyCheckVerificationCodeRequest(&req)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := commonLogic.NewCheckVerificationCodeLogic(c.Request.Context(), svcCtx)
|
||||
resp, err := l.CheckVerificationCodeWithBehavior(normalizedReq, commonLogic.VerifyCodeCheckBehavior{
|
||||
Source: "legacy",
|
||||
Consume: consume,
|
||||
LegacyType3Mapped: legacyType3Mapped,
|
||||
AllowSceneFallback: constant.ParseVerifyType(normalizedReq.Type) != constant.DeleteAccount,
|
||||
})
|
||||
|
||||
legacyResp := &types.LegacyCheckVerificationCodeResponse{}
|
||||
if resp != nil {
|
||||
legacyResp.Status = resp.Status
|
||||
legacyResp.Exist = resp.Status
|
||||
}
|
||||
|
||||
result.HttpResult(c, legacyResp, err)
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
package common
|
||||
@@ -1 +0,0 @@
|
||||
package common
|
||||
@@ -1 +0,0 @@
|
||||
package common
|
||||
@@ -1 +0,0 @@
|
||||
package common
|
||||
Reference in New Issue
Block a user