@@ -1,9 +1,14 @@ | |||
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 EggEnergyFundDataDao interface { | |||
//TODO:: You can add specific method definitions here | |||
EggEnergyFundDataFindAndCount(page, limit, kind int, startAt, endAt string) ([]model.EggEnergyFundData, int64, error) | |||
EggEnergyFundDataInsert(eggEnergyFundData *model.EggEnergyFundData) (int, error) | |||
EggEnergyFundDataFindNotFinish() ([]model.EggEnergyFundData, error) | |||
EggEnergyFundDataUpdateBySession(session *xorm.Session, m model.EggEnergyFundData, forceColumns ...string) (int64, error) | |||
} |
@@ -1,8 +1,13 @@ | |||
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 EggEnergyFundDataRecordsDao interface { | |||
//TODO:: You can add specific method definitions here | |||
EggEnergyFundDataRecordsFindAndCount(page, limit int, recordsID int) ([]model.EggEnergyFundDataRecords, int64, error) | |||
EggEnergyFundDataRecordsGetLast(id int) (*model.EggEnergyFundDataRecords, error) | |||
EggEnergyFundDataRecordsInsertBySession(session *xorm.Session, record model.EggEnergyFundDataRecords) (int, error) | |||
} |
@@ -1,9 +1,14 @@ | |||
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 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) | |||
PlatformRevenueDataFindNotFinish() ([]model.PlatformRevenueData, error) | |||
PlatformRevenueDataUpdateBySession(session *xorm.Session, m model.PlatformRevenueData, forceColumns ...string) (int64, error) | |||
} |
@@ -1,6 +1,12 @@ | |||
package dao | |||
import ( | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
"xorm.io/xorm" | |||
) | |||
type PlatformRevenueDataRecordsDao interface { | |||
//TODO:: You can add specific method definitions here | |||
PlatformRevenueDataRecordsGetLast(id int) (*model.PlatformRevenueDataRecords, error) | |||
PlatformRevenueDataRecordsInsertBySession(session *xorm.Session, record model.PlatformRevenueDataRecords) (int, error) | |||
} |
@@ -41,3 +41,21 @@ func (e EggEnergyFundDataDb) EggEnergyFundDataInsert(eggEnergyFundData *model.Eg | |||
} | |||
return eggEnergyFundData.Id, nil | |||
} | |||
func (e EggEnergyFundDataDb) EggEnergyFundDataFindNotFinish() ([]model.EggEnergyFundData, error) { | |||
var m []model.EggEnergyFundData | |||
err := e.Db.Where("balance_times > ?", 0).Find(&m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
return m, nil | |||
} | |||
func (e EggEnergyFundDataDb) EggEnergyFundDataUpdateBySession(session *xorm.Session, m model.EggEnergyFundData, forceColumns ...string) (int64, error) { | |||
affected, err := session.ID(m.Id).Cols(forceColumns...).Update(&m) | |||
if err != nil { | |||
return 0, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
return affected, nil | |||
} |
@@ -23,3 +23,23 @@ func (e EggEnergyFundDataRecordsDb) EggEnergyFundDataRecordsFindAndCount(page, l | |||
} | |||
return m, total, nil | |||
} | |||
func (e EggEnergyFundDataRecordsDb) EggEnergyFundDataRecordsGetLast(id int) (*model.EggEnergyFundDataRecords, error) { | |||
var m model.EggEnergyFundDataRecords | |||
has, err := e.Db.Where("records_id = ?", id).Desc("create_at").Get(&m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
if !has { | |||
return nil, nil | |||
} | |||
return &m, nil | |||
} | |||
func (e EggEnergyFundDataRecordsDb) EggEnergyFundDataRecordsInsertBySession(session *xorm.Session, record model.EggEnergyFundDataRecords) (int, error) { | |||
_, err := session.InsertOne(record) | |||
if err != nil { | |||
return 0, err | |||
} | |||
return record.Id, nil | |||
} |
@@ -41,3 +41,21 @@ func (p PlatformRevenueDataDb) PlatformRevenueDataFindAndCount(page, limit int, | |||
} | |||
return m, total, nil | |||
} | |||
func (p PlatformRevenueDataDb) PlatformRevenueDataFindNotFinish() ([]model.PlatformRevenueData, error) { | |||
var m []model.PlatformRevenueData | |||
err := p.Db.Where("balance_times > ?", 0).Find(&m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
return m, nil | |||
} | |||
func (p PlatformRevenueDataDb) PlatformRevenueDataUpdateBySession(session *xorm.Session, m model.PlatformRevenueData, forceColumns ...string) (int64, error) { | |||
affected, err := session.ID(m.Id).Cols(forceColumns...).Update(&m) | |||
if err != nil { | |||
return 0, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
return affected, nil | |||
} |
@@ -2,6 +2,8 @@ | |||
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" | |||
) | |||
@@ -12,3 +14,23 @@ func NewPlatformRevenueDataRecordsDb(engine *xorm.Engine) dao.PlatformRevenueDat | |||
type PlatformRevenueDataRecordsDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (p PlatformRevenueDataRecordsDb) PlatformRevenueDataRecordsGetLast(id int) (*model.PlatformRevenueDataRecords, error) { | |||
var m model.PlatformRevenueDataRecords | |||
has, err := p.Db.Where("records_id = ?", id).Desc("create_at").Get(&m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
if !has { | |||
return nil, nil | |||
} | |||
return &m, nil | |||
} | |||
func (p PlatformRevenueDataRecordsDb) PlatformRevenueDataRecordsInsertBySession(session *xorm.Session, record model.PlatformRevenueDataRecords) (int, error) { | |||
_, err := session.InsertOne(record) | |||
if err != nil { | |||
return 0, err | |||
} | |||
return record.Id, nil | |||
} |
@@ -6,7 +6,8 @@ type EggEnergyFundData struct { | |||
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)"` | |||
BalanceTimes int `js.\cmd_db.baton:"balance_times" xorm:"not null default 1 comment('剩余执行次数') TINYINT(3)"` | |||
Frequency int `json:"frequency" xorm:"not null default 1 comment('频率(分钟)') TINYINT(3)"` | |||
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` | |||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||
@@ -1,17 +1,14 @@ | |||
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"` | |||
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)"` | |||
Frequency int `json:"frequency" xorm:"not null default 1 comment('频率(分钟)') TINYINT(3)"` | |||
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` | |||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||
} |
@@ -1,19 +1,15 @@ | |||
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"` | |||
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 string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||
} |