|
|
@@ -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) AdvertisingCallbackCountBySession(session *xorm.Session, uid, startTime, endTime, types string) (int64, error) { |
|
|
|
sess := session.Where("1=1") |
|
|
|
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) |
|
|
@@ -65,3 +67,11 @@ func (a AdvertisingCallbackDb) AdvertisingCallbackCountBySession(session *xorm.S |
|
|
|
} |
|
|
|
return count, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (a AdvertisingCallbackDb) AdvertisingCallbackDeleteByDateByPage(date string, limit int) (int64, error) { |
|
|
|
affected, err := a.Db.Where("create_at < ?", date).Limit(limit).Delete(&model.AdvertisingCallback{}) |
|
|
|
if err != nil { |
|
|
|
return 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |