From f4acfe68f34ffeeeb7180334f930d5b1b255df1f Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 19 Nov 2024 15:25:26 +0800 Subject: [PATCH] update --- src/dao/user_dao.go | 6 +++++- src/implement/sys_cfg_implement.go | 5 +---- src/implement/user_implement.go | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/dao/user_dao.go b/src/dao/user_dao.go index 133b114..f8e2e9b 100644 --- a/src/dao/user_dao.go +++ b/src/dao/user_dao.go @@ -1,10 +1,14 @@ package dao -import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) type UserDao interface { UserGetOneByParams(params map[string]interface{}) (*model.User, error) UserFindByParams(params map[string]interface{}) ([]model.User, error) UserUpdate(id interface{}, user *model.User, forceColumns ...string) (int64, error) UserFindAndCount(uid int64, phone string, nickname string, level int, page, limit int) (*[]model.User, int64, error) + UserFindByInviteCodes(codes ...string) (*[]model.User, error) + UserFindByCustomInviteCodes(codes ...string) (*[]model.User, error) } diff --git a/src/implement/sys_cfg_implement.go b/src/implement/sys_cfg_implement.go index ba57b2f..43feeed 100644 --- a/src/implement/sys_cfg_implement.go +++ b/src/implement/sys_cfg_implement.go @@ -36,13 +36,10 @@ func (s SysCfgDb) SysCfgGetAll() (*[]model.SysCfg, error) { func (s SysCfgDb) SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) { var cfgList model.SysCfg - has, err := s.Db.Where("`key`=?", key).Get(&cfgList) + _, err := s.Db.Where("`key`=?", key).Get(&cfgList) if err != nil { return nil, zhios_order_relate_logx.Error(err) } - if !has { - return nil, nil - } return &cfgList, nil } diff --git a/src/implement/user_implement.go b/src/implement/user_implement.go index f9fb997..83cafd3 100644 --- a/src/implement/user_implement.go +++ b/src/implement/user_implement.go @@ -18,6 +18,22 @@ type UserDb struct { Db *xorm.Engine } +func (u UserDb) UserFindByInviteCodes(codes ...string) (*[]model.User, error) { + var m []model.User + if err := u.Db.In("custom_invite_code", codes).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return &m, nil +} + +func (u UserDb) UserFindByCustomInviteCodes(codes ...string) (*[]model.User, error) { + var m []model.User + if err := u.Db.In("system_invite_code", codes).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return &m, nil +} + func (u UserDb) UserGetOneByParams(params map[string]interface{}) (*model.User, error) { var m model.User var query = fmt.Sprintf("%s = ?", params["key"])