修改全局配置
This commit is contained in:
parent
f016a11cd4
commit
47467267b5
@ -36,7 +36,7 @@ var (
|
||||
subType: friend.FriendSubTypeApply,
|
||||
req: &pb.FriendApplyReq{},
|
||||
rsp: &pb.FriendApplyRsp{},
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
}, {
|
||||
//applylist
|
||||
mainType: string(comm.ModuleFriend),
|
||||
@ -60,7 +60,7 @@ var (
|
||||
mainType: string(comm.ModuleFriend),
|
||||
subType: friend.FriendSubTypeAddBlack,
|
||||
req: &pb.FriendBlackAddReq{
|
||||
FriendId: "0_62bd1c804cf36044f36bff33",
|
||||
FriendId: "0_62be9f40f67327fb53039b70",
|
||||
},
|
||||
rsp: &pb.FriendBlackAddRsp{},
|
||||
enabled: true,
|
||||
|
@ -164,7 +164,7 @@ func (r *Robot) onUserLoaded() {
|
||||
//hero
|
||||
r.RunHero()
|
||||
//friend
|
||||
// r.RunFriend()
|
||||
r.RunFriend()
|
||||
|
||||
//pack
|
||||
// r.RunPack()
|
||||
|
@ -17,7 +17,7 @@ var user_builders = []*builder{
|
||||
NickName: "乐谷6301",
|
||||
},
|
||||
rsp: &pb.UserCreateRsp{},
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
}, {
|
||||
desc: "添加资源",
|
||||
mainType: string(comm.ModuleUser),
|
||||
@ -27,7 +27,7 @@ var user_builders = []*builder{
|
||||
Count: 100,
|
||||
},
|
||||
rsp: &pb.UserAddResResp{},
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,13 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
PropertyHp string = "hp" //生命
|
||||
PropertyAtk string = "atk" //攻击
|
||||
PropertyDef string = "def" //防御
|
||||
Hp string = "hp" //生命
|
||||
Atk string = "atk" //攻击
|
||||
Def string = "def" //防御
|
||||
HpPro string = "hppro" //生命附加值
|
||||
AtkPro string = "atkpro" //攻击附加值
|
||||
DefPro string = "defpro" //防御附加值
|
||||
Speed string = "speed" //速度
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -51,6 +51,7 @@ type (
|
||||
|
||||
//玩家
|
||||
IUser interface {
|
||||
GetUser(uid string) *pb.DBUser
|
||||
//查询用户属性值 例如 金币 经验
|
||||
QueryAttributeValue(uid string, attr string) (value int32)
|
||||
//添加/减少属性值
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@ -13,16 +12,16 @@ func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendBlac
|
||||
if req.FriendId == "" {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//加入黑名单
|
||||
func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendBlackAddReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
err error
|
||||
self *pb.DBFriend
|
||||
rsp *pb.FriendBlackAddRsp
|
||||
err error
|
||||
self *pb.DBFriend
|
||||
target *pb.DBFriend
|
||||
rsp *pb.FriendBlackAddRsp
|
||||
)
|
||||
|
||||
defer func() {
|
||||
@ -30,22 +29,17 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendBlackAddR
|
||||
FriendId: req.FriendId,
|
||||
UserId: session.GetUserId(),
|
||||
}
|
||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAddBlack, rsp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), FriendSubTypeAddBlack, rsp)
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
target := &pb.DBFriend{UId: req.FriendId}
|
||||
|
||||
err = this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
if self == nil || err != nil {
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
}
|
||||
|
||||
err = this.module.modelFriend.Get(req.FriendId, target)
|
||||
if target == nil || err != nil {
|
||||
target = this.module.modelFriend.GetFriend(req.FriendId)
|
||||
if target == nil {
|
||||
code = pb.ErrorCode_FriendTargetNoData
|
||||
return
|
||||
}
|
||||
@ -67,13 +61,9 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendBlackAddR
|
||||
code = pb.ErrorCode_FriendTargetBlackYet
|
||||
return
|
||||
}
|
||||
blackNumMax := 0
|
||||
if maxhy := this.module.configure.GetGlobalConf("max_hy"); maxhy != "" {
|
||||
blackNumMax = cast.ToInt(maxhy)
|
||||
}
|
||||
|
||||
// 判断是否黑名单人数已满
|
||||
if len(self.BlackIds) >= blackNumMax {
|
||||
if len(self.BlackIds) >= this.module.getBlackMax() {
|
||||
code = pb.ErrorCode_FriendBlackMax
|
||||
return
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
||||
var (
|
||||
err error
|
||||
self *pb.DBFriend
|
||||
target *pb.DBFriend
|
||||
rsp *pb.FriendAgreeRsp
|
||||
optNum int32
|
||||
)
|
||||
@ -36,11 +37,9 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
|
||||
//获取玩家自己好友数据
|
||||
err = this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
if self == nil || err != nil {
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
}
|
||||
@ -64,11 +63,10 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
||||
}
|
||||
|
||||
//双向添加:将自己加入到申请人的好友列表中
|
||||
target := &pb.DBFriend{}
|
||||
err := this.module.modelFriend.Get(userId, target)
|
||||
if target == nil || err != nil {
|
||||
target = this.module.modelFriend.GetFriend(userId)
|
||||
if target == nil {
|
||||
code = pb.ErrorCode_FriendTargetNoData
|
||||
|
||||
return
|
||||
}
|
||||
if _, ok := utils.Find(target.FriendIds, self.UId); !ok {
|
||||
if target.FriendIds == nil {
|
||||
|
@ -43,18 +43,15 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
target = &pb.DBFriend{UId: req.FriendId}
|
||||
|
||||
//获取玩家自己好友数据
|
||||
err = this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil || err != nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
}
|
||||
|
||||
//获取好友数据
|
||||
err = this.module.modelFriend.Get(req.FriendId, target)
|
||||
target = this.module.modelFriend.GetFriend(req.FriendId)
|
||||
if target == nil || err != nil {
|
||||
code = pb.ErrorCode_FriendTargetNoData
|
||||
return
|
||||
@ -67,17 +64,13 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
|
||||
}
|
||||
|
||||
//判断是否超过最大好友数量
|
||||
//TODO 最大数从全局配置中获取
|
||||
var max int = 50
|
||||
total := len(self.FriendIds)
|
||||
if total >= max {
|
||||
if len(self.FriendIds) >= this.module.getFriendMax() {
|
||||
code = pb.ErrorCode_FriendSelfMax
|
||||
return
|
||||
}
|
||||
|
||||
//判断对方是否也超过最大好友数量
|
||||
ttotal := len(target.FriendIds)
|
||||
if ttotal >= max {
|
||||
if len(target.FriendIds) >= this.module.getFriendMax() {
|
||||
code = pb.ErrorCode_FriendTargetMax
|
||||
return
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.FriendApp
|
||||
//申请列表
|
||||
func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyListReq) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
self *pb.DBFriend
|
||||
rsp *pb.FriendApplyListRsp
|
||||
list []*pb.FriendBase
|
||||
@ -29,8 +30,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
err := this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil || err != nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
)
|
||||
|
||||
func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//黑名单
|
||||
func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
err error
|
||||
self *pb.DBFriend
|
||||
rsp *pb.FriendBlackListRsp
|
||||
list []*pb.FriendBase
|
||||
@ -32,8 +32,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
err := this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil || err != nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
|
@ -18,6 +18,7 @@ func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelB
|
||||
//删除黑名单
|
||||
func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
err error
|
||||
self *pb.DBFriend
|
||||
rsp *pb.FriendDelBlackRsp
|
||||
)
|
||||
@ -35,8 +36,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
err := this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil || err != nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
)
|
||||
|
||||
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.FriendListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -31,9 +30,8 @@ func (this *apiComp) List(session comm.IUserSession, chk map[string]interface{},
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
err := this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
if self == nil || err != nil {
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
}
|
||||
|
@ -37,10 +37,8 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
|
||||
}
|
||||
}()
|
||||
|
||||
self = &pb.DBFriend{UId: session.GetUserId()}
|
||||
|
||||
//获取玩家自己好友数据
|
||||
err = this.module.modelFriend.Get(session.GetUserId(), self)
|
||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil || err != nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
|
@ -3,9 +3,11 @@ package friend
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (chk map[string]interface{}, code comm.ErrorCode) {
|
||||
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (code comm.ErrorCode) {
|
||||
if req.NickName == "" {
|
||||
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSearchNameEmpty}
|
||||
return
|
||||
@ -14,7 +16,7 @@ func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearch
|
||||
}
|
||||
|
||||
//搜索
|
||||
func (this *apiComp) Search(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendSearchReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
rsp *pb.FriendSearchRsp
|
||||
friend *pb.FriendBase
|
||||
@ -25,7 +27,9 @@ func (this *apiComp) Search(session comm.IUserSession, chk map[string]interface{
|
||||
Friend: friend,
|
||||
}
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), FriendSubTypeSearch, rsp)
|
||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeSearch, rsp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
}()
|
||||
|
||||
user := this.module.modelFriend.Frined_FindCond(req.NickName)
|
||||
|
@ -3,6 +3,7 @@ package friend
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/lego/sys/redis"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
@ -35,3 +36,16 @@ func (this *ModelFriend) Frined_FindCond(nickName string) *pb.DBUser {
|
||||
}
|
||||
return user
|
||||
}
|
||||
|
||||
//查询好友
|
||||
func (this *ModelFriend) GetFriend(uid string) *pb.DBFriend {
|
||||
friend := &pb.DBFriend{UId: uid}
|
||||
if err := this.Get(uid, friend); err != nil {
|
||||
if err == redis.RedisNil {
|
||||
if err := this.Add(uid, friend); err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return friend
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
func NewModule() core.IModule {
|
||||
@ -34,3 +36,19 @@ func (this *Friend) OnInstallComp() {
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelFriend = this.RegisterComp(new(ModelFriend)).(*ModelFriend)
|
||||
}
|
||||
|
||||
//获取最大好友数
|
||||
func (this *Friend) getFriendMax() int {
|
||||
if maxHy := this.configure.GetGlobalConf("max_hy"); maxHy != "" {
|
||||
return cast.ToInt(maxHy)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//获取最大黑名单数
|
||||
func (this *Friend) getBlackMax() int {
|
||||
if maxHy := this.configure.GetGlobalConf("max_hmd"); maxHy != "" {
|
||||
return cast.ToInt(maxHy)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -162,9 +162,9 @@ func (this *ModelHero) mergeMainProperty(uid, heroId string, data map[string]int
|
||||
return
|
||||
}
|
||||
|
||||
hero.Property[comm.PropertyHp] += data[comm.PropertyHp]
|
||||
hero.Property[comm.PropertyAtk] += data[comm.PropertyAtk]
|
||||
hero.Property[comm.PropertyDef] += data[comm.PropertyDef]
|
||||
hero.Property[comm.Hp] += data[comm.Hp]
|
||||
hero.Property[comm.Atk] += data[comm.Atk]
|
||||
hero.Property[comm.Def] += data[comm.Def]
|
||||
}
|
||||
|
||||
//合并附加属性
|
||||
@ -173,9 +173,9 @@ func (this *ModelHero) mergeAddProperty(uid, heroId string, data map[string]int3
|
||||
if hero == nil {
|
||||
return
|
||||
}
|
||||
hero.AddProperty[comm.PropertyHp] += data[comm.PropertyHp]
|
||||
hero.AddProperty[comm.PropertyAtk] += data[comm.PropertyAtk]
|
||||
hero.AddProperty[comm.PropertyDef] += data[comm.PropertyDef]
|
||||
hero.AddProperty[comm.Hp] += data[comm.Hp]
|
||||
hero.AddProperty[comm.Atk] += data[comm.Atk]
|
||||
hero.AddProperty[comm.Def] += data[comm.Def]
|
||||
}
|
||||
|
||||
//属性计算 - 暂时放在modelHero里实现
|
||||
@ -216,25 +216,25 @@ func (this *ModelHero) PropertyCompute(uid, heroId string) map[string]int32 {
|
||||
return nil
|
||||
}
|
||||
|
||||
curHp := hero.Property[comm.PropertyHp]
|
||||
curHp := hero.Property[comm.Hp]
|
||||
exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v",
|
||||
(curHp + lvGrow.Hp), heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp)
|
||||
hp, _ := mengine.ParseAndExec(exprHp)
|
||||
|
||||
curAtk := hero.Property[comm.PropertyAtk]
|
||||
curAtk := hero.Property[comm.Atk]
|
||||
exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v",
|
||||
(curAtk + lvGrow.Atk), heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk)
|
||||
atk, _ := mengine.ParseAndExec(exprAtk)
|
||||
|
||||
curDef := hero.Property[comm.PropertyDef]
|
||||
curDef := hero.Property[comm.Def]
|
||||
exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v",
|
||||
(curDef + lvGrow.Def), heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef)
|
||||
def, _ := mengine.ParseAndExec(exprDef)
|
||||
|
||||
return map[string]int32{
|
||||
comm.PropertyHp: int32(math.Floor(hp)),
|
||||
comm.PropertyAtk: int32(math.Floor(atk)),
|
||||
comm.PropertyDef: int32(math.Floor(def)),
|
||||
comm.Hp: int32(math.Floor(hp)),
|
||||
comm.Atk: int32(math.Floor(atk)),
|
||||
comm.Def: int32(math.Floor(def)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ func (this *apiComp) AddRes(session comm.IUserSession, req *pb.UserAddResReq) (c
|
||||
}
|
||||
}()
|
||||
|
||||
user := this.module.modelUser.getUser(session.GetUserId())
|
||||
user := this.module.modelUser.GetUser(session.GetUserId())
|
||||
if user == nil {
|
||||
code = pb.ErrorCode_UserSessionNobeing
|
||||
return
|
||||
|
@ -1,16 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
)
|
||||
|
||||
type configureComp struct {
|
||||
modules.MCompConfigure
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
||||
return
|
||||
}
|
@ -44,11 +44,11 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) {
|
||||
user.Uid = fmt.Sprintf("%d_%s", user.Sid, _id)
|
||||
user.Uuid = uuid.NewV4().String()
|
||||
user.Ctime = time.Now().Unix()
|
||||
return this.Add(user.Uid,user)
|
||||
return this.Add(user.Uid, user)
|
||||
}
|
||||
|
||||
//获取用户
|
||||
func (this *ModelUser) getUser(uid string) *pb.DBUser {
|
||||
func (this *ModelUser) GetUser(uid string) *pb.DBUser {
|
||||
dbUser := &pb.DBUser{}
|
||||
if err := this.Get(uid, dbUser); err != nil {
|
||||
log.Errorf("getUser err:%v", err)
|
||||
|
@ -18,7 +18,7 @@ type User struct {
|
||||
api *apiComp
|
||||
modelUser *ModelUser
|
||||
modelSession *ModelSession
|
||||
configure *configureComp
|
||||
configure *modules.MCompConfigure
|
||||
}
|
||||
|
||||
func (this *User) GetType() core.M_Modules {
|
||||
@ -36,17 +36,17 @@ func (this *User) OnInstallComp() {
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelUser = this.RegisterComp(new(ModelUser)).(*ModelUser)
|
||||
this.modelSession = this.RegisterComp(new(ModelSession)).(*ModelSession)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
|
||||
}
|
||||
|
||||
//获取英雄列表
|
||||
func (this *User) GetHeroList(uid string) []*pb.DBHero {
|
||||
return nil
|
||||
func (this *User) GetUser(uid string) *pb.DBUser {
|
||||
return this.modelUser.GetUser(uid)
|
||||
}
|
||||
|
||||
//查询用户属性值 例如 金币 经验
|
||||
func (this *User) QueryAttributeValue(uid string, attr string) (value int32) {
|
||||
user := this.modelUser.getUser(uid)
|
||||
user := this.modelUser.GetUser(uid)
|
||||
if user == nil {
|
||||
return
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package web
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/modules/user"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/core/cbase"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -19,7 +19,7 @@ func NewModule() core.IModule {
|
||||
}
|
||||
|
||||
type Web struct {
|
||||
modules.ModuleBase
|
||||
cbase.ModuleBase
|
||||
options *Options
|
||||
api_comp *Api_Comp //提供weba pi服务的组件
|
||||
modelUser *user.ModelUser
|
||||
|
Loading…
Reference in New Issue
Block a user