Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 3 days ago
parent
commit
7d4bf7b5cb
2 changed files with 26 additions and 1 deletions
  1. +5
    -1
      src/dao/advertising_callback_dao.go
  2. +21
    -0
      src/implement/advertising_callback_implement.go

+ 5
- 1
src/dao/advertising_callback_dao.go View File

@@ -1,7 +1,11 @@
package dao package dao


import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)


type AdvertisingCallbackDao interface { type AdvertisingCallbackDao interface {
FindAdvertisingCallbackAndTotal(page, limit, amount, uid, startTime, endTime, platform, types string) (*[]model.AdvertisingCallback, int64, error) FindAdvertisingCallbackAndTotal(page, limit, amount, uid, startTime, endTime, platform, types string) (*[]model.AdvertisingCallback, int64, error)
AdvertisingCallbackCountBySession(session *xorm.Session, uid, startTime, endTime, types string) (int64, error)
} }

+ 21
- 0
src/implement/advertising_callback_implement.go View File

@@ -44,3 +44,24 @@ func (a AdvertisingCallbackDb) FindAdvertisingCallbackAndTotal(page, limit, amou
} }
return &m, count, nil return &m, count, nil
} }

func (a AdvertisingCallbackDb) AdvertisingCallbackCountBySession(session *xorm.Session, uid, startTime, endTime, types string) (int64, error) {
sess := session.Where("1=1")
if uid != "" {
sess.And("uid=?", uid)
}
if types != "" {
sess.And("type=?", types)
}
if startTime != "" {
sess.And("create_at>=?", startTime)
}
if endTime != "" {
sess.And("create_at<=?", endTime)
}
count, err := sess.Count(&model.AdvertisingCallback{})
if err != nil {
return 0, err
}
return count, nil
}

Loading…
Cancel
Save