package activity

import (
	"context"

	"bindbox-game/internal/repository/mysql/model"
)

// ListIssueRewards 查询期奖励列表
// 参数: issueID 期ID
// 返回: 奖励集合与错误
func (s *service) ListIssueRewards(ctx context.Context, issueID int64) (items []*model.ActivityRewardSettings, err error) {
	items, err = s.readDB.ActivityRewardSettings.WithContext(ctx).Where(s.readDB.ActivityRewardSettings.IssueID.Eq(issueID)).Order(
		s.readDB.ActivityRewardSettings.IsBoss.Desc(),
		s.readDB.ActivityRewardSettings.Level.Asc(),
		s.readDB.ActivityRewardSettings.Sort.Asc(),
	).Find()
	if err != nil {
		return nil, err
	}
	return items, nil
}
