From 37ade34458aa3e86456b4f9873879563a88e6070 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 14 Aug 2019 10:15:28 +0800 Subject: [PATCH] =?UTF-8?q?-=20getOrders=E4=B8=AD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AF=B9=E6=97=B6=E9=97=B4=E5=AD=97=E7=AC=A6=E7=9A=84=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/orderman_ext.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 84a5581bf..5c33c44e4 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -295,21 +295,17 @@ func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, from vendorOrderID, } } else { - fromDate, err2 := utils.TryStr2Time(fromDateStr) + timeList, err2 := jxutils.BatchStr2Time(fromDateStr, toDateStr) if err = err2; err != nil { return nil, 0, err } - if utils.IsTimeZero(fromDate) { + if utils.IsTimeZero(timeList[0]) { return nil, 0, fmt.Errorf("在没有指定订单号时,必须指定查询日期范围") } - if toDateStr == "" { - toDateStr = fromDateStr + if utils.IsTimeZero(timeList[1]) { + timeList[1] = timeList[0] } - toDate, err2 := utils.TryStr2Time(toDateStr) - if err = err2; err != nil { - return nil, 0, err - } - toDate = toDate.Add(24 * time.Hour) + timeList[1] = timeList[1].Add(24 * time.Hour) if isDateFinish { sqlWhere = ` WHERE t1.order_finished_at >= ? AND t1.order_finished_at < ?` @@ -318,8 +314,8 @@ func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, from WHERE t1.order_created_at >= ? AND t1.order_created_at < ?` } sqlParams = []interface{}{ - fromDate, - toDate, + timeList[0], + timeList[1], } if params["keyword"] != nil { keyword := params["keyword"].(string)