Initial commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-09-29 11:47:47 +07:00
co-authored by Claude Opus 5.5
commit 0fbdba5ccf
622 changed files with 72105 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
package playletser
import (
"videoweb/app/service/configser"
)
const homeAdsPerBlock = 2
// AdSlice 从 detailbannerList 按偏移取 n 条;用尽后从头循环。仅做切片,不改字段名。
func AdSlice(list []configser.Advertisement, offset, n int) []configser.Advertisement {
ads := usableHomeAds(list)
if len(ads) == 0 || n <= 0 {
return nil
}
if offset < 0 {
offset = 0
}
out := make([]configser.Advertisement, 0, n)
for i := 0; i < n; i++ {
out = append(out, ads[(offset+i)%len(ads)])
}
return out
}
func usableHomeAds(list []configser.Advertisement) []configser.Advertisement {
if len(list) == 0 {
return nil
}
out := make([]configser.Advertisement, 0, len(list))
for _, item := range list {
if item.Images == "" {
continue
}
out = append(out, item)
}
return out
}