From 133f24a3822db8428194b9a9139b7b86c50bcb5b Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 8 Aug 2024 09:47:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=9C=82=E8=9C=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/honey_dividend_basic_dao.go | 10 +++++++-- src/implement/honey_dividend_basic_db.go | 27 +++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/dao/honey_dividend_basic_dao.go b/src/dao/honey_dividend_basic_dao.go index de92f85..06aec7f 100644 --- a/src/dao/honey_dividend_basic_dao.go +++ b/src/dao/honey_dividend_basic_dao.go @@ -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) } diff --git a/src/implement/honey_dividend_basic_db.go b/src/implement/honey_dividend_basic_db.go index e822066..92ecb0d 100644 --- a/src/implement/honey_dividend_basic_db.go +++ b/src/implement/honey_dividend_basic_db.go @@ -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 +}