Browse Source

update

master
dengbiao 4 months ago
parent
commit
6380c884a3
6 changed files with 107 additions and 4 deletions
  1. +3
    -1
      src/dao/honey_dividend_basic_dao.go
  2. +9
    -0
      src/dao/honey_dividends_records_dao.go
  3. +10
    -0
      src/dao/honey_dividends_records_with_flow_dao.go
  4. +31
    -3
      src/implement/honey_dividend_basic_db.go
  5. +31
    -0
      src/implement/honey_dividends_records_db.go
  6. +23
    -0
      src/implement/honey_dividends_records_with_flow_db.go

+ 3
- 1
src/dao/honey_dividend_basic_dao.go View File

@@ -1,4 +1,4 @@
package dao
package dao

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
@@ -8,4 +8,6 @@ import (
type HoneyDividendBasicDao interface {
GetHoneyDividendBasicByCoinId(coinId int) (m *models.HoneyDividendBasic, err error)
GetHoneyDividendBasicByCoinIdSess(sess *xorm.Session, coinId int) (m *models.HoneyDividendBasic, err error)
GetHoneyDividendBasic() (m *models.HoneyDividendBasic, err error)
UpdateHoneyDividendBasic(m *models.HoneyDividendBasic, forceColums ...string) (int64, error)
}

+ 9
- 0
src/dao/honey_dividends_records_dao.go View File

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

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
)

type HoneyDividendsRecordsDao interface {
UpdateHoneyDividendsRecords(m *models.HoneyDividendsRecords, forceColums ...string) (int64, error)
}

+ 10
- 0
src/dao/honey_dividends_records_with_flow_dao.go View File

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

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

type HoneyDividendsRecordsWithFlowDao interface {
HoneyDividendsRecordsWithFlowInsert(session *xorm.Session, honeyDividendsRecordsWithFlow *models.HoneyDividendsRecordsWithFlow) (int64, error)
}

+ 31
- 3
src/implement/honey_dividend_basic_db.go View File

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
@@ -7,12 +7,40 @@ import (
"xorm.io/xorm"
)

func NewHoneyDividendBasicDb(engine *xorm.Engine) dao.HoneyDividendBasicDao {
return &HoneyDividendBasicDb{Db: engine}
}

type HoneyDividendBasicDb struct {
Db *xorm.Engine
}

func NewHoneyDividendBasicDb(engine *xorm.Engine) dao.HoneyDividendBasicDao {
return &HoneyDividendBasicDb{Db: engine}
func (i HoneyDividendBasicDb) UpdateHoneyDividendBasic(m *models.HoneyDividendBasic, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = i.Db.Where("id=?", m.Id).Cols(forceColums...).Update(m)
} else {
affected, err = i.Db.Where("id=?", m.Id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func (i HoneyDividendBasicDb) GetHoneyDividendBasic() (m *models.HoneyDividendBasic, err error) {
m = new(models.HoneyDividendBasic)
has, err := i.Db.Where("is_open = 1").Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (i HoneyDividendBasicDb) GetHoneyDividendBasicByCoinIdSess(sess *xorm.Session, coinId int) (m *models.HoneyDividendBasic, err error) {


+ 31
- 0
src/implement/honey_dividends_records_db.go View File

@@ -0,0 +1,31 @@
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

func NewHoneyDividendsRecordsDb(engine *xorm.Engine) dao.HoneyDividendsRecordsDao {
return &HoneyDividendsRecordsDb{Db: engine}
}

type HoneyDividendsRecordsDb struct {
Db *xorm.Engine
}

func (h HoneyDividendsRecordsDb) UpdateHoneyDividendsRecords(m *models.HoneyDividendsRecords, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = h.Db.Where("id=?", m.Id).Cols(forceColums...).Update(m)
} else {
affected, err = h.Db.Where("id=?", m.Id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 23
- 0
src/implement/honey_dividends_records_with_flow_db.go View File

@@ -0,0 +1,23 @@
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

func NewHoneyDividendsRecordsWithFlowDb(engine *xorm.Engine) dao.HoneyDividendsRecordsWithFlowDao {
return &HoneyDividendsRecordsWithFlowDb{Db: engine}
}

type HoneyDividendsRecordsWithFlowDb struct {
Db *xorm.Engine
}

func (h HoneyDividendsRecordsWithFlowDb) HoneyDividendsRecordsWithFlowInsert(session *xorm.Session, honeyDividendsRecordsWithFlow *models.HoneyDividendsRecordsWithFlow) (int64, error) {
_, err := session.InsertOne(honeyDividendsRecordsWithFlow)
if err != nil {
return 0, err
}
return honeyDividendsRecordsWithFlow.Id, nil
}

Loading…
Cancel
Save