From e802997fd69e561ccf9e9039cfde6939cc40c084 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Fri, 17 May 2024 22:07:39 +0800 Subject: [PATCH] update --- src/dao/happy_happy_orchard_reward_dao.go | 2 +- src/dao/happy_happy_orchard_seed_dao.go | 2 +- src/dao/happy_orchard_user_waters_dao.go | 9 ++++++ src/implement/happy_orchard_reward_db.go | 2 +- src/implement/happy_orchard_seed_db.go | 2 +- src/implement/happy_orchard_user_waters_db.go | 28 +++++++++++++++++++ 6 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/dao/happy_orchard_user_waters_dao.go create mode 100644 src/implement/happy_orchard_user_waters_db.go diff --git a/src/dao/happy_happy_orchard_reward_dao.go b/src/dao/happy_happy_orchard_reward_dao.go index ff44bdf..dc1feef 100644 --- a/src/dao/happy_happy_orchard_reward_dao.go +++ b/src/dao/happy_happy_orchard_reward_dao.go @@ -5,5 +5,5 @@ import ( ) type HappyOrchardRewardDao interface { - GetHappyOrchardRewardDao(id int) (m *models.HappyOrchardReward, err error) + GetHappyOrchardReward(id int) (m *models.HappyOrchardReward, err error) } diff --git a/src/dao/happy_happy_orchard_seed_dao.go b/src/dao/happy_happy_orchard_seed_dao.go index 87eb027..b4c8448 100644 --- a/src/dao/happy_happy_orchard_seed_dao.go +++ b/src/dao/happy_happy_orchard_seed_dao.go @@ -5,5 +5,5 @@ import ( ) type HappyOrchardSeedDao interface { - GetHappyOrchardSeedDao(id int) (m *models.HappyOrchardSeed, err error) + GetHappyOrchardSeed(id int) (m *models.HappyOrchardSeed, err error) } diff --git a/src/dao/happy_orchard_user_waters_dao.go b/src/dao/happy_orchard_user_waters_dao.go new file mode 100644 index 0000000..ba543da --- /dev/null +++ b/src/dao/happy_orchard_user_waters_dao.go @@ -0,0 +1,9 @@ +package dao + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" +) + +type HappyOrchardUserWatersDao interface { + GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error) +} diff --git a/src/implement/happy_orchard_reward_db.go b/src/implement/happy_orchard_reward_db.go index 13be073..7991404 100644 --- a/src/implement/happy_orchard_reward_db.go +++ b/src/implement/happy_orchard_reward_db.go @@ -15,7 +15,7 @@ func NewHappyOrchardRewardDb(engine *xorm.Engine) dao.HappyOrchardRewardDao { return &happyOrchardRewardDb{Db: engine} } -func (h happyOrchardRewardDb) GetHappyOrchardRewardDao(id int) (m *models.HappyOrchardReward, err error) { +func (h happyOrchardRewardDb) GetHappyOrchardReward(id int) (m *models.HappyOrchardReward, err error) { m = new(models.HappyOrchardReward) has, err := h.Db.Where("id =?", id).Get(m) if err != nil { diff --git a/src/implement/happy_orchard_seed_db.go b/src/implement/happy_orchard_seed_db.go index c4e8c8f..751b875 100644 --- a/src/implement/happy_orchard_seed_db.go +++ b/src/implement/happy_orchard_seed_db.go @@ -15,7 +15,7 @@ func NewHappyOrchardSeedDb(engine *xorm.Engine) dao.HappyOrchardSeedDao { return &happyOrchardSeedDb{Db: engine} } -func (h happyOrchardSeedDb) GetHappyOrchardSeedDao(id int) (m *models.HappyOrchardSeed, err error) { +func (h happyOrchardSeedDb) GetHappyOrchardSeed(id int) (m *models.HappyOrchardSeed, err error) { m = new(models.HappyOrchardSeed) has, err := h.Db.Where("id =?", id).Get(m) if err != nil { diff --git a/src/implement/happy_orchard_user_waters_db.go b/src/implement/happy_orchard_user_waters_db.go new file mode 100644 index 0000000..1df0b5c --- /dev/null +++ b/src/implement/happy_orchard_user_waters_db.go @@ -0,0 +1,28 @@ +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" +) + +type happyOrchardUserWatersDb struct { + Db *xorm.Engine +} + +func NewHappyOrchardUserWatersDb(engine *xorm.Engine) dao.HappyOrchardUserWatersDao { + return &happyOrchardUserWatersDb{Db: engine} +} + +func (h happyOrchardUserWatersDb) GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error) { + m = new(models.HappyOrchardUserWaters) + has, err := h.Db.Where("uid =?", uid).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +}