Przeglądaj źródła

feat: add withdraw apply get by time

master
shenjiachi 1 tydzień temu
rodzic
commit
05318afe83
2 zmienionych plików z 10 dodań i 3 usunięć
  1. +1
    -1
      src/dao/fin_withdraw_apply_dao.go
  2. +9
    -2
      src/implement/fin_withdraw_apply_implement.go

+ 1
- 1
src/dao/fin_withdraw_apply_dao.go Wyświetl plik

@@ -8,7 +8,7 @@ import (
type FinWithdrawApplyDao interface {
FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error)
FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error)
FinWithdrawApplyAmountGetByParams(params map[string]interface{}) (float64, error)
FinWithdrawApplyAmountGetByParams(params map[string]interface{}, startAt, endAt string) (float64, error)
FinWithdrawApplyGet(id int64) (*model.FinWithdrawApply, error)
UpdateFinWithdrawApply(m *model.FinWithdrawApply, columns ...string) (int64, error)
UpdateFinWithdrawApplyBySession(session *xorm.Session, m *model.FinWithdrawApply, columns ...string) (int64, error)


+ 9
- 2
src/implement/fin_withdraw_apply_implement.go Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz