Ver código fonte

add 平台营收

tags/v0.0.2
shenjiachi 1 semana atrás
pai
commit
2c14d9b262
6 arquivos alterados com 108 adições e 0 exclusões
  1. +9
    -0
      src/dao/platform_revenue_data_dao.go
  2. +6
    -0
      src/dao/platform_revenue_data_records_dao.go
  3. +43
    -0
      src/implement/platform_revenue_data_implement.go
  4. +14
    -0
      src/implement/platform_revenue_data_records_implement.go
  5. +17
    -0
      src/model/platform_revenue_data.go
  6. +19
    -0
      src/model/platform_revenue_data_records.go

+ 9
- 0
src/dao/platform_revenue_data_dao.go Ver arquivo

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

+ 6
- 0
src/dao/platform_revenue_data_records_dao.go Ver arquivo

@@ -0,0 +1,6 @@
package dao

type PlatformRevenueDataRecordsDao interface {
//TODO:: You can add specific method definitions here

}

+ 43
- 0
src/implement/platform_revenue_data_implement.go Ver arquivo

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

+ 14
- 0
src/implement/platform_revenue_data_records_implement.go Ver arquivo

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

+ 17
- 0
src/model/platform_revenue_data.go Ver arquivo

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

+ 19
- 0
src/model/platform_revenue_data_records.go Ver arquivo

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

Carregando…
Cancelar
Salvar