package logic import ( "context" check "bookstore/rpc/check/checker" "bookstore/rpc/check/internal/svc" "github.com/tal-tech/go-zero/core/logx" ) type CheckLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CheckLogic { return &CheckLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *CheckLogic) Check(in *check.CheckReq) (*check.CheckResp, error) { resp, err := l.svcCtx.Model.FindOne(in.Book) if err != nil { return nil, err } return &check.CheckResp{ Found: true, Price: resp.Price, }, nil }