Documentation ¶
Index ¶
- Variables
- type Attribute
- type AuthUseCase
- type CartRepo
- type CartUseCase
- func (u *CartUseCase) AddItem(ctx context.Context, req *v1.AddCartItemRequest) error
- func (u *CartUseCase) ClearCart(ctx context.Context, req *v1.ClearCartRequest) error
- func (u *CartUseCase) DeleteItem(ctx context.Context, memberId string, productSkuIds ...string) error
- func (u *CartUseCase) GetCartList(ctx context.Context, req *v1.GetCartListRequest) ([]*v1.CartItem, error)
- func (u *CartUseCase) UpdateItemQuantity(ctx context.Context, req *v1.UpdateCartItemQuantityRequest) error
- type CreateProductDo
- type ListProductParam
- type ListProductSkuParam
- type MyClaims
- type Page
- type Pagination
- type Product
- type ProductAttributeRepo
- type ProductAttributeUseCase
- func (u *ProductAttributeUseCase) CreateProductAttribute(ctx context.Context, param *v1.CreateProductAttributeRequest) error
- func (u *ProductAttributeUseCase) DeleteProductAttribute(ctx context.Context, id int64) error
- func (u *ProductAttributeUseCase) FindProductAttributeById(ctx context.Context, id int64) (*v1.ProductAttribute, error)
- func (u *ProductAttributeUseCase) FindProductAttributeList(ctx context.Context, param *v1.FindProductAttributeListRequest) (reply *v1.FindProductAttributeListReply, err error)
- func (u *ProductAttributeUseCase) UpdateProductAttribute(ctx context.Context, param *v1.UpdateProductAttributeRequest) error
- type ProductAttributeValueRepo
- type ProductAttributeValueUseCase
- func (u *ProductAttributeValueUseCase) CreateOrUpdateProductAttributeValue(ctx context.Context, param *v1.CreateOrUpdateProductAttributeValueRequest) error
- func (u *ProductAttributeValueUseCase) DeleteProductAttributeValue(ctx context.Context, id int64) error
- func (u *ProductAttributeValueUseCase) FindProductAttributeValueByAttributeId(ctx context.Context, attributeId int64) (*v1.FindProductAttributeValueByAttributeIdReply, error)
- type ProductCategoryRepo
- type ProductCategoryUseCase
- func (u *ProductCategoryUseCase) CreateProductCategory(ctx context.Context, param *v1.CreateProductCategoryRequest) error
- func (u *ProductCategoryUseCase) DeleteProductCategory(ctx context.Context, id int64) error
- func (u *ProductCategoryUseCase) FindProductCategoryById(ctx context.Context, id int64) (*v1.ProductCategory, error)
- func (u *ProductCategoryUseCase) FindProductCategoryList(ctx context.Context, param *v1.FindProductCategoryListRequest) (reply *v1.FindProductCategoryListReply, err error)
- func (u *ProductCategoryUseCase) FindProductCategoryListByParentId(ctx context.Context, parentId int64) ([]*v1.ProductCategory, error)
- func (u *ProductCategoryUseCase) FindProductCategoryTree(ctx context.Context) ([]*v1.ProductCategoryTreeNode, error)
- func (u *ProductCategoryUseCase) UpdateProductCategory(ctx context.Context, param *v1.UpdateProductCategoryRequest) error
- type ProductRepo
- type ProductSku
- type ProductUseCase
- func (puc *ProductUseCase) CreateProduct(ctx context.Context, req *CreateProductDo) (int64, error)
- func (puc *ProductUseCase) CreateProductSku(ctx context.Context, req *ProductSku) (int64, error)
- func (puc *ProductUseCase) DeleteProduct(ctx context.Context, productId int64) error
- func (puc *ProductUseCase) DeleteProductSku(ctx context.Context, skuId int64) error
- func (puc *ProductUseCase) GetProduct(ctx context.Context, productId int64) (*Product, error)
- func (puc *ProductUseCase) GetProductSku(ctx context.Context, skuId int64) (*ProductSku, error)
- func (puc *ProductUseCase) ListProduct(ctx context.Context, req *pb.ListProductRequest) (total int64, list []*Product, err error)
- func (puc *ProductUseCase) ListProductSkus(ctx context.Context, req *pb.ListProductSkuRequest) (list []*ProductSku, err error)
- func (puc *ProductUseCase) UpdateProduct(ctx context.Context, req *UpdateProductDo) error
- func (puc *ProductUseCase) UpdateProductSku(ctx context.Context, sku *ProductSku) error
- type UpdateProductDo
- type UpdateProductSkuDo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingJwtToken = errors.Unauthorized(reason, "Jwt token is missing") ErrWrongContext = errors.Unauthorized(reason, "Wrong context for middleware") )
View Source
var ProviderSet = wire.NewSet(NewProductCategoryUseCase, NewProductUseCase, NewProductAttributeUseCase, NewProductAttributeValueUseCase, NewAuthUseCase)
ProviderSet is biz providers.
Functions ¶
This section is empty.
Types ¶
type AuthUseCase ¶
type AuthUseCase struct {
// contains filtered or unexported fields
}
func NewAuthUseCase ¶
func NewAuthUseCase(data *conf.Data) *AuthUseCase
func (*AuthUseCase) GenerateToken ¶
func (u *AuthUseCase) GenerateToken(memberId, role string) (string, error)
func (*AuthUseCase) JwtMiddleware ¶
func (u *AuthUseCase) JwtMiddleware() middleware.Middleware
func (*AuthUseCase) ParseToken ¶
func (u *AuthUseCase) ParseToken(jwtToken string) (map[string]any, error)
type CartRepo ¶
type CartRepo interface { AddItem(ctx context.Context, req *orderv1.AddCartItemRequest) error DeleteItem(ctx context.Context, memberId string, productSkuIds ...string) error UpdateItemQuantity(ctx context.Context, req *orderv1.UpdateCartItemQuantityRequest) error FindAll(ctx context.Context, param *orderv1.GetCartListRequest) ([]*orderv1.CartItem, error) Clear(ctx context.Context, param *orderv1.ClearCartRequest) error }
CartRepo 购物车仓储接口
type CartUseCase ¶
type CartUseCase struct {
// contains filtered or unexported fields
}
func NewCartUseCase ¶
func NewCartUseCase(cartRepo CartRepo) *CartUseCase
func (*CartUseCase) AddItem ¶
func (u *CartUseCase) AddItem(ctx context.Context, req *v1.AddCartItemRequest) error
func (*CartUseCase) ClearCart ¶
func (u *CartUseCase) ClearCart(ctx context.Context, req *v1.ClearCartRequest) error
func (*CartUseCase) DeleteItem ¶
func (*CartUseCase) GetCartList ¶
func (u *CartUseCase) GetCartList(ctx context.Context, req *v1.GetCartListRequest) ([]*v1.CartItem, error)
GetCartList 获取购物车商品sku列表
func (*CartUseCase) UpdateItemQuantity ¶
func (u *CartUseCase) UpdateItemQuantity(ctx context.Context, req *v1.UpdateCartItemQuantityRequest) error
type CreateProductDo ¶
type CreateProductDo struct {
*Product
}
type ListProductParam ¶
type ListProductParam struct {
*Page
}
type ListProductSkuParam ¶
type ListProductSkuParam struct {
ProductId int64
}
type MyClaims ¶
type MyClaims struct { jwtv5.RegisteredClaims Role string `json:"role"` }
type Pagination ¶
type Product ¶
type Product struct { Id int64 // 商品id ProductCategoryIds []int64 // 产品分类列表 FreightTemplateId int64 // 运费模版 BrandId int64 // 品牌id ProductAttributeCategoryId int64 // 属性分类 Name string // 商品名称 Pic string // 主图 ProductSn string // 商品编码 Sort uint32 // 排序 TotalSales uint32 // 销量 Price float64 // 售卖价(sku里的最低价格) PromotionPrice float64 // 促销价 GiftGrowth uint32 // 赠送的成长值 GiftPoint uint32 // 赠送的积分 UsePointLimit uint32 // 限制使用的积分 SubTitle string // 副标题 Description string // 描述 OriginalPrice float64 // 原价 TotalStock uint32 // 库存 TotalWarnStock uint32 // 预警库存 Unit string // 单位 Weight float64 // 重量 PreviewStatus v1.ProductPreviewStatus // 是否为预览商品 ListingStatus v1.ProductListingStatus // 上下架状态 NewStatus v1.ProductNewStatus // 是否新品 RecommendStatus v1.ProductRecommendStatus // 是否推荐 VerifyStatus v1.ProductVerifyStatus // 审核状态 ServiceIds []int64 // 产品服务id数组 Keywords []string // 关键字 Note string // 商品备注 AlbumPics []string // 画册图片,连产品图片限制为5张 DetailTitle string // 产品详述标题 DetailDesc string // 产品详述描述 DetailHtml string // 产品详述 DetailMobileHtml string // 产品详述移动端 PromotionStartTime time.Time // 促销开始时间 PromotionEndTime time.Time // 促销结束时间 PromotionPerLimit int32 // 活动限购数量 PromotionType v1.ProductPromotionType // 促销类型 BrandName string // 品牌名称 ProductCategoryName string // 产品分类名称 SkuList []*ProductSku // sku列表 }
type ProductAttributeRepo ¶
type ProductAttributeRepo interface { // FindProductAttributeById 查询商品属性 FindProductAttributeById(ctx context.Context, id int64) (*v1.ProductAttribute, error) // FindProductAttributeList 查询商品属性列表 FindProductAttributeList(ctx context.Context, param *v1.FindProductAttributeListRequest) (reply *v1.FindProductAttributeListReply, err error) // CreateProductAttribute 创建商品属性 CreateProductAttribute(ctx context.Context, param *v1.CreateProductAttributeRequest) (int64, error) // UpdateProductAttribute 更新商品属性 UpdateProductAttribute(ctx context.Context, param *v1.UpdateProductAttributeRequest) error // DeleteProductAttribute 删除商品属性 DeleteProductAttribute(ctx context.Context, id int64) error }
type ProductAttributeUseCase ¶
type ProductAttributeUseCase struct {
// contains filtered or unexported fields
}
func NewProductAttributeUseCase ¶
func NewProductAttributeUseCase(productAttributeRepo ProductAttributeRepo) *ProductAttributeUseCase
func (*ProductAttributeUseCase) CreateProductAttribute ¶
func (u *ProductAttributeUseCase) CreateProductAttribute(ctx context.Context, param *v1.CreateProductAttributeRequest) error
func (*ProductAttributeUseCase) DeleteProductAttribute ¶
func (u *ProductAttributeUseCase) DeleteProductAttribute(ctx context.Context, id int64) error
func (*ProductAttributeUseCase) FindProductAttributeById ¶
func (u *ProductAttributeUseCase) FindProductAttributeById(ctx context.Context, id int64) (*v1.ProductAttribute, error)
func (*ProductAttributeUseCase) FindProductAttributeList ¶
func (u *ProductAttributeUseCase) FindProductAttributeList(ctx context.Context, param *v1.FindProductAttributeListRequest) (reply *v1.FindProductAttributeListReply, err error)
func (*ProductAttributeUseCase) UpdateProductAttribute ¶
func (u *ProductAttributeUseCase) UpdateProductAttribute(ctx context.Context, param *v1.UpdateProductAttributeRequest) error
type ProductAttributeValueRepo ¶
type ProductAttributeValueRepo interface { // CreateOrUpdateProductAttributeValue 创建商品属性值 CreateOrUpdateProductAttributeValue(ctx context.Context, param *v1.CreateOrUpdateProductAttributeValueRequest) error // DeleteProductAttributeValue 删除商品属性值 DeleteProductAttributeValue(ctx context.Context, id int64) error // FindProductAttributeValueByAttributeId 根据属性ID查询商品属性值 FindProductAttributeValueByAttributeId(ctx context.Context, attributeId int64) ([]*v1.ProductAttributeValue, error) }
ProductAttributeValueRepo 商品属性值仓储接口
type ProductAttributeValueUseCase ¶
type ProductAttributeValueUseCase struct {
// contains filtered or unexported fields
}
func NewProductAttributeValueUseCase ¶
func NewProductAttributeValueUseCase(productAttributeValueRepo ProductAttributeValueRepo) *ProductAttributeValueUseCase
func (*ProductAttributeValueUseCase) CreateOrUpdateProductAttributeValue ¶
func (u *ProductAttributeValueUseCase) CreateOrUpdateProductAttributeValue(ctx context.Context, param *v1.CreateOrUpdateProductAttributeValueRequest) error
func (*ProductAttributeValueUseCase) DeleteProductAttributeValue ¶
func (u *ProductAttributeValueUseCase) DeleteProductAttributeValue(ctx context.Context, id int64) error
func (*ProductAttributeValueUseCase) FindProductAttributeValueByAttributeId ¶
func (u *ProductAttributeValueUseCase) FindProductAttributeValueByAttributeId(ctx context.Context, attributeId int64) (*v1.FindProductAttributeValueByAttributeIdReply, error)
type ProductCategoryRepo ¶
type ProductCategoryRepo interface { // FindProductCategoryById 查询商品分类 FindProductCategoryById(ctx context.Context, id int64) (*v1.ProductCategory, error) // FindProductCategoryList 查询商品分类列表 FindProductCategoryList(ctx context.Context, param *v1.FindProductCategoryListRequest) (reply *v1.FindProductCategoryListReply, err error) // CreateProductCategory 创建商品分类 CreateProductCategory(ctx context.Context, param *v1.CreateProductCategoryRequest) (int64, error) // UpdateProductCategory 更新商品分类 UpdateProductCategory(ctx context.Context, param *v1.UpdateProductCategoryRequest) error // DeleteProductCategory 删除商品分类 DeleteProductCategory(ctx context.Context, id int64) error // FindProductCategoryListByParentId 查询商品分类列表 FindProductCategoryListByParentId(ctx context.Context, parentId int64) ([]*v1.ProductCategory, error) // FindProductCategoryTree 获取商品分类树形结构 FindProductCategoryTree(ctx context.Context) ([]*v1.ProductCategoryTreeNode, error) }
ProductCategoryRepo 商品分类仓储接口
type ProductCategoryUseCase ¶
type ProductCategoryUseCase struct {
// contains filtered or unexported fields
}
func NewProductCategoryUseCase ¶
func NewProductCategoryUseCase(productCategoryRepo ProductCategoryRepo) *ProductCategoryUseCase
func (*ProductCategoryUseCase) CreateProductCategory ¶
func (u *ProductCategoryUseCase) CreateProductCategory(ctx context.Context, param *v1.CreateProductCategoryRequest) error
func (*ProductCategoryUseCase) DeleteProductCategory ¶
func (u *ProductCategoryUseCase) DeleteProductCategory(ctx context.Context, id int64) error
func (*ProductCategoryUseCase) FindProductCategoryById ¶
func (u *ProductCategoryUseCase) FindProductCategoryById(ctx context.Context, id int64) (*v1.ProductCategory, error)
func (*ProductCategoryUseCase) FindProductCategoryList ¶
func (u *ProductCategoryUseCase) FindProductCategoryList(ctx context.Context, param *v1.FindProductCategoryListRequest) (reply *v1.FindProductCategoryListReply, err error)
func (*ProductCategoryUseCase) FindProductCategoryListByParentId ¶
func (u *ProductCategoryUseCase) FindProductCategoryListByParentId(ctx context.Context, parentId int64) ([]*v1.ProductCategory, error)
func (*ProductCategoryUseCase) FindProductCategoryTree ¶
func (u *ProductCategoryUseCase) FindProductCategoryTree(ctx context.Context) ([]*v1.ProductCategoryTreeNode, error)
func (*ProductCategoryUseCase) UpdateProductCategory ¶
func (u *ProductCategoryUseCase) UpdateProductCategory(ctx context.Context, param *v1.UpdateProductCategoryRequest) error
type ProductRepo ¶
type ProductRepo interface { // FindProductById 查询商品 FindProductById(ctx context.Context, id int64) (*Product, error) // FindProductSkuBySkuId 查询商品sku FindProductSkuBySkuId(ctx context.Context, skuId int64) (*ProductSku, error) // FindProductSkusBySkuIdList 查询商品sku FindProductSkusBySkuIdList(ctx context.Context, skuIds []int64) ([]*ProductSku, error) // FindProductSkusByProductId 查询商品sku列表 FindProductSkusByProductId(ctx context.Context, productId int64) ([]*ProductSku, error) // CreateProduct 创建商品 CreateProduct(ctx context.Context, param *CreateProductDo) (int64, error) // UpdateProduct 更新商品 UpdateProduct(ctx context.Context, param *UpdateProductDo) error // UpdateProductSku 更新商品sku UpdateProductSku(ctx context.Context, param *UpdateProductSkuDo) error // DeleteProduct 删除商品 DeleteProduct(ctx context.Context, productId int64) error // DeleteProductSku 删除商品sku DeleteProductSku(ctx context.Context, skuId int64) error // FindProductList 查询商品列表 FindProductList(ctx context.Context, req *v1.ListProductRequest) (total int64, list []*Product, err error) FindProductSkuById(ctx context.Context, id int64) (*ProductSku, error) CreateProductSku(ctx context.Context, sku *ProductSku) (int64, error) }
ProductRepo 商品仓储接口
type ProductSku ¶
type ProductUseCase ¶
type ProductUseCase struct {
// contains filtered or unexported fields
}
func NewProductUseCase ¶
func NewProductUseCase(productRepo ProductRepo) *ProductUseCase
func (*ProductUseCase) CreateProduct ¶
func (puc *ProductUseCase) CreateProduct(ctx context.Context, req *CreateProductDo) (int64, error)
func (*ProductUseCase) CreateProductSku ¶
func (puc *ProductUseCase) CreateProductSku(ctx context.Context, req *ProductSku) (int64, error)
func (*ProductUseCase) DeleteProduct ¶
func (puc *ProductUseCase) DeleteProduct(ctx context.Context, productId int64) error
func (*ProductUseCase) DeleteProductSku ¶
func (puc *ProductUseCase) DeleteProductSku(ctx context.Context, skuId int64) error
func (*ProductUseCase) GetProduct ¶
func (*ProductUseCase) GetProductSku ¶
func (puc *ProductUseCase) GetProductSku(ctx context.Context, skuId int64) (*ProductSku, error)
func (*ProductUseCase) ListProduct ¶
func (puc *ProductUseCase) ListProduct(ctx context.Context, req *pb.ListProductRequest) (total int64, list []*Product, err error)
func (*ProductUseCase) ListProductSkus ¶
func (puc *ProductUseCase) ListProductSkus(ctx context.Context, req *pb.ListProductSkuRequest) (list []*ProductSku, err error)
func (*ProductUseCase) UpdateProduct ¶
func (puc *ProductUseCase) UpdateProduct(ctx context.Context, req *UpdateProductDo) error
func (*ProductUseCase) UpdateProductSku ¶
func (puc *ProductUseCase) UpdateProductSku(ctx context.Context, sku *ProductSku) error
type UpdateProductDo ¶
type UpdateProductDo struct {
*Product
}
type UpdateProductSkuDo ¶
type UpdateProductSkuDo struct {
*ProductSku
}
Click to show internal directories.
Click to hide internal directories.