36 lines
867 B
Go
36 lines
867 B
Go
|
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
|
||
|
}
|