mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-23 08:04:45 +08:00
fix: remove unused preload/snapshot functions and fix gofmt
This commit is contained in:
@@ -2119,6 +2119,35 @@ func (s *adminServiceImpl) checkMixedChannelRisk(ctx context.Context, currentAcc
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *adminServiceImpl) validateGroupIDsExist(ctx context.Context, groupIDs []int64) error {
|
||||||
|
if len(groupIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if s.groupRepo == nil {
|
||||||
|
return errors.New("group repository not configured")
|
||||||
|
}
|
||||||
|
|
||||||
|
if batchReader, ok := s.groupRepo.(groupExistenceBatchReader); ok {
|
||||||
|
existsByID, err := batchReader.ExistsByIDs(ctx, groupIDs)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("check groups exists: %w", err)
|
||||||
|
}
|
||||||
|
for _, groupID := range groupIDs {
|
||||||
|
if groupID <= 0 || !existsByID[groupID] {
|
||||||
|
return fmt.Errorf("get group: %w", ErrGroupNotFound)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, groupID := range groupIDs {
|
||||||
|
if _, err := s.groupRepo.GetByID(ctx, groupID); err != nil {
|
||||||
|
return fmt.Errorf("get group: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// CheckMixedChannelRisk checks whether target groups contain mixed channels for the current account platform.
|
// CheckMixedChannelRisk checks whether target groups contain mixed channels for the current account platform.
|
||||||
func (s *adminServiceImpl) CheckMixedChannelRisk(ctx context.Context, currentAccountID int64, currentAccountPlatform string, groupIDs []int64) error {
|
func (s *adminServiceImpl) CheckMixedChannelRisk(ctx context.Context, currentAccountID int64, currentAccountPlatform string, groupIDs []int64) error {
|
||||||
return s.checkMixedChannelRisk(ctx, currentAccountID, currentAccountPlatform, groupIDs)
|
return s.checkMixedChannelRisk(ctx, currentAccountID, currentAccountPlatform, groupIDs)
|
||||||
|
|||||||
Reference in New Issue
Block a user