- GetStoreOrderCountInfo2

This commit is contained in:
gazebo
2019-04-23 09:31:36 +08:00
parent f1e900dbd5
commit 58b299de2c
6 changed files with 62 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ type tWaybillExt struct {
StoreID int `json:"storeID" orm:"column(store_id)"`
}
//此函数会被GetStoreOrderCountInfo2取代
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID string, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%s", storeID)
if lastHours > maxLastHours {
@@ -51,6 +52,30 @@ func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID st
return nil, err
}
func (c *OrderManager) GetStoreOrderCountInfo2(ctx *jxcontext.Context, storeID, lastHours int) (countInfo []*model.GoodsOrderCountInfo2, err error) {
globals.SugarLogger.Debugf("GetStoreOrderCountInfo2 storeID:%s", storeID)
if lastHours > maxLastHours {
lastHours = maxLastHours
} else if lastHours == 0 {
lastHours = defLastHours
}
db := dao.GetDB()
err = dao.GetRows(db, &countInfo, `
SELECT t1.lock_status, t1.status, COUNT(*) count
FROM goods_order t1
WHERE t1.vendor_id <> 2 AND IF(t1.vendor_id = ?, t1.store_id, IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) ) = ?
AND t1.order_created_at >= ?
GROUP BY 1,2
ORDER BY 1,2
`, model.VendorIDWSC, storeID, time.Now().Add(-time.Duration(lastHours)*time.Hour))
if err == nil {
return countInfo, nil
}
globals.SugarLogger.Infof("GetStoreOrderCountInfo2 storeID:%s failed with error:%v", storeID, err)
return nil, err
}
func (c *OrderManager) GetOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (skus []*model.OrderSkuExt, err error) {
globals.SugarLogger.Debugf("GetOrderSkuInfo orderID:%s", vendorOrderID)