Browse Source

update

master
dengbiao 6 days ago
parent
commit
f4acfe68f3
3 changed files with 22 additions and 5 deletions
  1. +5
    -1
      src/dao/user_dao.go
  2. +1
    -4
      src/implement/sys_cfg_implement.go
  3. +16
    -0
      src/implement/user_implement.go

+ 5
- 1
src/dao/user_dao.go View File

@@ -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)
}

+ 1
- 4
src/implement/sys_cfg_implement.go View File

@@ -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
}



+ 16
- 0
src/implement/user_implement.go View File

@@ -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"])


Loading…
Cancel
Save