This commit is contained in:
苏尹岚
2021-02-25 17:18:09 +08:00
parent 966a11f394
commit 8f1d5a72d4
7 changed files with 120 additions and 26 deletions

View File

@@ -1035,7 +1035,7 @@ func GetStoreAcctIncomeTotal(db *DaoDB, storeID, incomeType int, fromTime, toTim
return income.IncomePrice, err
}
func GetStoreAcctExpend(db *DaoDB, storeID, expendType int, fromTime, toTime time.Time) (storeAcctExpends []*model.StoreAcctExpend, err error) {
func GetStoreAcctExpend(db *DaoDB, storeID, expendType int, vendorOrderID string, fromTime, toTime time.Time) (storeAcctExpends []*model.StoreAcctExpend, err error) {
sql := `
SELECT *
FROM store_acct_expend
@@ -1050,6 +1050,10 @@ func GetStoreAcctExpend(db *DaoDB, storeID, expendType int, fromTime, toTime tim
sql += " AND type = ?"
sqlParams = append(sqlParams, expendType)
}
if vendorOrderID != "" {
sql += " AND vendor_order_id = ?"
sqlParams = append(sqlParams, vendorOrderID)
}
if utils.IsTimeZero(fromTime) {
sql += " AND created_at >= ?"
sqlParams = append(sqlParams, fromTime)