Compare commits
3 Commits
22c1cb4382
...
72606b30fc
Author | SHA1 | Date | |
---|---|---|---|
72606b30fc | |||
1e799ae1c2 | |||
03ad24f689 |
@ -36,6 +36,7 @@ func NewController(ctx context.Context, cfg *options.Config, client *coach_clien
|
|||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
providerId: cfg.ProviderId,
|
providerId: cfg.ProviderId,
|
||||||
interval: cfg.AtsInterval,
|
interval: cfg.AtsInterval,
|
||||||
|
threshold: cfg.AtsThreshold,
|
||||||
client: client,
|
client: client,
|
||||||
storage: storage.NewStorage(db),
|
storage: storage.NewStorage(db),
|
||||||
tracers: NewTracers(storage.NewStorage(db), cfg.ProviderId),
|
tracers: NewTracers(storage.NewStorage(db), cfg.ProviderId),
|
||||||
@ -158,7 +159,7 @@ func (c *Controller) doTrace(tracer *Tracer) (available bool) {
|
|||||||
if value := tracer.lastAts - article.Ats; value >= c.threshold {
|
if value := tracer.lastAts - article.Ats; value >= c.threshold {
|
||||||
_, _ = pusher.Push(c.ctx, &push.PushReq{
|
_, _ = pusher.Push(c.ctx, &push.PushReq{
|
||||||
Title: "coach 商品库存减少",
|
Title: "coach 商品库存减少",
|
||||||
Content: fmt.Sprintf("coach 商品 %s %s 减少了 %d \n链接:%s", tracer.pArticle.SkuID, c.interval, value, tracer.pArticle.Link),
|
Content: fmt.Sprintf("coach 商品 %s %s 减少了 %d \n链接:%s", tracer.pArticle.SkuID, time.Now().Sub(tracer.lastTraceTime).String(), value, tracer.pArticle.Link),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
c.storage.DB().Create(&v2.ProviderAts{
|
c.storage.DB().Create(&v2.ProviderAts{
|
||||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.22.2
|
|||||||
toolchain go1.22.3
|
toolchain go1.22.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gitea.timerzz.com/kedaya_haitao/common v0.0.0-20241202124532-436ec577c266
|
gitea.timerzz.com/kedaya_haitao/common v0.0.0-20241203012724-2cc7b5cfb70a
|
||||||
gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20241129135359-c16e02a7eab0
|
gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20241129135359-c16e02a7eab0
|
||||||
github.com/cloudwego/kitex v0.11.3
|
github.com/cloudwego/kitex v0.11.3
|
||||||
github.com/gofiber/fiber/v3 v3.0.0-beta.3
|
github.com/gofiber/fiber/v3 v3.0.0-beta.3
|
||||||
|
4
go.sum
4
go.sum
@ -1,6 +1,6 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
gitea.timerzz.com/kedaya_haitao/common v0.0.0-20241202124532-436ec577c266 h1:jD1LT+BPAORoQFIEShLkdN6x3CsiyZEMLwhKuX8Cm6s=
|
gitea.timerzz.com/kedaya_haitao/common v0.0.0-20241203012724-2cc7b5cfb70a h1:BfHVMbA29/0KLg4Nv0PQVnca1pwJp7EQqjsth6A0CBY=
|
||||||
gitea.timerzz.com/kedaya_haitao/common v0.0.0-20241202124532-436ec577c266/go.mod h1:BIz+IMGznPiyLnV1+Ntw1zf8rEIcbymmGq+EfvDsSgE=
|
gitea.timerzz.com/kedaya_haitao/common v0.0.0-20241203012724-2cc7b5cfb70a/go.mod h1:BIz+IMGznPiyLnV1+Ntw1zf8rEIcbymmGq+EfvDsSgE=
|
||||||
gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20241129135359-c16e02a7eab0 h1:WMNOErbI6At865VWI3sN74RMQaZ8ZhwsNSB9A4vg/6Q=
|
gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20241129135359-c16e02a7eab0 h1:WMNOErbI6At865VWI3sN74RMQaZ8ZhwsNSB9A4vg/6Q=
|
||||||
gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20241129135359-c16e02a7eab0/go.mod h1:nRdxwOP3hhkUdH3PjHq3gt8SA+YEfR/d7Ig9DuQQZQY=
|
gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20241129135359-c16e02a7eab0/go.mod h1:nRdxwOP3hhkUdH3PjHq3gt8SA+YEfR/d7Ig9DuQQZQY=
|
||||||
github.com/3andne/restls-client-go v0.1.6 h1:tRx/YilqW7iHpgmEL4E1D8dAsuB0tFF3uvncS+B6I08=
|
github.com/3andne/restls-client-go v0.1.6 h1:tRx/YilqW7iHpgmEL4E1D8dAsuB0tFF3uvncS+B6I08=
|
||||||
|
Loading…
Reference in New Issue
Block a user