Files
huangguo_server/skd/job/elastic/rdvideo/method.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

28 lines
647 B
Go

package rdvideo
import (
"91porn-server/common/constant/redisconst"
"91porn-server/common/log"
"91porn-server/common/redis"
"91porn-server/models/v/vidmod"
)
// SyncDataToRedis 同步数据到redis
func SyncDataToRedis(data []*vidmod.VideoModel) error {
if len(data) == 0 {
return nil
}
for _, v := range data {
if v.NewsType != vidmod.SHORT || (v.Status != vidmod.CheckPass && v.Status != vidmod.Free) {
// 去除
_, _ = redis.Handler.SRem(redisconst.ShortVideosKey, v.ID.Hex())
} else {
_, _ = redis.Handler.SAdd(redisconst.ShortVideosKey, v.ID.Hex())
}
}
log.Info("Redis sync video data completed.")
return nil
}