Przeglądaj źródła

update and add total data

tags/v0.0.2
shenjiachi 1 miesiąc temu
rodzic
commit
4741e43ec5
11 zmienionych plików z 92 dodań i 8 usunięć
  1. +3
    -0
      src/dao/egg_energy_fund_data_dao.go
  2. +3
    -0
      src/dao/egg_energy_fund_data_records_dao.go
  3. +8
    -0
      src/dao/egg_energy_price_dao.go
  4. +2
    -2
      src/implement/egg_energy_available_energy_flow_implement.go
  5. +1
    -1
      src/implement/egg_energy_basic_setting_implement.go
  6. +4
    -4
      src/implement/egg_energy_community_dividends_implement.go
  7. +21
    -0
      src/implement/egg_energy_fund_data_implement.go
  8. +11
    -0
      src/implement/egg_energy_fund_data_records_implement.go
  9. +30
    -0
      src/implement/egg_energy_price_implement.go
  10. +1
    -1
      src/implement/user_virtual_coin_flow_implement.go
  11. +8
    -0
      src/model/egg_energy_price.go

+ 3
- 0
src/dao/egg_energy_fund_data_dao.go Wyświetl plik

@@ -1,5 +1,8 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyFundDataDao interface {
//TODO:: You can add specific method definitions here
EggEnergyFundDataFindAndCount(page, limit, kind int, startAt, endAt string) ([]model.EggEnergyFundData, int64, error)
}

+ 3
- 0
src/dao/egg_energy_fund_data_records_dao.go Wyświetl plik

@@ -1,5 +1,8 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyFundDataRecordsDao interface {
//TODO:: You can add specific method definitions here
EggEnergyFundDataRecordsFindAndCount(page, limit int, recordsID int) ([]model.EggEnergyFundDataRecords, int64, error)
}

+ 8
- 0
src/dao/egg_energy_price_dao.go Wyświetl plik

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

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyPriceDao interface {
//TODO:: You can add specific method definitions here
EggEnergyPriceList(startAt string, endAt string, hour string) ([]model.EggEnergyPrice, error)
}

+ 2
- 2
src/implement/egg_energy_available_energy_flow_implement.go Wyświetl plik

@@ -30,10 +30,10 @@ func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowFindAndCount
session = session.And("kind = ?", kind)
}
if startAt != "" {
session = session.Where("create_time > ?", startAt)
session = session.Where("create_time >= ?", startAt)
}
if endAt != "" {
session = session.Where("create_time < ?", endAt)
session = session.Where("create_time <= ?", endAt)
}
total, err := session.Limit(pageSize, (page-1)*pageSize).Desc("create_time").FindAndCount(&m)
if err != nil {


+ 1
- 1
src/implement/egg_energy_basic_setting_implement.go Wyświetl plik

@@ -43,7 +43,7 @@ func (e EggEnergyBasicSettingDb) EggEnergyBasicSettingGetOneByParams(params map[

func (e EggEnergyBasicSettingDb) EggEnergyBasicSettingGetOne() (*model.EggEnergyBasicSetting, error) {
var m *model.EggEnergyBasicSetting
_, err := e.Db.Where("id > ?", 1).Get(&m)
_, err := e.Db.Where("id >= ?", 1).Get(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err.Error())
}


+ 4
- 4
src/implement/egg_energy_community_dividends_implement.go Wyświetl plik

@@ -27,16 +27,16 @@ func (e EggEnergyCommunityDividendsDb) EggEnergyCommunityDividendsFindAndCount(p
var m []*model.EggEnergyCommunityDividends
session := e.Db.Where("")
if startAt != "" {
session = session.And("create_at > ?", startAt)
session = session.And("create_at >= ?", startAt)
}
if endAt != "" {
session = session.And("create_at < ?", endAt)
session = session.And("create_at <= ?", endAt)
}
if startNums != 0 {
session = session.And("nums > ?", startNums)
session = session.And("nums >= ?", startNums)
}
if endNums != 0 {
session = session.And("nums < ?", endNums)
session = session.And("nums <= ?", endNums)
}
total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&m)
if err != nil {


+ 21
- 0
src/implement/egg_energy_fund_data_implement.go Wyświetl plik

@@ -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,22 @@ func NewEggEnergyFundDataDb(engine *xorm.Engine) dao.EggEnergyFundDataDao {
type EggEnergyFundDataDb struct {
Db *xorm.Engine
}

func (e EggEnergyFundDataDb) EggEnergyFundDataFindAndCount(page, limit, kind int, startAt, endAt string) ([]model.EggEnergyFundData, int64, error) {
var m []model.EggEnergyFundData
session := e.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
}

+ 11
- 0
src/implement/egg_energy_fund_data_records_implement.go Wyświetl plik

@@ -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,12 @@ func NewEggEnergyFundDataRecordsDb(engine *xorm.Engine) dao.EggEnergyFundDataRec
type EggEnergyFundDataRecordsDb struct {
Db *xorm.Engine
}

func (e EggEnergyFundDataRecordsDb) EggEnergyFundDataRecordsFindAndCount(page, limit int, recordsID int) ([]model.EggEnergyFundDataRecords, int64, error) {
var m []model.EggEnergyFundDataRecords
total, err := e.Db.Where("records_id = ?", recordsID).Limit(limit, (page-1)*limit).FindAndCount(&m)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err.Error())
}
return m, total, nil
}

+ 30
- 0
src/implement/egg_energy_price_implement.go Wyświetl plik

@@ -0,0 +1,30 @@
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"
"errors"
"xorm.io/xorm"
)

func NewEggEnergyPriceDb(engine *xorm.Engine) dao.EggEnergyPriceDao {
return &EggEnergyPriceDb{Db: engine}
}

type EggEnergyPriceDb struct {
Db *xorm.Engine
}

func (e EggEnergyPriceDb) EggEnergyPriceList(startAt string, endAt string, hour string) ([]model.EggEnergyPrice, error) {
if startAt == "" || endAt == "" {
return nil, zhios_order_relate_logx.Error(errors.New("startAt or endAt can not be empty").Error())
}

var m []model.EggEnergyPrice
err := e.Db.Where("date >= ?", startAt).And("date <= ?", endAt).And("hour = ?", hour).Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err.Error())
}
return m, nil
}

+ 1
- 1
src/implement/user_virtual_coin_flow_implement.go Wyświetl plik

@@ -24,7 +24,7 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowInsertBySession(session *xorm.

func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int) ([]model.UserVirtualCoinFlow, int64, error) {
var m []model.UserVirtualCoinFlow
session := u.Db.Where("uid = ?", uid).And("coin_id = ?", coinID).And("create_at > ?", startAt).And("create_at < ?", endAt)
session := u.Db.Where("uid = ?", uid).And("coin_id = ?", coinID).And("create_at >= ?", startAt).And("create_at <= ?", endAt)
if direction != 0 {
session = session.And("direction = ?", direction)
}


+ 8
- 0
src/model/egg_energy_price.go Wyświetl plik

@@ -0,0 +1,8 @@
package model

type EggEnergyPrice struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Price string `json:"price" xorm:"not null default 0.0000000000 comment('价格') DECIMAL(28,10)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"`
Hour string `json:"hour" xorm:"not null default '00' comment('小时') CHAR(50)"`
}

Ładowanie…
Anuluj
Zapisz