dengbiao 3 mesi fa
parent
commit
47ef15d8f7
2 ha cambiato i file con 34 aggiunte e 3 eliminazioni
  1. +8
    -2
      src/dao/honey_dividend_basic_dao.go
  2. +26
    -1
      src/implement/honey_dividend_basic_db.go

+ 8
- 2
src/dao/honey_dividend_basic_dao.go Vedi File

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

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

type HoneyDividendBasicDao interface {
//TODO:: You can add specific method definitions here
GetHoneyDividendBasicByCoinId(coinId int) (m *models.HoneyDividendBasic, err error)
GetHoneyDividendBasicByCoinIdSess(sess *xorm.Session, coinId int) (m *models.HoneyDividendBasic, err error)
}

+ 26
- 1
src/implement/honey_dividend_basic_db.go Vedi File

@@ -1,7 +1,9 @@
package implement
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"
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx"
"xorm.io/xorm"
)

@@ -12,3 +14,26 @@ type HoneyDividendBasicDb struct {
func NewHoneyDividendBasicDb(engine *xorm.Engine) dao.HoneyDividendBasicDao {
return &HoneyDividendBasicDb{Db: engine}
}

func (i HoneyDividendBasicDb) GetHoneyDividendBasicByCoinIdSess(sess *xorm.Session, coinId int) (m *models.HoneyDividendBasic, err error) {
m = new(models.HoneyDividendBasic)
has, err := sess.Where("coin_id =?", coinId).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) GetHoneyDividendBasicByCoinId(coinId int) (m *models.HoneyDividendBasic, err error) {
m = new(models.HoneyDividendBasic)
has, err := i.Db.Where("coin_id =?", coinId).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

Caricamento…
Annulla
Salva