From 9a7c06cad468048eb45d2908f5dd8e2a5921071a Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 25 May 2024 11:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/happy_happy_orchard_reward_dao.go | 1 + src/dao/happy_orchard_seed_dao.go | 4 +- src/dao/happy_orchard_task_dao.go | 8 ++++ src/dao/happy_orchard_task_num_dao.go | 8 ++++ src/dao/happy_orchard_task_user_reward_dao.go | 6 +++ src/dao/happy_orchard_user_seed_record_dao.go | 2 + src/implement/happy_orchard_reward_db.go | 18 ++++++- src/implement/happy_orchard_task_db.go | 34 ++++++++++++++ src/implement/happy_orchard_task_num_db.go | 35 ++++++++++++++ .../happy_orchard_task_user_reward_db.go | 47 +++++++++++++++++++ .../happy_orchard_user_seed_record_db.go | 13 ++++- src/models/happy_orchard_task.go | 31 ++++++++++++ src/models/happy_orchard_task_num.go | 16 +++++++ src/models/happy_orchard_task_user_reward.go | 26 ++++++++++ src/models/happy_orchard_user_seed_record.go | 19 +++++--- 15 files changed, 257 insertions(+), 11 deletions(-) create mode 100644 src/dao/happy_orchard_task_dao.go create mode 100644 src/dao/happy_orchard_task_num_dao.go create mode 100644 src/dao/happy_orchard_task_user_reward_dao.go create mode 100644 src/implement/happy_orchard_task_db.go create mode 100644 src/implement/happy_orchard_task_num_db.go create mode 100644 src/implement/happy_orchard_task_user_reward_db.go create mode 100644 src/models/happy_orchard_task.go create mode 100644 src/models/happy_orchard_task_num.go create mode 100644 src/models/happy_orchard_task_user_reward.go diff --git a/src/dao/happy_happy_orchard_reward_dao.go b/src/dao/happy_happy_orchard_reward_dao.go index 32c620f..e76596a 100644 --- a/src/dao/happy_happy_orchard_reward_dao.go +++ b/src/dao/happy_happy_orchard_reward_dao.go @@ -6,6 +6,7 @@ import ( type HappyOrchardRewardDao interface { GetHappyOrchardReward(id int) (m *models.HappyOrchardReward, err error) + GetHappyOrchardRewardSess(id int) (m *models.HappyOrchardReward, err error) FindHappyOrchardRewardById(seedId []int) (m *[]models.HappyOrchardReward, err error) FindHappyOrchardRewardAll(rewardIds []int, start, limit int) (mm *[]models.HappyOrchardReward, err error) } diff --git a/src/dao/happy_orchard_seed_dao.go b/src/dao/happy_orchard_seed_dao.go index 31a07dc..23233b9 100644 --- a/src/dao/happy_orchard_seed_dao.go +++ b/src/dao/happy_orchard_seed_dao.go @@ -1,6 +1,8 @@ package dao -import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" +) type HappyOrchardSeedDao interface { GetHappyOrchardSeed(id int) (m *models.HappyOrchardSeed, err error) diff --git a/src/dao/happy_orchard_task_dao.go b/src/dao/happy_orchard_task_dao.go new file mode 100644 index 0000000..0047abe --- /dev/null +++ b/src/dao/happy_orchard_task_dao.go @@ -0,0 +1,8 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type HappyOrchardTaskDao interface { + GetHappyOrchardTaskByPid(pid int) (mm *[]models.HappyOrchardTask, err error) + GetHappyOrchardTaskById(id int) (m *models.HappyOrchardTask, err error) +} diff --git a/src/dao/happy_orchard_task_num_dao.go b/src/dao/happy_orchard_task_num_dao.go new file mode 100644 index 0000000..12ee48d --- /dev/null +++ b/src/dao/happy_orchard_task_num_dao.go @@ -0,0 +1,8 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type HappyOrchardTaskNumDao interface { + GetHappyOrchardTaskNumTotal(args map[string]string) int + GetHappyOrchardTaskNum(args map[string]string) *models.HappyOrchardTaskNum +} diff --git a/src/dao/happy_orchard_task_user_reward_dao.go b/src/dao/happy_orchard_task_user_reward_dao.go new file mode 100644 index 0000000..d0f62e9 --- /dev/null +++ b/src/dao/happy_orchard_task_user_reward_dao.go @@ -0,0 +1,6 @@ +package dao + +type HappyOrchardTaskUserRewardDao interface { + GetHappyOrchardTaskUserRewardByIdAndTime(uid string, taskId int, stime, etime int64) (count int64, err error) + GetHappyOrchardTaskUserRewardByIdAndTimeSum(uid string, taskId int, stime, etime int64, i int) int64 +} diff --git a/src/dao/happy_orchard_user_seed_record_dao.go b/src/dao/happy_orchard_user_seed_record_dao.go index b861dc4..75f98cc 100644 --- a/src/dao/happy_orchard_user_seed_record_dao.go +++ b/src/dao/happy_orchard_user_seed_record_dao.go @@ -2,10 +2,12 @@ package dao import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "xorm.io/xorm" ) type HappyOrchardUserSeedRecordDao interface { GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error) + GetHappyOrchardUserSeedRecordSess(sess *xorm.Session, id int) (m *models.HappyOrchardUserSeedRecord, err error) FindHappyOrchardUserSeedRecordByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) GetHappyOrchardUserSeedRecordByUidWithState(uid, state int) (m *models.HappyOrchardUserSeedRecord, err error) GetHappyOrchardUserSeedRecordByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardUserSeedRecord, err error) diff --git a/src/implement/happy_orchard_reward_db.go b/src/implement/happy_orchard_reward_db.go index 064b37e..e1f26b7 100644 --- a/src/implement/happy_orchard_reward_db.go +++ b/src/implement/happy_orchard_reward_db.go @@ -8,13 +8,16 @@ import ( ) type HappyOrchardRewardDb struct { - Db *xorm.Engine + Db *xorm.Engine + Sess *xorm.Session } func NewHappyOrchardRewardDb(engine *xorm.Engine) dao.HappyOrchardRewardDao { return &HappyOrchardRewardDb{Db: engine} } - +func NewHappyOrchardRewardDbSess(sess *xorm.Session) dao.HappyOrchardRewardDao { + return &HappyOrchardRewardDb{Sess: sess} +} func (h HappyOrchardRewardDb) GetHappyOrchardReward(id int) (m *models.HappyOrchardReward, err error) { m = new(models.HappyOrchardReward) has, err := h.Db.Where("id =?", id).Get(m) @@ -26,6 +29,17 @@ func (h HappyOrchardRewardDb) GetHappyOrchardReward(id int) (m *models.HappyOrch } return m, nil } +func (h HappyOrchardRewardDb) GetHappyOrchardRewardSess(id int) (m *models.HappyOrchardReward, err error) { + m = new(models.HappyOrchardReward) + has, err := h.Sess.Where("id =?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} func (h HappyOrchardRewardDb) FindHappyOrchardRewardById(id []int) (mm *[]models.HappyOrchardReward, err error) { var m []models.HappyOrchardReward if err := h.Db.In("id", id).Find(&m); err != nil { diff --git a/src/implement/happy_orchard_task_db.go b/src/implement/happy_orchard_task_db.go new file mode 100644 index 0000000..6f2e8a2 --- /dev/null +++ b/src/implement/happy_orchard_task_db.go @@ -0,0 +1,34 @@ +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 HappyOrchardTaskDb struct { + Db *xorm.Engine +} + +func NewHappyOrchardTaskDb(engine *xorm.Engine) dao.HappyOrchardTaskDao { + return &HappyOrchardTaskDb{Db: engine} +} +func (h HappyOrchardTaskDb) GetHappyOrchardTaskByPid(pid int) (mm *[]models.HappyOrchardTask, err error) { + var m []models.HappyOrchardTask + if err := h.Db.Where("is_use=? and pid =?", 1, pid).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} +func (h HappyOrchardTaskDb) GetHappyOrchardTaskById(id int) (m *models.HappyOrchardTask, err error) { + m = new(models.HappyOrchardTask) + has, err := h.Db.Where("id =?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} diff --git a/src/implement/happy_orchard_task_num_db.go b/src/implement/happy_orchard_task_num_db.go new file mode 100644 index 0000000..72d1109 --- /dev/null +++ b/src/implement/happy_orchard_task_num_db.go @@ -0,0 +1,35 @@ +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" +) + +type HappyOrchardTaskNumDb struct { + Db *xorm.Engine +} + +func NewHappyOrchardTaskNumDb(engine *xorm.Engine) dao.HappyOrchardTaskNumDao { + return &HappyOrchardTaskNumDb{Db: engine} +} +func (h HappyOrchardTaskNumDb) GetHappyOrchardTaskNumTotal(args map[string]string) int { + sess := h.Db.Where("uid=? and time>=? and time=?", + uid, taskId, stime) + if etime > 0 { + sess.And("create_time=?", + uid, taskId, stime) + if etime > 0 { + sess.And("create_time=?", + uid, taskId, stime) + if etime > 0 { + sess1.And("create_time