You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
752 B
36 lines
752 B
package service |
|
|
|
import ( |
|
"context" |
|
|
|
favmdl "go-common/app/service/main/favorite/model" |
|
"go-common/library/log" |
|
"go-common/library/net/metadata" |
|
) |
|
|
|
// favoriteds return aids is favs. |
|
func (s *Service) favoriteds(c context.Context, mid int64, aids []int64) (res map[int64]bool) { |
|
var n = 50 |
|
res = make(map[int64]bool, len(aids)) |
|
for len(aids) > 0 { |
|
if n > len(aids) { |
|
n = len(aids) |
|
} |
|
arg := &favmdl.ArgIsFavs{ |
|
Type: favmdl.TypeVideo, |
|
Mid: mid, |
|
Oids: aids[:n], |
|
RealIP: metadata.String(c, metadata.RemoteIP), |
|
} |
|
favMap, err := s.favRPC.IsFavs(c, arg) |
|
if err != nil { |
|
log.Error("s.favRPC.IsFavs(%v) error(%v)", arg, err) |
|
return |
|
} |
|
aids = aids[n:] |
|
for k, v := range favMap { |
|
res[k] = v |
|
} |
|
} |
|
return |
|
}
|
|
|