feat 获取库存时只拿最近12小时的
Some checks failed
Build image / build (push) Failing after 1m1s

This commit is contained in:
timerzz 2024-12-03 21:16:59 +08:00
parent 285c498ba1
commit 8c73e7b4f7

View File

@ -1,6 +1,8 @@
package service
import (
"time"
"gitea.timerzz.com/kedaya_haitao/common/pkg/web"
"gitea.timerzz.com/kedaya_haitao/common/structs/storage"
"github.com/gofiber/fiber/v3"
@ -33,7 +35,7 @@ func (s *Tracer) List(c fiber.Ctx) error {
return err
}
articles, total, err := s.storage.ProviderArticle().List(*query, func(db *gorm.DB) *gorm.DB {
db = db.Preload("HistoryAts")
db = db.Preload("HistoryAts", "created_at > ?", time.Now().Add(-12*time.Hour))
return db
})
if err != nil {