This commit is contained in:
gazebo
2019-08-20 14:24:44 +08:00
parent 6bd473839c
commit 1a54bdd91d
2 changed files with 15 additions and 4 deletions

View File

@@ -176,7 +176,7 @@ func GetStoresOrderSaleInfo(db *DaoDB, storeIDList []int, fromTime time.Time, to
sql += fmt.Sprintf(`
UNION
SELECT IF(t0.jx_store_id > 0, t0.jx_store_id, t0.store_id) store_id, t0.vendor_id, -1 status,
COUNT(*) count, SUM(t1.shop_price) shop_price, SUM(t1.vendor_price) vendor_price, SUM(t1.sale_price) sale_price, 0 actual_pay_price,
COUNT(DISTINCT(t0.id)) count, SUM(t1.shop_price) shop_price, SUM(t1.vendor_price) vendor_price, SUM(t1.sale_price) sale_price, 0 actual_pay_price,
CAST(SUM(IF(t1.earning_price <> 0, t1.earning_price, IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t5.pay_percentage > 0, t5.pay_percentage, %d) / 100)) AS SIGNED) earning_price
FROM afs_order t0
JOIN order_sku_financial t2 ON t2.afs_order_id = t0.afs_order_id AND t2.vendor_id = t0.vendor_id AND t2.is_afs_order = 1
@@ -195,6 +195,7 @@ func GetStoresOrderSaleInfo(db *DaoDB, storeIDList []int, fromTime time.Time, to
GROUP BY 1,2,3`
sql += " ORDER BY 1,2,3"
// globals.SugarLogger.Debug(sql)
err = GetRows(db, &saleInfoList, sql, sqlParams...)
return saleInfoList, err
}