diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index a1bc8f6a7..c9d64799e 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -254,14 +254,14 @@ func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile sqlParams2 := []interface{}{} getWhereSql2 := func() (sql string) { sql += ` AND order_type = ?` - sqlParams = append(sqlParams, model.OrderTpyeMember) + sqlParams2 = append(sqlParams2, model.OrderTpyeMember) if fromTime != utils.ZeroTimeValue { sql += ` AND created_at > ?` - sqlParams = append(sqlParams, fromTime) + sqlParams2 = append(sqlParams2, fromTime) } if toTime != utils.ZeroTimeValue { sql += ` AND created_at < ?` - sqlParams = append(sqlParams, toTime) + sqlParams2 = append(sqlParams2, toTime) } return sql } @@ -271,23 +271,23 @@ func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile if mobile != "" { if pop == 1 { sql2 += " JOIN user e ON e.moblie = ? AND a.pop_user = e.user_id" - sqlParams = append(sqlParams, mobile) + sqlParams2 = append(sqlParams2, mobile) } else { sql2 += " AND a.mobile = ?" - sqlParams = append(sqlParams, mobile) + sqlParams2 = append(sqlParams2, mobile) } } if len(cityCodes) > 0 { sql2 += ` AND a.city_code IN ` + GenQuestionMarks(len(cityCodes)) + `)` - sqlParams = append(sqlParams, cityCodes) + sqlParams2 = append(sqlParams2, cityCodes) } if userID != "" { if pop == 1 { sql2 += " AND a.pop_user = ?" - sqlParams = append(sqlParams, userID) + sqlParams2 = append(sqlParams2, userID) } else { sql2 += " AND a.user_id = ?" - sqlParams = append(sqlParams, userID) + sqlParams2 = append(sqlParams2, userID) } } sql2 += `) t1 @@ -296,14 +296,14 @@ func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile FROM user_bill b LEFT JOIN bill_expend c ON c.bill_id = b.bill_id AND c.type = ? ` - sqlParams = append(sqlParams, model.OrderTypePay, model.OrderStatusFinished, model.BillTypeMember) + sqlParams2 = append(sqlParams2, model.OrderTypePay, model.OrderStatusFinished, model.BillTypeMember) if fromTime != utils.ZeroTimeValue { sql2 += ` AND c.created_at > ?` - sqlParams = append(sqlParams, fromTime) + sqlParams2 = append(sqlParams2, fromTime) } if toTime != utils.ZeroTimeValue { sql2 += ` AND c.created_at < ?` - sqlParams = append(sqlParams, toTime) + sqlParams2 = append(sqlParams2, toTime) } sql2 += ` WHERE b.user_id = t1.user_id) t3