diff --git a/src/dao/platform_revenue_data_dao.go b/src/dao/platform_revenue_data_dao.go new file mode 100644 index 0000000..03c6c27 --- /dev/null +++ b/src/dao/platform_revenue_data_dao.go @@ -0,0 +1,9 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type PlatformRevenueDataDao interface { + //TODO:: You can add specific method definitions here + PlatformRevenueDataInsert(platformRevenueData *model.PlatformRevenueData) (int, error) + PlatformRevenueDataFindAndCount(page, limit int, startAt, endAt string, kind int) ([]model.PlatformRevenueData, int64, error) +} diff --git a/src/dao/platform_revenue_data_records_dao.go b/src/dao/platform_revenue_data_records_dao.go new file mode 100644 index 0000000..0f05d05 --- /dev/null +++ b/src/dao/platform_revenue_data_records_dao.go @@ -0,0 +1,6 @@ +package dao + +type PlatformRevenueDataRecordsDao interface { + //TODO:: You can add specific method definitions here + +} diff --git a/src/implement/platform_revenue_data_implement.go b/src/implement/platform_revenue_data_implement.go new file mode 100644 index 0000000..000a33c --- /dev/null +++ b/src/implement/platform_revenue_data_implement.go @@ -0,0 +1,43 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "xorm.io/xorm" +) + +func NewPlatformRevenueDataDb(engine *xorm.Engine) dao.PlatformRevenueDataDao { + return &PlatformRevenueDataDb{Db: engine} +} + +type PlatformRevenueDataDb struct { + Db *xorm.Engine +} + +func (p PlatformRevenueDataDb) PlatformRevenueDataInsert(platformRevenueData *model.PlatformRevenueData) (int, error) { + _, err := p.Db.InsertOne(platformRevenueData) + if err != nil { + return 0, err + } + return platformRevenueData.Id, nil +} + +func (p PlatformRevenueDataDb) PlatformRevenueDataFindAndCount(page, limit int, startAt, endAt string, kind int) ([]model.PlatformRevenueData, int64, error) { + var m []model.PlatformRevenueData + session := p.Db.Where("") + if kind > 0 { + session = session.Where("kind = ?", kind) + } + if startAt != "" { + session = session.Where("start_at >= ?", startAt) + } + if endAt != "" { + session = session.Where("end_at <= ?", endAt) + } + total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&m) + if err != nil { + return nil, 0, zhios_order_relate_logx.Error(err.Error()) + } + return m, total, nil +} diff --git a/src/implement/platform_revenue_data_records_implement.go b/src/implement/platform_revenue_data_records_implement.go new file mode 100644 index 0000000..84e40fb --- /dev/null +++ b/src/implement/platform_revenue_data_records_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewPlatformRevenueDataRecordsDb(engine *xorm.Engine) dao.PlatformRevenueDataRecordsDao { + return &PlatformRevenueDataRecordsDb{Db: engine} +} + +type PlatformRevenueDataRecordsDb struct { + Db *xorm.Engine +} diff --git a/src/model/platform_revenue_data.go b/src/model/platform_revenue_data.go new file mode 100644 index 0000000..31a95e9 --- /dev/null +++ b/src/model/platform_revenue_data.go @@ -0,0 +1,17 @@ +package model + +import ( + "time" +) + +type PlatformRevenueData struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Kind int `json:"kind" xorm:"not null default 1 comment('种类(1:开屏广告 2:banner广告 3:信息流广告 4:插屏广告)') TINYINT(1)"` + TotalAmount string `json:"total_amount" xorm:"not null comment('金额') DECIMAL(28,10)"` + BalanceAmount string `json:"balance_amount" xorm:"not null comment('余额') DECIMAL(28,10)"` + Hours int `json:"hours" xorm:"not null default 1 comment('时长(小时)') TINYINT(3)"` + BalanceTimes int `json:"balance_times" xorm:"not null default 1 comment('剩余执行次数') TINYINT(3)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/platform_revenue_data_records.go b/src/model/platform_revenue_data_records.go new file mode 100644 index 0000000..7de9948 --- /dev/null +++ b/src/model/platform_revenue_data_records.go @@ -0,0 +1,19 @@ +package model + +import ( + "time" +) + +type PlatformRevenueDataRecords struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + RecordsId int `json:"records_id" xorm:"not null default 0 comment('记录id') INT(11)"` + TotalAmount string `json:"total_amount" xorm:"not null comment('金额') DECIMAL(28,10)"` + BalanceAmount string `json:"balance_amount" xorm:"not null comment('余额') DECIMAL(28,10)"` + BalanceTimes int `json:"balance_times" xorm:"not null default 1 comment('剩余执行次数') TINYINT(3)"` + BeforePrice string `json:"before_price" xorm:"not null comment('执行前-价格') DECIMAL(28,10)"` + AfterPrice string `json:"after_price" xorm:"not null comment('执行后-价格') DECIMAL(28,10)"` + BeforePlanetTotalValue string `json:"before_planet_total_value" xorm:"not null comment('执行前-星球价值') DECIMAL(28,10)"` + AfterPlanetTotalValue string `json:"after_planet_total_value" xorm:"not null comment('执行后-星球价值') DECIMAL(28,10)"` + CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +}