京西折扣

This commit is contained in:
苏尹岚
2020-08-11 17:36:18 +08:00
parent f35854dd5e
commit 80f6238d83
3 changed files with 85 additions and 9 deletions

View File

@@ -16,6 +16,10 @@ const (
ActDiscountTypePrice = 1 //折扣类型是最低价
ActDiscountTypePercentage = 2 //折扣类型是最低折扣
TrendTypeUp = 1 //涨价趋势
TrendTypeDown = 2 //降价趋势
TrendTypeNothing = 0 //不变
ActOrderBegin = 10
ActOrderMoneyOff = 11
ActOrderMoneyOffCoupon = 12

View File

@@ -1345,3 +1345,25 @@ func GetAfsOrdersByPage(db *DaoDB, vendorOrderID, afsOrderID, userID string, fro
}
return afsOrderList, totalCount, err
}
func GetOrderStoreSkusCount(db *DaoDB, storeID, skuID int, fromTime, toTime time.Time) (count int64, err error) {
tmpOrderSku := &model.OrderSku{}
sql := `
SELECT SUM(a.count) count
FROM order_sku a
JOIN goods_order b ON a.vendor_order_id = b.vendor_order_id AND a.vendor_id = b.vendor_id
WHERE IF(b.store_id = 0, b.jx_store_id, b.store_id) = ?
AND a.sku_id = ?
AND b.order_created_at BETWEEN ? AND ?
`
sqlParams := []interface{}{
storeID,
skuID,
fromTime,
toTime,
}
if err = GetRow(db, &tmpOrderSku, sql, sqlParams); err == nil {
return int64(tmpOrderSku.Count), nil
}
return count, err
}