Browse Source

update ad callback count by type prefix

master
shenjiachi 2 days ago
parent
commit
0d8e6dd68a
2 changed files with 6 additions and 4 deletions
  1. +1
    -1
      src/dao/advertising_callback_dao.go
  2. +5
    -3
      src/implement/advertising_callback_implement.go

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

@@ -6,6 +6,6 @@ import (

type AdvertisingCallbackDao interface {
FindAdvertisingCallbackAndTotal(page, limit, amount, uid, startTime, endTime, platform, types string) (*[]model.AdvertisingCallback, int64, error)
AdvertisingCallbackCount(uid, startTime, endTime, types string) (int64, error)
AdvertisingCallbackCount(uid, startTime, endTime, typePrefix string) (int64, error)
AdvertisingCallbackDeleteByDateByPage(date string, limit int) (int64, error)
}

+ 5
- 3
src/implement/advertising_callback_implement.go View File

@@ -5,6 +5,7 @@ import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt"
"xorm.io/xorm"
)

@@ -45,13 +46,14 @@ func (a AdvertisingCallbackDb) FindAdvertisingCallbackAndTotal(page, limit, amou
return &m, count, nil
}

func (a AdvertisingCallbackDb) AdvertisingCallbackCount(uid, startTime, endTime, types string) (int64, error) {
func (a AdvertisingCallbackDb) AdvertisingCallbackCount(uid, startTime, endTime, typePrefix string) (int64, error) {
sess := a.Db.Where("1=1")
if uid != "" {
sess.And("uid=?", uid)
}
if types != "" {
sess.And("type=?", types)
if typePrefix != "" {
types := fmt.Sprintf("type LIKE '%s'", typePrefix+"%")
sess.And(types)
}
if startTime != "" {
sess.And("create_at>=?", startTime)


Loading…
Cancel
Save