dengbiao 3 months ago
parent
commit
47ef15d8f7
2 changed files with 34 additions and 3 deletions
  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 View 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 View 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
}

Loading…
Cancel
Save