@@ -6,7 +6,7 @@ import ( | |||||
) | ) | ||||
type PublicPlatoonUserRelationDao interface { | 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) | PublicPlatoonUserRelationUpdate(session *xorm.Session, id interface{}, PublicPlatoonUserRelation *model.PublicPlatoonUserRelation, forceColums ...string) (int64, error) | ||||
PublicPlatoonUserRelationGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) | PublicPlatoonUserRelationGetOneByParams(params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) | ||||
PublicPlatoonUserRelationGetOneByPid(recommendUid string, params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) | PublicPlatoonUserRelationGetOneByPid(recommendUid string, params map[string]interface{}) (*model.PublicPlatoonUserRelation, error) | ||||
@@ -3,7 +3,5 @@ | |||||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
type UserDao interface { | 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) | |||||
} | } |
@@ -19,7 +19,7 @@ type PublicPlatoonUserRelationDb struct { | |||||
Db *xorm.Engine | 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) | _, err := p.Db.InsertOne(PublicPlatoonUserRelation) | ||||
if err != nil { | if err != nil { | ||||
return 0, err | return 0, err | ||||
@@ -131,7 +131,7 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFind(uid int64) ([ | |||||
return nil, zhios_order_relate_logx.Error("未查询到数据") | return nil, zhios_order_relate_logx.Error("未查询到数据") | ||||
} | } | ||||
} else { | } else { | ||||
has, err2 := p.Db.Where("level1 = ?", 1).Get(&head) | |||||
has, err2 := p.Db.Where("level_total = ?", 1).Get(&head) | |||||
if err2 != nil { | if err2 != nil { | ||||
return nil, err2 | return nil, err2 | ||||
} | } | ||||
@@ -193,12 +193,12 @@ func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUse | |||||
for len(queue) > 0 { | for len(queue) > 0 { | ||||
node := queue[0] | node := queue[0] | ||||
queue = queue[1:] | queue = queue[1:] | ||||
if node.Level1 > head.Level1+leveLimit { | |||||
if node.LevelTotal > head.LevelTotal+leveLimit { | |||||
break | break | ||||
} | } | ||||
res = append(res, node) | res = append(res, node) | ||||
var son []*model.PublicPlatoonUserRelation | 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 { | if err1 != nil { | ||||
return nil, zhios_order_relate_logx.Error(err1) | return nil, zhios_order_relate_logx.Error(err1) | ||||
} | } | ||||
@@ -4,6 +4,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | ||||
"fmt" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -15,23 +16,11 @@ type UserDb struct { | |||||
Db *xorm.Engine | 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) | 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 | |||||
} | } |
@@ -1,13 +1,12 @@ | |||||
package model | package model | ||||
type Admin struct { | 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"` | |||||
} | } |
@@ -24,6 +24,7 @@ type EggEnergyBasicSetting struct { | |||||
DevelopmentCommittee string `json:"development_committee" xorm:"not null comment('发展委员会') DECIMAL(28,8)"` | 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)"` | 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)"` | 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)"` | DestructionQuantityNums string `json:"destruction_quantity_nums" xorm:"not null comment('销毁数量') DECIMAL(28,8)"` | ||||
DestructionSetting string `json:"destruction_setting" xorm:"not null comment('销毁设置') TEXT"` | DestructionSetting string `json:"destruction_setting" xorm:"not null comment('销毁设置') TEXT"` | ||||
IsLimitDividend int `json:"is_limit_dividend" xorm:"not null default 1 comment('是否限制分红(会员本人不活跃,没有星级能量分红)') TINYINT(1)"` | IsLimitDividend int `json:"is_limit_dividend" xorm:"not null default 1 comment('是否限制分红(会员本人不活跃,没有星级能量分红)') TINYINT(1)"` | ||||
@@ -1,7 +1,7 @@ | |||||
package model | package model | ||||
type PublicPlatoonUserRelation struct { | 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)"` | 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)"` | 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)"` | FatherUid string `json:"father_uid" xorm:"not null default '' comment('父级uid(123456-563464-438384)') index VARCHAR(100)"` | ||||