Bladeren bron

update

tags/v0.0.2
dengbiao 1 week geleden
bovenliggende
commit
ce20b73a79
7 gewijzigde bestanden met toevoegingen van 22 en 35 verwijderingen
  1. +1
    -1
      src/dao/public_platoon_user_relation_dao.go
  2. +1
    -3
      src/dao/user_dao.go
  3. +4
    -4
      src/implement/public_platoon_user_relation_implement.go
  4. +6
    -17
      src/implement/user_implement.go
  5. +8
    -9
      src/model/admin.go
  6. +1
    -0
      src/model/egg_energy_basic_setting.go
  7. +1
    -1
      src/model/public_platoon_user_relation.go

+ 1
- 1
src/dao/public_platoon_user_relation_dao.go Bestand weergeven

@@ -6,7 +6,7 @@ import (
)

type PublicPlatoonUserRelationDao interface {
PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int, error)
PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int64, error)
PublicPlatoonUserRelationUpdate(session *xorm.Session, id interface{}, PublicPlatoonUserRelation *model.PublicPlatoonUserRelation, forceColums ...string) (int64, error)
PublicPlatoonUserRelationGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByPid(recommendUid string, params map[string]interface{}) (*model.PublicPlatoonUserRelation, error)


+ 1
- 3
src/dao/user_dao.go Bestand weergeven

@@ -3,7 +3,5 @@
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type UserDao interface {
//TODO:: You can add specific method definitions here
UserGetOneByPhone(phone int) (*model.User, error)
UserGetOneById(id int64) (*model.User, error)
UserGetOneByParams(params map[string]interface{}) (*model.User, error)
}

+ 4
- 4
src/implement/public_platoon_user_relation_implement.go Bestand weergeven

@@ -19,7 +19,7 @@ type PublicPlatoonUserRelationDb struct {
Db *xorm.Engine
}

func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int, error) {
func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int64, error) {
_, err := p.Db.InsertOne(PublicPlatoonUserRelation)
if err != nil {
return 0, err
@@ -131,7 +131,7 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFind(uid int64) ([
return nil, zhios_order_relate_logx.Error("未查询到数据")
}
} else {
has, err2 := p.Db.Where("level1 = ?", 1).Get(&head)
has, err2 := p.Db.Where("level_total = ?", 1).Get(&head)
if err2 != nil {
return nil, err2
}
@@ -193,12 +193,12 @@ func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUse
for len(queue) > 0 {
node := queue[0]
queue = queue[1:]
if node.Level1 > head.Level1+leveLimit {
if node.LevelTotal > head.LevelTotal+leveLimit {
break
}
res = append(res, node)
var son []*model.PublicPlatoonUserRelation
err1 := p.Db.Where("father_uid1 = ?", node.Uid).Find(son)
err1 := p.Db.Where("father_uid1 = ?", node.Uid).Find(&son)
if err1 != nil {
return nil, zhios_order_relate_logx.Error(err1)
}


+ 6
- 17
src/implement/user_implement.go Bestand weergeven

@@ -4,6 +4,7 @@ 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"
"fmt"
"xorm.io/xorm"
)

@@ -15,23 +16,11 @@ type UserDb struct {
Db *xorm.Engine
}

func (p UserDb) UserGetOneByPhone(phone int) (*model.User, error) {
var user model.User
has, err := p.Db.Where("phone = ?", phone).Get(&user)
if err != nil {
func (u UserDb) UserGetOneByParams(params map[string]interface{}) (*model.User, error) {
var m model.User
var query = fmt.Sprintf("%s =?", params["key"])
if has, err := u.Db.Where(query, params["value"]).Get(&m); err != nil || has == false {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, zhios_order_relate_logx.Error("未查询到相关用户记录")
}
return &user, nil
}

func (p UserDb) UserGetOneById(id int64) (*model.User, error) {
var user model.User
_, err := p.Db.Where("id = ?", id).Get(&user)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &user, nil
return &m, nil
}

+ 8
- 9
src/model/admin.go Bestand weergeven

@@ -1,13 +1,12 @@
package model

type Admin struct {
AdmId int `json:"adm_id" xorm:"not null comment('管理员id') INT(11)"`
Username string `json:"username" xorm:"not null default '' comment('用户名') VARCHAR(255)"`
Password string `json:"password" xorm:"not null default '' comment('密码') VARCHAR(255)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"`
IsSuperAdministrator int `json:"is_super_administrator" xorm:"not null default 0 comment('是否为超级管理员(0:否 1:是)') TINYINT(1)"`
IsObserverAdministrator int `json:"is_observer_administrator" xorm:"not null default 0 comment('是否为观察者管理员(0:否 1:是)') TINYINT(1)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
AdmId int `json:"adm_id" xorm:"not null comment('管理员id') INT(11)"`
Username string `json:"username" xorm:"not null default '' comment('用户名') VARCHAR(255)"`
Password string `json:"password" xorm:"not null default '' comment('密码') VARCHAR(255)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"`
IsSuperAdministrator int `json:"is_super_administrator" xorm:"not null default 0 comment('是否为超级管理员(0:否 1:是)') TINYINT(1)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 1
- 0
src/model/egg_energy_basic_setting.go Bestand weergeven

@@ -24,6 +24,7 @@ type EggEnergyBasicSetting struct {
DevelopmentCommittee string `json:"development_committee" xorm:"not null comment('发展委员会') DECIMAL(28,8)"`
PublicWelfareAndCharity string `json:"public_welfare_and_charity" xorm:"not null comment('公益慈善') DECIMAL(28,8)"`
StarLevelDividends string `json:"star_level_dividends" xorm:"not null comment('星级分红') DECIMAL(28,8)"`
CommunityDividends string `json:"community_dividends" xorm:"not null comment('社区分红') DECIMAL(28,8)"`
DestructionQuantityNums string `json:"destruction_quantity_nums" xorm:"not null comment('销毁数量') DECIMAL(28,8)"`
DestructionSetting string `json:"destruction_setting" xorm:"not null comment('销毁设置') TEXT"`
IsLimitDividend int `json:"is_limit_dividend" xorm:"not null default 1 comment('是否限制分红(会员本人不活跃,没有星级能量分红)') TINYINT(1)"`


+ 1
- 1
src/model/public_platoon_user_relation.go Bestand weergeven

@@ -1,7 +1,7 @@
package model

type PublicPlatoonUserRelation struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id(若为-1,则代表等待新用户填充)') index INT(11)"`
RecommendUid int64 `json:"recommend_uid" xorm:"not null default 0 comment('推荐人id') INT(11)"`
FatherUid string `json:"father_uid" xorm:"not null default '' comment('父级uid(123456-563464-438384)') index VARCHAR(100)"`


Laden…
Annuleren
Opslaan