From d1237af7167d59ed3084e6fe9c1b8896848f04b8 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 6 Mar 2019 16:36:44 +0800 Subject: [PATCH] - make lastOrderTime and lastOrderSeqID optional --- business/msghub/msghub.go | 8 +++----- controllers/cms.go | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/business/msghub/msghub.go b/business/msghub/msghub.go index 57e2917b3..dc7963c89 100644 --- a/business/msghub/msghub.go +++ b/business/msghub/msghub.go @@ -102,12 +102,10 @@ func unregisterChan(storeID int, chan2Listen chan<- *ServerMsg) { } func getPendingOrderList(storeID int, lastOrderTime time.Time, lastOrderSeqID int64) (orderList []*model.GoodsOrderExt, err error) { - if !jxutils.IsTimeEmpty(lastOrderTime) { - if time.Now().Sub(lastOrderTime) > maxGetOrderTimeDuration { - lastOrderTime = time.Now().Add(-maxGetOrderTimeDuration) - } - orderList, err = dao.GetStoreOrderAfterTime(dao.GetDB(), storeID, lastOrderTime, lastOrderSeqID) + if jxutils.IsTimeEmpty(lastOrderTime) || time.Now().Sub(lastOrderTime) > maxGetOrderTimeDuration { + lastOrderTime = time.Now().Add(-maxGetOrderTimeDuration) } + orderList, err = dao.GetStoreOrderAfterTime(dao.GetDB(), storeID, lastOrderTime, lastOrderSeqID) return orderList, err } diff --git a/controllers/cms.go b/controllers/cms.go index d1bb08c66..1a8df5b18 100644 --- a/controllers/cms.go +++ b/controllers/cms.go @@ -157,8 +157,8 @@ func (c *CmsController) GetProductInfoByBarCode() { // @Description 得到服务器消息通知 // @Param token header string true "认证token" // @Param storeID query int true "京西门店ID" -// @Param lastOrderTime query string true "最后订单时间" -// @Param lastOrderSeqID query string true "最后订单流水ID" +// @Param lastOrderTime query string false "最后订单时间(缺省为24小时内)" +// @Param lastOrderSeqID query string false "最后订单流水ID(缺省为0)" // @Param waitingSecond query int false "等待时间" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult