diff --git a/src/dao/advertising_callback_dao.go b/src/dao/advertising_callback_dao.go new file mode 100644 index 0000000..4da97db --- /dev/null +++ b/src/dao/advertising_callback_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type AdvertisingCallbackDao interface { + FindAdvertisingCallbackAndTotal(page, limit, amount, uid, startTime, endTime, platform, types string) (*[]model.AdvertisingCallback, int64, error) +} diff --git a/src/implement/advertising_callback_implement.go b/src/implement/advertising_callback_implement.go new file mode 100644 index 0000000..c602763 --- /dev/null +++ b/src/implement/advertising_callback_implement.go @@ -0,0 +1,46 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "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" + "xorm.io/xorm" +) + +func NewAdvertisingCallbackDb(engine *xorm.Engine) dao.AdvertisingCallbackDao { + return &AdvertisingCallbackDb{Db: engine} +} + +type AdvertisingCallbackDb struct { + Db *xorm.Engine +} + +func (a AdvertisingCallbackDb) FindAdvertisingCallbackAndTotal(page, limit, amount, uid, startTime, endTime, platform, types string) (*[]model.AdvertisingCallback, int64, error) { + var m []model.AdvertisingCallback + sess := a.Db.Where("1=1") + if amount != "" { + sess.And("amount<=?", amount) + } + if uid != "" { + sess.And("uid=?", uid) + } + if platform != "" { + sess.And("platform=?", platform) + } + if types != "" { + sess.And("type=?", types) + } + if startTime != "" { + sess.And("create_at>=?", startTime) + } + if endTime != "" { + sess.And("create_at<=?", endTime) + } + start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) + count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m) + if err != nil { + return nil, count, zhios_order_relate_logx.Error(err) + } + return &m, count, nil +} diff --git a/src/model/advertising_callback.go b/src/model/advertising_callback.go index d841239..16659cf 100644 --- a/src/model/advertising_callback.go +++ b/src/model/advertising_callback.go @@ -15,5 +15,6 @@ type AdvertisingCallback struct { IsRun int `json:"is_run" xorm:"default 0 INT(1)"` CreateAt time.Time `json:"create_at" xorm:"DATETIME"` UniqId string `json:"uniq_id" xorm:"VARCHAR(255)"` - Integral string `json:"integral" xorm:"comment('积分') VARCHAR(255)"` + Integral string `json:"integral" xorm:"default 0.00000000 comment('积分') DECIMAL(30,8)"` + Type string `json:"type" xorm:"VARCHAR(255)"` }