feat(points): 增加双边积分与虚拟积分商城
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package pointsmall
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hfb_sys/backend/internal/model"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
repo *Repository
|
||||
}
|
||||
|
||||
func NewService(repo *Repository) *Service {
|
||||
return &Service{repo: repo}
|
||||
}
|
||||
|
||||
func (s *Service) Summary(ctx context.Context, userID uint64) (*SummaryDTO, error) {
|
||||
return s.repo.Summary(ctx, userID)
|
||||
}
|
||||
|
||||
func (s *Service) Ledger(ctx context.Context, userID uint64, limit int) ([]model.RenterGrowthLedger, error) {
|
||||
return s.repo.Ledger(ctx, userID, limit)
|
||||
}
|
||||
|
||||
func (s *Service) ListProducts(ctx context.Context, includeOffline bool) ([]ProductDTO, error) {
|
||||
return s.repo.ListProducts(ctx, includeOffline)
|
||||
}
|
||||
|
||||
func (s *Service) CreateProduct(ctx context.Context, req ProductRequest) (*ProductDTO, error) {
|
||||
return s.repo.CreateProduct(ctx, req)
|
||||
}
|
||||
|
||||
func (s *Service) UpdateProduct(ctx context.Context, id uint64, req ProductRequest) (*ProductDTO, error) {
|
||||
return s.repo.UpdateProduct(ctx, id, req)
|
||||
}
|
||||
|
||||
func (s *Service) Redeem(ctx context.Context, userID, productID uint64, quantity int) (*RedemptionDTO, error) {
|
||||
return s.repo.Redeem(ctx, userID, productID, quantity)
|
||||
}
|
||||
|
||||
func (s *Service) ListRedemptions(ctx context.Context, userID uint64, admin bool) ([]RedemptionDTO, error) {
|
||||
return s.repo.ListRedemptions(ctx, userID, admin)
|
||||
}
|
||||
|
||||
func (s *Service) CompleteRedemption(ctx context.Context, adminID, id uint64, remark string) (*RedemptionDTO, error) {
|
||||
return s.repo.CompleteRedemption(ctx, adminID, id, remark)
|
||||
}
|
||||
Reference in New Issue
Block a user