接口增加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"
|
||||
|
||||
Reference in New Issue
Block a user