mirror of http://gitlab.batiao8.com/yic/film.git
bidprice5
This commit is contained in:
parent
311a849f80
commit
d53f466e2d
|
@ -17,8 +17,10 @@ import (
|
|||
|
||||
type Worker struct {
|
||||
qyClient *wxapi.WxQiye
|
||||
qyImpClient *wxapi.WxQiye
|
||||
dadiProcessor common.Processor
|
||||
hahaProcessor *haha.Processor
|
||||
notifyMap map[string]int64
|
||||
}
|
||||
|
||||
func (w *Worker) initQyWeixin() {
|
||||
|
@ -28,6 +30,11 @@ func (w *Worker) initQyWeixin() {
|
|||
Secret: cfg.Weixin.Qiyesecret,
|
||||
Sender: cfg.Weixin.QiyeAgent,
|
||||
})
|
||||
w.qyImpClient = wxapi.NewQiye(&wxapi.QiyeConfig{
|
||||
Corpid: "ww288920bd3e8c92b2",
|
||||
Secret: "-RtxFJMwM0j_4QJbHrstHuLSIzMU1Q_euJSeWmhtOTM",
|
||||
Sender: "1000002",
|
||||
})
|
||||
}
|
||||
|
||||
func (w *Worker) getOrderMesasge(order *model.Order) []string {
|
||||
|
@ -99,9 +106,8 @@ func (w *Worker) processorDadi(order *model.Order) {
|
|||
message = append(message, fmt.Sprintf("状态:%s", goutil.If(bidStatus, "竞价中", "不可竞价")))
|
||||
message = append(message, fmt.Sprintf("出价:%s", util.MoneyFen(bidPrice)))
|
||||
|
||||
if err := w.qyClient.SendText([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
|
||||
log.Errorf("send message error : %s", err.Error())
|
||||
}
|
||||
w.qyClient.SendText(config.GetConfig().Weixin.Receiver, strings.Join(message, "\n"))
|
||||
|
||||
}
|
||||
|
||||
func (w *Worker) processBidWin() {
|
||||
|
@ -115,12 +121,18 @@ func (w *Worker) processBidWin() {
|
|||
log.Errorf("get order error : %s", err.Error())
|
||||
continue
|
||||
}
|
||||
nowTime := time.Now().Unix()
|
||||
if v, ok := w.notifyMap[order.OrderNo]; ok && nowTime-v < 300 {
|
||||
continue
|
||||
}
|
||||
message := w.getOrderMesasge(order)
|
||||
message = append(message, "\n")
|
||||
message = append(message, "【竞价成功】")
|
||||
message = append(message, fmt.Sprintf("出价:%s", util.MoneyFen(o.BidPrice)))
|
||||
message = append(message, fmt.Sprintf("时间:%s", goutil.TimeToDateTime(o.BidTime)))
|
||||
w.qyClient.SendText(config.GetConfig().Weixin.Receiver, strings.Join(message, "\n"))
|
||||
if err := w.qyImpClient.SendText(config.GetConfig().Weixin.Receiver, strings.Join(message, "\n")); err == nil {
|
||||
w.notifyMap[order.OrderNo] = nowTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,9 +148,7 @@ func (w *Worker) Run() {
|
|||
})
|
||||
|
||||
hahaSyncer.Sync()
|
||||
|
||||
//order, _ := model.GetOrder(590623)
|
||||
//newOrderChan <- order
|
||||
w.notifyMap = make(map[string]int64)
|
||||
|
||||
w.hahaProcessor = haha.NewProcessor(&haha.ProcessorConfig{Token: config.GetHahaConfig().Token})
|
||||
if config.GetDadiConfig().Enable {
|
||||
|
@ -149,6 +159,13 @@ func (w *Worker) Run() {
|
|||
w.dadiProcessor = dadiProcessor
|
||||
}
|
||||
|
||||
//order, _ := model.GetOrder(594315)
|
||||
//_, err := w.dadiProcessor.CreateOrder(order)
|
||||
//if err != nil {
|
||||
//log.Errorf("create order[%s] error [%s]", order.String(), err.Error())
|
||||
//}
|
||||
//newOrderChan <- order
|
||||
|
||||
bidUploadTimer := time.NewTicker(10 * time.Second)
|
||||
for {
|
||||
select {
|
||||
|
|
Loading…
Reference in New Issue