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)