This commit is contained in:
苏尹岚
2021-01-04 10:20:10 +08:00
parent 5a38f81a4a
commit b186b7f551

View File

@@ -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