Commit 75f00400 authored by brent's avatar brent

modify recharge

parent 5dbf80ac
...@@ -282,15 +282,15 @@ func (server *FundsController) IncomeAndExpense() { ...@@ -282,15 +282,15 @@ func (server *FundsController) IncomeAndExpense() {
countQB, _ := orm.NewQueryBuilder("mysql") countQB, _ := orm.NewQueryBuilder("mysql")
countQB.Select("count(*)"). countQB.Select("count(*)").
From("funds") From("funds").Where("uid != '0'")
queryQB, _ := orm.NewQueryBuilder("mysql") queryQB, _ := orm.NewQueryBuilder("mysql")
queryQB.Select("*"). queryQB.Select("*").
From("funds") From("funds").Where("uid != '0'")
if info.Role != 1 && info.Role != 2 { if info.Role != 1 && info.Role != 2 {
countQB.Where(fmt.Sprintf("uid = '%d'", info.UserID)) countQB.And(fmt.Sprintf("uid = '%d'", info.UserID))
queryQB.Where(fmt.Sprintf("uid = '%d'", info.UserID)) queryQB.And(fmt.Sprintf("uid = '%d'", info.UserID))
} }
if appRequest.StartTime != "" && appRequest.EndTime != "" { if appRequest.StartTime != "" && appRequest.EndTime != "" {
...@@ -298,13 +298,8 @@ func (server *FundsController) IncomeAndExpense() { ...@@ -298,13 +298,8 @@ func (server *FundsController) IncomeAndExpense() {
startTime := fmt.Sprintf(temp.Format(format)) startTime := fmt.Sprintf(temp.Format(format))
temp, _ = time.Parse(layout, appRequest.EndTime) temp, _ = time.Parse(layout, appRequest.EndTime)
endTime := fmt.Sprintf(temp.Format(format)) endTime := fmt.Sprintf(temp.Format(format))
if info.Role == 1 || info.Role == 2 { countQB.And(fmt.Sprintf("time >= '%s'", startTime)).And(fmt.Sprintf("time <= '%s'", endTime))
countQB.Where(fmt.Sprintf("time >= '%s'", startTime)).And(fmt.Sprintf("time <= '%s'", endTime)) queryQB.And(fmt.Sprintf("time >= '%s'", startTime)).And(fmt.Sprintf("time <= '%s'", endTime))
queryQB.Where(fmt.Sprintf("time >= '%s'", startTime)).And(fmt.Sprintf("time <= '%s'", endTime))
} else {
countQB.And(fmt.Sprintf("time >= '%s'", startTime)).And(fmt.Sprintf("time <= '%s'", endTime))
queryQB.And(fmt.Sprintf("time >= '%s'", startTime)).And(fmt.Sprintf("time <= '%s'", endTime))
}
} }
if appRequest.TradeType != 0 { if appRequest.TradeType != 0 {
countQB.And(fmt.Sprintf("trade_type = %d", appRequest.TradeType)) countQB.And(fmt.Sprintf("trade_type = %d", appRequest.TradeType))
......
...@@ -132,9 +132,11 @@ func startDebit() { ...@@ -132,9 +132,11 @@ func startDebit() {
sql := fmt.Sprintf("SELECT time, uid,sum(fee) AS amount FROM bills WHERE time >= '%s' and time <= '%s' SAMPLE BY 1d ALIGN TO CALENDAR GROUP BY uid,time;", start, end) sql := fmt.Sprintf("SELECT time, uid,sum(fee) AS amount FROM bills WHERE time >= '%s' and time <= '%s' SAMPLE BY 1d ALIGN TO CALENDAR GROUP BY uid,time;", start, end)
data, err := postgres.CountFunds(sql) data, err := postgres.CountFunds(sql)
if err != nil { if err != nil {
logs.Debug("startDebit postgres CountFunds = %s", err.Error())
return return
} }
if data == nil { if data == nil {
logs.Debug("startDebit data = nil")
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment