- 修复发送订单消息的BUG

This commit is contained in:
gazebo
2019-04-29 14:44:34 +08:00
parent b0e0d2b591
commit d8f1c33b93

View File

@@ -68,7 +68,7 @@ func routinueFunc() {
delete(channelMap[registerMsg.StoreID], registerMsg.Chan2Listen) delete(channelMap[registerMsg.StoreID], registerMsg.Chan2Listen)
close(registerMsg.Chan2Close) close(registerMsg.Chan2Close)
case ServerMsgNewOrder, ServerMsgKeyOrderStatusChanged: case ServerMsgNewOrder, ServerMsgKeyOrderStatusChanged:
globals.SugarLogger.Debugf("msghub routinueFunc, msg:%s", utils.Format4Output(msg, false)) globals.SugarLogger.Debugf("msghub routinueFunc, msg:%s", utils.Format4Output(msg, true))
utils.CallFuncAsync(func() { utils.CallFuncAsync(func() {
for chan2Send := range channelMap[msg.StoreID] { for chan2Send := range channelMap[msg.StoreID] {
chan2Send <- msg chan2Send <- msg
@@ -138,7 +138,7 @@ func GetMsg(ctx *jxcontext.Context, storeID int, lastOrderTime time.Time, lastOr
case msg2, ok := <-chan2Listen: case msg2, ok := <-chan2Listen:
timer.Stop() timer.Stop()
if ok { if ok {
msg.MsgData = msg2.MsgData msg = msg2
} }
case <-timer.C: case <-timer.C:
unregisterChan(storeID, chan2Listen) unregisterChan(storeID, chan2Listen)
@@ -152,7 +152,7 @@ func GetMsg(ctx *jxcontext.Context, storeID int, lastOrderTime time.Time, lastOr
} }
func OnNewOrder(order *model.GoodsOrder) { func OnNewOrder(order *model.GoodsOrder) {
globals.SugarLogger.Debugf("msghub OnNewOrder, order:%s", utils.Format4Output(order, false)) globals.SugarLogger.Debugf("msghub OnNewOrder, order:%s", utils.Format4Output(order, true))
utils.CallFuncAsync(func() { utils.CallFuncAsync(func() {
msgChan <- &ServerMsg{ msgChan <- &ServerMsg{
Type: ServerMsgNewOrder, Type: ServerMsgNewOrder,
@@ -168,7 +168,7 @@ func OnNewOrder(order *model.GoodsOrder) {
} }
func OnKeyOrderStatusChanged(order *model.GoodsOrder) { func OnKeyOrderStatusChanged(order *model.GoodsOrder) {
globals.SugarLogger.Debugf("msghub OnKeyOrderStatusChanged, order:%s", utils.Format4Output(order, false)) globals.SugarLogger.Debugf("msghub OnKeyOrderStatusChanged, order:%s", utils.Format4Output(order, true))
utils.CallFuncAsync(func() { utils.CallFuncAsync(func() {
msgChan <- &ServerMsg{ msgChan <- &ServerMsg{
Type: ServerMsgKeyOrderStatusChanged, Type: ServerMsgKeyOrderStatusChanged,