1、新增自定义用户私人价格2、优化api服务鉴权缓存3、新增管理员端对公充值

This commit is contained in:
2024-10-21 16:01:20 +08:00
parent 8896fd6b30
commit 2292d25d74
37 changed files with 1903 additions and 907 deletions

View File

@@ -0,0 +1,38 @@
package userproductlogic
import (
"context"
"tianyuan-api/apps/sentinel/internal/svc"
"tianyuan-api/apps/sentinel/sentinel"
"github.com/zeromicro/go-zero/core/logx"
)
type GetUserProductLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetUserProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProductLogic {
return &GetUserProductLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetUserProductLogic) GetUserProduct(in *sentinel.UserProuctRequest) (*sentinel.UserProductResponse, error) {
userProduct, err := l.svcCtx.UserProductsModel.FindOneUserProduct(l.ctx, in.UserId, in.ProductId)
if err != nil {
return nil, err
}
return &sentinel.UserProductResponse{
Id: userProduct.Id,
UserId: userProduct.UserId,
ProductId: userProduct.ProductId,
ProductPrice: userProduct.ProductPrice,
}, nil
}