This commit is contained in:
parent
66959d8a58
commit
1afeea4423
@ -118,16 +118,16 @@ func (c *Controller) traceRange() {
|
||||
|
||||
if c.doTrace(tracer) {
|
||||
//如果蹲到了,需要通知
|
||||
//resp, err := pusher.Push(c.ctx, &push.PushReq{
|
||||
// Title: "coach 断货",
|
||||
// Content: fmt.Sprintf("coach 商品 %s 断货了\n库存为0\n链接:%s", tracer.pArticle.SkuID, tracer.pArticle.Link),
|
||||
//})
|
||||
//if err != nil {
|
||||
// glog.Errorf("消息推送失败:%v", err)
|
||||
//}
|
||||
//if resp.Code != 0 {
|
||||
// glog.Errorf("消息推送失败:%s", resp.Msg)
|
||||
//}
|
||||
resp, err := pusher.Push(c.ctx, &push.PushReq{
|
||||
Title: "coach 断货",
|
||||
Content: fmt.Sprintf("coach 商品 %s 断货了\n库存为0\n链接:%s", tracer.pArticle.SkuID, tracer.pArticle.Link),
|
||||
})
|
||||
if err != nil {
|
||||
glog.Errorf("消息推送失败:%v", err)
|
||||
}
|
||||
if resp.Code != 0 {
|
||||
glog.Errorf("消息推送失败:%s", resp.Msg)
|
||||
}
|
||||
tracer.pArticle.SetTraceAts(false)
|
||||
_ = c.storage.ProviderArticle().Update(*tracer.pArticle, "trace_ats")
|
||||
c.tracers.Remove(tracer.pArticle.SkuID)
|
||||
|
@ -16,6 +16,8 @@ import (
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/proxy"
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/redis"
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/web"
|
||||
"gitea.timerzz.com/kedaya_haitao/pusher/rpc/pusher"
|
||||
"github.com/cloudwego/kitex/client"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/gofiber/fiber/v3/middleware/cors"
|
||||
"github.com/gofiber/fiber/v3/middleware/recover"
|
||||
@ -45,7 +47,7 @@ func main() {
|
||||
glog.Fatalf("初始化redis失败:%v", err)
|
||||
}
|
||||
|
||||
//pusher.InitClient("pusher", client.WithHostPorts("pusher:8080"))
|
||||
pusher.InitClient("pusher", client.WithHostPorts("pusher:8080"))
|
||||
|
||||
// 代理池
|
||||
pool := proxy.NewProxyPool(cfg.Proxy.Subscribes)
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
coach_client "gitea.timerzz.com/kedaya_haitao/common/pkg/coach-client"
|
||||
"gitea.timerzz.com/kedaya_haitao/common/structs/storage"
|
||||
v2 "gitea.timerzz.com/kedaya_haitao/common/structs/v2"
|
||||
"gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push"
|
||||
"gitea.timerzz.com/kedaya_haitao/pusher/rpc/pusher"
|
||||
"github.com/golang/glog"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@ -114,17 +116,17 @@ func (c *Controller) watchRange() {
|
||||
}()
|
||||
|
||||
if c.doWatch(watcher) {
|
||||
//// 如果蹲到了,需要通知
|
||||
//resp, err := pusher.Push(c.ctx, &push.PushReq{
|
||||
// Title: "coach 补货",
|
||||
// Content: fmt.Sprintf("coach 商品 %s 补货\n库存:%d\n链接:%s", watcher.pArticle.SkuID, watcher.pArticle.Ats, watcher.pArticle.Link),
|
||||
//})
|
||||
//if err != nil {
|
||||
// glog.Errorf("消息推送失败:%v", err)
|
||||
//}
|
||||
//if resp.Code != 0 {
|
||||
// glog.Errorf("消息推送失败:%s", resp.Msg)
|
||||
//}
|
||||
// 如果蹲到了,需要通知
|
||||
resp, err := pusher.Push(c.ctx, &push.PushReq{
|
||||
Title: "coach 补货",
|
||||
Content: fmt.Sprintf("coach 商品 %s 补货\n库存:%d\n链接:%s", watcher.pArticle.SkuID, watcher.pArticle.Ats, watcher.pArticle.Link),
|
||||
})
|
||||
if err != nil {
|
||||
glog.Errorf("消息推送失败:%v", err)
|
||||
}
|
||||
if resp.Code != 0 {
|
||||
glog.Errorf("消息推送失败:%s", resp.Msg)
|
||||
}
|
||||
watcher.pArticle.SetWatch(false)
|
||||
_ = c.storage.ProviderArticle().Update(*watcher.pArticle, "watch")
|
||||
c.watchers.Remove(watcher.pArticle.SkuID)
|
||||
|
Loading…
Reference in New Issue
Block a user