接口增加lastminute
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user