|
|
@@ -70,10 +70,17 @@ func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (f FinWithdrawApplyDb) FinWithdrawApplyAmountGetByParams(params map[string]interface{}) (float64, error) { |
|
|
|
func (f FinWithdrawApplyDb) FinWithdrawApplyAmountGetByParams(params map[string]interface{}, startAt, endAt string) (float64, error) { |
|
|
|
var m model.FinWithdrawApply |
|
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
|
total, err := f.Db.Where(query, params["value"]).Sum(m, "amount") |
|
|
|
sess := f.Db.Where(query, params["value"]) |
|
|
|
if startAt != "" { |
|
|
|
sess.Where("create_at >= ?", startAt) |
|
|
|
} |
|
|
|
if endAt != "" { |
|
|
|
sess.Where("create_at <= ?", endAt) |
|
|
|
} |
|
|
|
total, err := sess.Sum(m, "amount") |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|