浏览代码

update

master
dengbiao 3 天前
父节点
当前提交
f4acfe68f3
共有 3 个文件被更改,包括 22 次插入5 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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


正在加载...
取消
保存