tianyuan-api-server/apps/sentinel/internal/logic/userproduct/matchinguseridproductcodelogic.go

36 lines
867 B
Go
Raw Normal View History

2024-10-02 00:57:17 +08:00
package userproductlogic
import (
"context"
"tianyuan-api/apps/sentinel/internal/svc"
"tianyuan-api/apps/sentinel/sentinel"
"github.com/zeromicro/go-zero/core/logx"
)
type MatchingUserIdProductCodeLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewMatchingUserIdProductCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MatchingUserIdProductCodeLogic {
return &MatchingUserIdProductCodeLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *MatchingUserIdProductCodeLogic) MatchingUserIdProductCode(in *sentinel.MatchingUserIdProductCodeRequest) (*sentinel.MatchResponse, error) {
match, err := l.svcCtx.UserProductsModel.FindMatchUserProductCode(l.ctx, in.Id, in.ProductCode)
if err != nil {
return nil, err
}
return &sentinel.MatchResponse{
Match: match,
}, nil
}