diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index fc5ab3c29..5c7a53f64 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -64,11 +64,11 @@ type OrderCount struct { Flag bool `json:"flag"` //true表示可以买 } -func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int, isIncludeFake bool) (countInfo []*model.GoodsOrderCountInfo, err error) { +func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours, lastMinutes int, isIncludeFake bool) (countInfo []*model.GoodsOrderCountInfo, err error) { globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%d", storeID) if lastHours > maxLastHours { lastHours = maxLastHours - } else if lastHours == 0 { + } else if lastHours == 0 && lastMinutes == 0 { lastHours = defLastHours } @@ -80,7 +80,12 @@ func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, l AND t1.order_created_at >= ?` sqlParams := []interface{}{ storeID, - time.Now().Add(-time.Duration(lastHours) * time.Hour), + // time.Now().Add(-time.Duration(lastHours) * time.Hour), + } + if lastMinutes != 0 { + sqlParams = append(sqlParams, time.Now().Add(-time.Duration(lastMinutes)*time.Minute)) + } else { + sqlParams = append(sqlParams, time.Now().Add(-time.Duration(lastMinutes)*time.Hour)) } if !isIncludeFake { sql += " AND (t1.flag & ?) = 0" diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 2398e74e8..fcc814a48 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -172,13 +172,14 @@ func (c *OrderController) CancelWaybill() { // @Param token header string true "认证token" // @Param storeID query int true "京西门店ID" // @Param lastHours query int false "最近多少小时的信息(缺省为两天)" +// @Param lastMinutes query int false "最近多少分钟的信息(缺省为不传)" // @Param isIncludeFake query bool false "是否包括假订单" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /GetStoreOrderCountInfo [get] func (c *OrderController) GetStoreOrderCountInfo() { c.callGetStoreOrderCountInfo(func(params *tOrderGetStoreOrderCountInfoParams) (retVal interface{}, errCode string, err error) { - retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo(params.Ctx, params.StoreID, params.LastHours, params.IsIncludeFake) + retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo(params.Ctx, params.StoreID, params.LastHours, params.LastMinutes, params.IsIncludeFake) return retVal, "", err }) }