add utils to pkg
This commit is contained in:
@@ -51,6 +51,8 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
||||
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"admin/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"pkg.local/utils"
|
||||
validateService "pkg.local/validate"
|
||||
)
|
||||
|
||||
@@ -27,8 +28,8 @@ func NewAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLogic {
|
||||
|
||||
func (l *AddLogic) Add(in *admin.AddRequest) (*admin.Response, error) {
|
||||
var req validator.AdminAddValidator
|
||||
if resp := validateService.ValidateFromProto(in, &req); resp != "" {
|
||||
return &admin.Response{Code: 111, Msg: resp}, nil
|
||||
if resp := validateService.ValidateFromProto(in, &req); resp != utils.StringEmpty {
|
||||
return &admin.Response{Code: utils.Ok.Code, Msg: resp}, nil
|
||||
}
|
||||
|
||||
return &admin.Response{}, nil
|
||||
|
||||
Reference in New Issue
Block a user