Просмотр исходного кода

add deal fund data and platform revenue data

tags/v0.0.2
shenjiachi 1 неделю назад
Родитель
Сommit
cb68a0ed34
11 измененных файлов: 126 добавлений и 33 удалений
  1. +6
    -1
      src/dao/egg_energy_fund_data_dao.go
  2. +6
    -1
      src/dao/egg_energy_fund_data_records_dao.go
  3. +6
    -1
      src/dao/platform_revenue_data_dao.go
  4. +7
    -1
      src/dao/platform_revenue_data_records_dao.go
  5. +18
    -0
      src/implement/egg_energy_fund_data_implement.go
  6. +20
    -0
      src/implement/egg_energy_fund_data_records_implement.go
  7. +18
    -0
      src/implement/platform_revenue_data_implement.go
  8. +22
    -0
      src/implement/platform_revenue_data_records_implement.go
  9. +2
    -1
      src/model/egg_energy_fund_data.go
  10. +10
    -13
      src/model/platform_revenue_data.go
  11. +11
    -15
      src/model/platform_revenue_data_records.go

+ 6
- 1
src/dao/egg_energy_fund_data_dao.go Просмотреть файл

@@ -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)
}

+ 6
- 1
src/dao/egg_energy_fund_data_records_dao.go Просмотреть файл

@@ -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)
}

+ 6
- 1
src/dao/platform_revenue_data_dao.go Просмотреть файл

@@ -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)
}

+ 7
- 1
src/dao/platform_revenue_data_records_dao.go Просмотреть файл

@@ -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)
}

+ 18
- 0
src/implement/egg_energy_fund_data_implement.go Просмотреть файл

@@ -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
}

+ 20
- 0
src/implement/egg_energy_fund_data_records_implement.go Просмотреть файл

@@ -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
}

+ 18
- 0
src/implement/platform_revenue_data_implement.go Просмотреть файл

@@ -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
}

+ 22
- 0
src/implement/platform_revenue_data_records_implement.go Просмотреть файл

@@ -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
}

+ 2
- 1
src/model/egg_energy_fund_data.go Просмотреть файл

@@ -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"`


+ 10
- 13
src/model/platform_revenue_data.go Просмотреть файл

@@ -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"`
}

+ 11
- 15
src/model/platform_revenue_data_records.go Просмотреть файл

@@ -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"`
}

Загрузка…
Отмена
Сохранить