From 27e932d9ac3dc38162ada4fdf6807ce307cedbaa Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 6 Jan 2025 19:51:48 +0800 Subject: [PATCH] update --- .../egg_energy_recruit_new_user_reward_dao.go | 8 +++++ ...nergy_recruit_new_user_reward_implement.go | 33 +++++++++++++++++++ .../egg_energy_recruit_new_user_reward.go | 10 ++++++ 3 files changed, 51 insertions(+) create mode 100644 src/dao/egg_energy_recruit_new_user_reward_dao.go create mode 100644 src/implement/egg_energy_recruit_new_user_reward_implement.go create mode 100644 src/model/egg_energy_recruit_new_user_reward.go diff --git a/src/dao/egg_energy_recruit_new_user_reward_dao.go b/src/dao/egg_energy_recruit_new_user_reward_dao.go new file mode 100644 index 0000000..6b7ed3a --- /dev/null +++ b/src/dao/egg_energy_recruit_new_user_reward_dao.go @@ -0,0 +1,8 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type EggEnergyRecruitNewUserRewardDao interface { + EggEnergyRecruitNewUserRewardGet(uid int64) (*model.EggEnergyRecruitNewUserReward, bool, error) + EggEnergyRecruitNewUserRewardInsert(eggEnergyRecruitNewUserReward *model.EggEnergyRecruitNewUserReward) (int64, error) +} diff --git a/src/implement/egg_energy_recruit_new_user_reward_implement.go b/src/implement/egg_energy_recruit_new_user_reward_implement.go new file mode 100644 index 0000000..2a17f2d --- /dev/null +++ b/src/implement/egg_energy_recruit_new_user_reward_implement.go @@ -0,0 +1,33 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "xorm.io/xorm" +) + +func NewEggEnergyRecruitNewUserRewardDb(engine *xorm.Engine) dao.EggEnergyRecruitNewUserRewardDao { + return &EggEnergyRecruitNewUserRewardDb{Db: engine} +} + +type EggEnergyRecruitNewUserRewardDb struct { + Db *xorm.Engine +} + +func (e EggEnergyRecruitNewUserRewardDb) EggEnergyRecruitNewUserRewardGet(uid int64) (*model.EggEnergyRecruitNewUserReward, bool, error) { + var m model.EggEnergyRecruitNewUserReward + exist, err := e.Db.Where("uid =?", uid).Get(&m) + if err != nil { + return nil, false, zhios_order_relate_logx.Error(err.Error()) + } + return &m, exist, nil +} + +func (e EggEnergyRecruitNewUserRewardDb) EggEnergyRecruitNewUserRewardInsert(eggEnergyRecruitNewUserReward *model.EggEnergyRecruitNewUserReward) (int64, error) { + _, err := e.Db.InsertOne(eggEnergyRecruitNewUserReward) + if err != nil { + return 0, zhios_order_relate_logx.Error(err.Error()) + } + return eggEnergyRecruitNewUserReward.Id, nil +} diff --git a/src/model/egg_energy_recruit_new_user_reward.go b/src/model/egg_energy_recruit_new_user_reward.go new file mode 100644 index 0000000..6b34b29 --- /dev/null +++ b/src/model/egg_energy_recruit_new_user_reward.go @@ -0,0 +1,10 @@ +package model + +type EggEnergyRecruitNewUserReward struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') BIGINT(20)"` + RecommendUid int64 `json:"recommend_uid" xorm:"not null default 0 comment('推荐人id') BIGINT(20)"` + Value string `json:"value" xorm:"not null default 0.00000000 comment('奖励值') DECIMAL(20,8)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +}