Ver código fonte

add publicPlatoon seletc member

master
shenjiachi 3 dias atrás
pai
commit
b772e9e118
6 arquivos alterados com 52 adições e 0 exclusões
  1. +1
    -0
      src/dao/user_dao.go
  2. +1
    -0
      src/dao/user_relate_dao.go
  3. +1
    -0
      src/dao/user_virtual_amount_dao.go
  4. +22
    -0
      src/implement/user_implement.go
  5. +17
    -0
      src/implement/user_relate_implement.go
  6. +10
    -0
      src/implement/user_virtual_amount_implement.go

+ 1
- 0
src/dao/user_dao.go Ver arquivo

@@ -6,4 +6,5 @@ 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)
}

+ 1
- 0
src/dao/user_relate_dao.go Ver arquivo

@@ -8,4 +8,5 @@ type UserRelateDao interface {
FindUserRelateByParentUid(uid int64, level int) (*[]model.UserRelate, error)
SumUserRelateByParentUid(parentUid string) (total int64, userRelate []*model.UserRelate, err error)
PageFindUserRelateByParentUid(uid int64, page, pageSize int) (*[]model.UserRelate, int64, error)
PageFindUserRelateByParentUidAndLevel(uid int64, page, limit int, level int) (*[]model.UserRelate, int64, error)
}

+ 1
- 0
src/dao/user_virtual_amount_dao.go Ver arquivo

@@ -8,4 +8,5 @@ type UserVirtualAmountDao interface {
GetUserVirtualWalletBySession(uid int64, coinId int) (*model.UserVirtualAmount, error)
UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int) ([]model.UserVirtualAmount, int64, error)
UserVirtualAmountGetSumByCoinKind(coinId int) (float64, error)
GetUserVirtualAllWallets(uid int64) (*[]model.UserVirtualAmount, error)
}

+ 22
- 0
src/implement/user_implement.go Ver arquivo

@@ -59,3 +59,25 @@ func (u UserDb) UserUpdate(id interface{}, user *model.User, forceColumns ...str
}
return affected, nil
}

func (u UserDb) UserFindAndCount(uid int64, phone string, nickname string, level int, page, limit int) (*[]model.User, int64, error) {
var m []model.User
session := u.Db.NewSession()
if uid != 0 {
session = session.Where("uid=?", uid)
}
if phone != "" {
session = session.Where("phone = ?", phone)
}
if nickname != "" {
session = session.Where("nickname like ? ", "%"+nickname+"%")
}
if level != 0 {
session = session.Where("level=?", level)
}
total, err := session.FindAndCount(&m)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err)
}
return &m, total, nil
}

+ 17
- 0
src/implement/user_relate_implement.go Ver arquivo

@@ -68,3 +68,20 @@ func (u UserRelateDb) PageFindUserRelateByParentUid(uid int64, page, pageSize in
}
return &userRelate, count, nil
}

func (u UserRelateDb) PageFindUserRelateByParentUidAndLevel(uid int64, page, limit int, level int) (*[]model.UserRelate, int64, error) {
var userRelate []model.UserRelate
sess := u.Db.Where("parent_uid = ?", uid)
if level == 1 || level == 2 {
sess.And("level=?", level)
} else if level == 0 {

} else {
sess.And("level != 1").And("level != 2")
}
total, err := sess.Limit(limit, (page-1)*page).Asc("uid").FindAndCount(&userRelate)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err)
}
return &userRelate, total, nil
}

+ 10
- 0
src/implement/user_virtual_amount_implement.go Ver arquivo

@@ -52,3 +52,13 @@ func (u UserVirtualAmountDb) UserVirtualAmountGetSumByCoinKind(coinId int) (floa
}
return sum, nil
}

func (u UserVirtualAmountDb) GetUserVirtualAllWallets(uid int64) (*[]model.UserVirtualAmount, error) {
var m []model.UserVirtualAmount
err := u.Db.Where("uid = ?", uid).Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err.Error())
}
return &m, nil

}

Carregando…
Cancelar
Salvar