badge

package
v1.4.1-RC2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgeAwardRepo

type BadgeAwardRepo interface {
	CheckIsAward(ctx context.Context, badgeID string, userID string, awardKey string, singleOrMulti int8) (isAward bool, err error)
	AwardBadgeForUser(ctx context.Context, badgeAward *entity.BadgeAward) (err error)

	CountByUserIdAndBadgeId(ctx context.Context, userID string, badgeID string) (awardCount int64)
	CountByBadgeID(ctx context.Context, badgeID string) (awardCount int64, err error)

	SumUserEarnedGroupByBadgeID(ctx context.Context, userID string) (earnedCounts []*entity.BadgeEarnedCount, err error)

	ListPagedByBadgeId(ctx context.Context, badgeID string, page int, pageSize int) (badgeAwardList []*entity.BadgeAward, total int64, err error)
	ListPagedByBadgeIdAndUserId(ctx context.Context, badgeID string, userID string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
	ListNewestEarned(ctx context.Context, userID string, limit int) (badgeAwards []*entity.BadgeAwardRecent, err error)

	GetByUserIdAndBadgeId(ctx context.Context, userID string, badgeID string) (badgeAward *entity.BadgeAward, exists bool, err error)
	GetByUserIdAndBadgeIdAndAwardKey(ctx context.Context, userID string, badgeID string, awardKey string) (badgeAward *entity.BadgeAward, exists bool, err error)
}

type BadgeAwardService

type BadgeAwardService struct {
	// contains filtered or unexported fields
}

func NewBadgeAwardService

func NewBadgeAwardService(
	badgeAwardRepo BadgeAwardRepo,
	badgeRepo BadgeRepo,
	userCommon *usercommon.UserCommon,
	objectInfoService *object_info.ObjService,
	notificationQueueService notice_queue.NotificationQueueService,
) *BadgeAwardService

func (*BadgeAwardService) Award

func (bs *BadgeAwardService) Award(ctx context.Context, badgeID string, userID string, awardKey string) (err error)

Award award badge

func (*BadgeAwardService) GetBadgeAwardList

func (bs *BadgeAwardService) GetBadgeAwardList(
	ctx context.Context,
	req *schema.GetBadgeAwardWithPageReq,
) (resp []*schema.GetBadgeAwardWithPageResp, total int64, err error)

GetBadgeAwardList get badge award list

func (*BadgeAwardService) GetUserBadgeAwardList

func (bs *BadgeAwardService) GetUserBadgeAwardList(
	ctx *gin.Context,
	req *schema.GetUserBadgeAwardListReq,
) (
	resp []*schema.GetUserBadgeAwardListResp,
	total int64,
	err error,
)

GetUserBadgeAwardList get user badge award list

func (*BadgeAwardService) GetUserRecentBadgeAwardList

func (bs *BadgeAwardService) GetUserRecentBadgeAwardList(ctx *gin.Context, req *schema.GetUserBadgeAwardListReq) (
	resp []*schema.GetUserBadgeAwardListResp, total int64, err error)

GetUserRecentBadgeAwardList get user badge award list

type BadgeEventService

type BadgeEventService struct {
	// contains filtered or unexported fields
}

func NewBadgeEventService

func NewBadgeEventService(
	data *data.Data,
	eventQueueService event_queue.EventQueueService,
	badgeRepo BadgeRepo,
	eventRuleRepo EventRuleRepo,
	badgeAwardService *BadgeAwardService,
) *BadgeEventService

func (*BadgeEventService) Handler

func (ns *BadgeEventService) Handler(ctx context.Context, msg *schema.EventMsg) error

type BadgeGroupRepo

type BadgeGroupRepo interface {
	ListGroups(ctx context.Context) (groups []*entity.BadgeGroup, err error)
	AddGroup(ctx context.Context, group *entity.BadgeGroup) (err error)
}

type BadgeGroupService

type BadgeGroupService struct {
	// contains filtered or unexported fields
}

func NewBadgeGroupService

func NewBadgeGroupService(badgeGroupRepo BadgeGroupRepo) *BadgeGroupService

type BadgeRepo

type BadgeRepo interface {
	GetByID(ctx context.Context, id string) (badge *entity.Badge, exists bool, err error)
	GetByIDs(ctx context.Context, ids []string) (badges []*entity.Badge, err error)

	ListPaged(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error)
	ListActivated(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error)
	ListInactivated(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error)

	UpdateStatus(ctx context.Context, id string, status int8) (err error)
	UpdateAwardCount(ctx context.Context, badgeID string, awardCount int) (err error)
}

type BadgeService

type BadgeService struct {
	// contains filtered or unexported fields
}

func NewBadgeService

func NewBadgeService(
	badgeRepo BadgeRepo,
	badgeGroupRepo BadgeGroupRepo,
	badgeAwardRepo BadgeAwardRepo,
	badgeEventService *BadgeEventService,
	siteInfoCommonService siteinfo_common.SiteInfoCommonService,
) *BadgeService

func (*BadgeService) GetBadgeInfo

func (b *BadgeService) GetBadgeInfo(ctx *gin.Context, id string, userID string) (info *schema.GetBadgeInfoResp, err error)

GetBadgeInfo get badge info

func (*BadgeService) ListByGroup

func (b *BadgeService) ListByGroup(ctx context.Context, userID string) (resp []*schema.GetBadgeListResp, err error)

ListByGroup list all badges group by group

func (*BadgeService) ListPaged

func (b *BadgeService) ListPaged(ctx context.Context, req *schema.GetBadgeListPagedReq) (resp []*schema.GetBadgeListPagedResp, total int64, err error)

ListPaged list all badges by page

func (*BadgeService) UpdateStatus

func (b *BadgeService) UpdateStatus(ctx *gin.Context, req *schema.UpdateBadgeStatusReq) (err error)

UpdateStatus update badge status

type EventRuleHandler

type EventRuleHandler func(ctx context.Context, event *schema.EventMsg) (awards []*entity.BadgeAward, err error)

type EventRuleRepo

type EventRuleRepo interface {
	HandleEventWithRule(ctx context.Context, msg *schema.EventMsg) (awards []*entity.BadgeAward)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL