check params
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"admin/validator"
|
||||
"context"
|
||||
|
||||
"admin/admin"
|
||||
"admin/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
validateService "pkg.local/validate"
|
||||
)
|
||||
|
||||
type AddLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLogic {
|
||||
return &AddLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return &admin.Response{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user