diff --git a/conf/dadi.json b/conf/dadi.json index ac2fa8d..83c3397 100644 --- a/conf/dadi.json +++ b/conf/dadi.json @@ -1,4 +1,5 @@ { + "enable": true, "bidProfit": 50, "couponCost": 3000 } \ No newline at end of file diff --git a/config/daid.go b/config/daid.go index 55685a2..152a463 100644 --- a/config/daid.go +++ b/config/daid.go @@ -6,6 +6,7 @@ import ( ) type Dadi struct { + Enable bool `json:"enable"` BidProfit int64 `json:"bidProfit"` CouponCost int64 `json:"couponCost"` } diff --git a/worker/worker.go b/worker/worker.go index 31acb53..f135b29 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -65,16 +65,6 @@ func (w *Worker) processorDadi(order *model.Order) { return } - //hahaProcessor.BidPrice(order.Id, checkInfo.UnitPrice) - go func() { - /* - time.Sleep(60 * time.Second) - if err := dadiProcessor.CancelOrder(order, checkInfo); err != nil { - log.Errorf("cancel order[%s] error[%s]", order.OrderId, err.Error()) - } - */ - }() - bidStatus := false realCost := checkInfo.TotalRealPrice + int64(goutil.If(checkInfo.CouponPrice > 0, config.GetDadiConfig().CouponCost, 0)) realUnitCost := realCost / int64(order.SeatNum) @@ -144,9 +134,12 @@ func (w *Worker) Run() { if !strings.Contains(order.CinemaName, "大地影院") { continue } - w.processorDadi(order) + if config.GetDadiConfig().Enable { + w.processorDadi(order) + } + case updateOrder := <-updateOrderChan: - log.Debugf("update:", goutil.EncodeJSON(updateOrder)) + log.Tracef("%s update", updateOrder.String()) } }