From d04eb6b8a061258ec2f2fb2a3978ffae2109b8c7 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 27 Jul 2022 20:30:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=8C=E6=AD=A5item=20=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_item.json | 258 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 237 insertions(+), 21 deletions(-) diff --git a/bin/json/game_item.json b/bin/json/game_item.json index 6773baf2e..4147429db 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -57,8 +57,8 @@ "isani": 0, "star": 0, "race": 0, - "img": "wp_icon_0001", - "ico": "wp_icon_0001", + "img": "wp_icon_10002", + "ico": "wp_icon_10002", "intr": { "key": "itemdesc_10002", "text": "一块测试功能的石头,他可能是某个不能使用的活动道具" @@ -288,13 +288,13 @@ ] }, { - "id": "1", + "id": "10009", "name": { - "key": "itemname_1", - "text": "宝箱自选" + "key": "itemname_10009", + "text": "被封印的魔法书" }, - "usetype": 4, - "color": 4, + "usetype": 2, + "color": 6, "bagtype": 1, "index": 9, "special_type": 0, @@ -309,11 +309,11 @@ "isani": 0, "star": 0, "race": 0, - "img": "wp_icon_0001", - "ico": "wp_icon_0001", + "img": "wp_icon_10009", + "ico": "wp_icon_10009", "intr": { - "key": "itemdesc_1", - "text": "可以在以下道具中选择任选1个" + "key": "itemdesc_10009", + "text": "这本魔法书被强大的魔法封印了,通过第9999关后可以开启" }, "sale": [ { @@ -324,13 +324,13 @@ ] }, { - "id": "2", + "id": "10010", "name": { - "key": "itemname_2", - "text": "金币" + "key": "itemname_10010", + "text": "古代硬币" }, - "usetype": 4, - "color": 3, + "usetype": 2, + "color": 5, "bagtype": 1, "index": 10, "special_type": 0, @@ -340,16 +340,232 @@ "synthetize_num": 0, "access": 0, "use_skip": 0, - "upper_limit": 99999999, + "upper_limit": 999, "uselv": 0, "isani": 0, "star": 0, "race": 0, - "img": "wp_icon_0002", - "ico": "wp_icon_0002", + "img": "wp_icon_10010", + "ico": "wp_icon_10010", "intr": { - "key": "itemdesc_2", - "text": "货币" + "key": "itemdesc_10010", + "text": "似乎是某个失落文明的货币,暂时只有纪念意义" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "10011", + "name": { + "key": "itemname_10011", + "text": "坏掉的钟表" + }, + "usetype": 2, + "color": 3, + "bagtype": 1, + "index": 11, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": 0, + "use_skip": 0, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_10011", + "ico": "wp_icon_10011", + "intr": { + "key": "itemdesc_10011", + "text": "表针一动不动,也许有人可以修好它。" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "10012", + "name": { + "key": "itemname_10012", + "text": "木材" + }, + "usetype": 2, + "color": 2, + "bagtype": 1, + "index": 12, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": 0, + "use_skip": 0, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_10012", + "ico": "wp_icon_10012", + "intr": { + "key": "itemdesc_10012", + "text": "精致的木材,散发着淡淡的香气" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "10013", + "name": { + "key": "itemname_10013", + "text": "四叶草" + }, + "usetype": 2, + "color": 4, + "bagtype": 1, + "index": 13, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": 0, + "use_skip": 0, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_10013", + "ico": "wp_icon_10013", + "intr": { + "key": "itemdesc_10013", + "text": "把它放在背包里会带来好运" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "10014", + "name": { + "key": "itemname_10014", + "text": "冒险家勋章" + }, + "usetype": 2, + "color": 6, + "bagtype": 1, + "index": 14, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": 0, + "use_skip": 0, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_10014", + "ico": "wp_icon_10014", + "intr": { + "key": "itemdesc_10014", + "text": "你登录了游戏就是冒险家,就会获得这个勋章" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "10015", + "name": { + "key": "itemname_10015", + "text": "猫猫护身符" + }, + "usetype": 2, + "color": 5, + "bagtype": 1, + "index": 15, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": 0, + "use_skip": 0, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_10015", + "ico": "wp_icon_10015", + "intr": { + "key": "itemdesc_10015", + "text": "比幸运草更幸运" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "10016", + "name": { + "key": "itemname_10016", + "text": "人造钻石" + }, + "usetype": 2, + "color": 3, + "bagtype": 1, + "index": 16, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": 0, + "use_skip": 0, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_10016", + "ico": "wp_icon_10016", + "intr": { + "key": "itemdesc_10016", + "text": "钻石是人造的,所以不能用来买商城的商品" }, "sale": [ { From dd21220b46ae47048fd4850972d6200a5758f891 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 28 Jul 2022 15:00:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?hp=E5=B1=9E=E6=80=A7=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E7=8E=A9=E5=AE=B6=E5=A4=96=E5=9B=B4?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/chat/api_chanagechannel.go | 2 +- modules/chat/api_crosschannel.go | 2 +- modules/chat/api_spangetlist.go | 2 +- modules/chat/api_spansend.go | 2 +- modules/chat/modelChat.go | 2 +- modules/comp_model.go | 57 +++++++++++------------------- modules/hero/model_hero.go | 23 +++--------- modules/notify/api_getlist.go | 4 +-- modules/user/api_create.go | 2 +- modules/user/api_figure.go | 4 +-- modules/user/api_gettujian.go | 2 +- modules/user/api_modifyname.go | 4 +-- modules/user/model_expand.go | 49 +++++++++++++++++++++++++ modules/user/model_record.go | 2 +- modules/user/model_setting.go | 4 +-- modules/user/model_user.go | 2 +- modules/user/module.go | 7 ++-- 17 files changed, 95 insertions(+), 75 deletions(-) create mode 100644 modules/user/model_expand.go diff --git a/modules/chat/api_chanagechannel.go b/modules/chat/api_chanagechannel.go index caf874f78..fcedbec7c 100644 --- a/modules/chat/api_chanagechannel.go +++ b/modules/chat/api_chanagechannel.go @@ -28,7 +28,7 @@ func (this *apiComp) ChanageChannel(session comm.IUserSession, req *pb.ChatChana code = pb.ErrorCode_DBError return } - this.module.modelChat.ChanageUserExpand(session.GetUserId(), map[string]interface{}{ + this.module.ModuleUser.ChanageUserExpand(session.GetUserId(), map[string]interface{}{ "chatchannel": req.ChannelId, }) } diff --git a/modules/chat/api_crosschannel.go b/modules/chat/api_crosschannel.go index dd8992a40..a32ce3a47 100644 --- a/modules/chat/api_crosschannel.go +++ b/modules/chat/api_crosschannel.go @@ -23,7 +23,7 @@ func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossCh code = pb.ErrorCode_DBError return } - this.module.modelChat.ChanageUserExpand(session.GetUserId(), map[string]interface{}{ + this.module.ModuleUser.ChanageUserExpand(session.GetUserId(), map[string]interface{}{ "chatchannel": channel, }) session.SendMsg(string(this.module.GetType()), "crosschannel", &pb.ChatCrossChannelResp{ChannelId: channel}) diff --git a/modules/chat/api_spangetlist.go b/modules/chat/api_spangetlist.go index 670f33217..b01a9850a 100644 --- a/modules/chat/api_spangetlist.go +++ b/modules/chat/api_spangetlist.go @@ -21,7 +21,7 @@ func (this *apiComp) SpanGetList(session comm.IUserSession, req *pb.ChatSpanGetL list []*pb.DBChat group int32 ) - if result, err = this.module.modelChat.GetUserExpand(session.GetUserId()); err != nil { + if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { this.module.Errorf("err:%v", err) return } diff --git a/modules/chat/api_spansend.go b/modules/chat/api_spansend.go index 8b0f262b0..658140716 100644 --- a/modules/chat/api_spansend.go +++ b/modules/chat/api_spansend.go @@ -26,7 +26,7 @@ func (this *apiComp) SpanSend(session comm.IUserSession, req *pb.ChatSpanSendReq group int32 max_chat int32 ) - if userexpand, err = this.module.modelChat.GetUserExpand(session.GetUserId()); err != nil { + if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/chat/modelChat.go b/modules/chat/modelChat.go index fa4669230..1f04e44c4 100644 --- a/modules/chat/modelChat.go +++ b/modules/chat/modelChat.go @@ -220,7 +220,7 @@ func (this *modelChatComp) RemoveCrossChannelMember(session comm.IUserSession) ( var ( result *pb.DBUserExpand ) - if result, err = this.GetUserExpand(session.GetUserId()); err != nil { + if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { this.module.Errorf("err:%v", err) return } diff --git a/modules/comp_model.go b/modules/comp_model.go index edaa3836a..31d3a9aad 100644 --- a/modules/comp_model.go +++ b/modules/comp_model.go @@ -517,43 +517,17 @@ func (this *MCompModel) DelListlds(uid string, ids ...string) (err error) { } // 清除玩家英雄缓存信息 -func (this *MCompModel) ClearnHeroCache(uid string, ids ...string) (err error) { - listkey := this.ukey(uid) - for _, v := range ids { - key := this.ukeylist(uid, v) - if err = this.Redis.Delete(key); err != nil { - return - } - } - err = this.Redis.HDel(listkey, ids...) - return -} - -//获取用户通过扩展表 -func (this *MCompModel) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { - result = &pb.DBUserExpand{} - key := fmt.Sprintf("userexpand:%s", uid) - if err = this.Redis.HGetAll(key, result); err != nil { - return - } - if err == redis.RedisNil { - if err = this.DB.FindOne(core.SqlTable("userexpand"), bson.M{"uid": uid}).Decode(result); err != nil { - return - } - err = this.Redis.HMSet(key, result) - } - return -} - -//修改用户扩展数据 -func (this *MCompModel) ChanageUserExpand(uid string, value map[string]interface{}) (err error) { - key := fmt.Sprintf("userexpand:%s", uid) - if err = this.Redis.HMSet(key, value); err != nil && err != redis.RedisNil { - return - } - err = this.UpdateModelLogs("userexpand", uid, bson.M{"uid": uid}, value) - return -} +// func (this *MCompModel) ClearnHeroCache(uid string, ids ...string) (err error) { +// listkey := this.ukey(uid) +// for _, v := range ids { +// key := this.ukeylist(uid, v) +// if err = this.Redis.Delete(key); err != nil { +// return +// } +// } +// err = this.Redis.HDel(listkey, ids...) +// return +// } //批量读取列表数据 func (this *MCompModel) Batchgetlists(key string) (result []map[string]string, err error) { @@ -722,3 +696,12 @@ func (this *MCompModel) ChangeUserRecord(uid string, value map[string]interface{ err = this.UpdateModelLogs("userrecord", uid, bson.M{"uid": uid}, value) return } + +// 删除玩家缓存信息 +func (this *MCompModel) CleanUserRecord(uid string) (err error) { + err = this.Redis.Delete(this.ukey(uid)) + if err != nil { + return err + } + return +} diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 1ea8d811e..87d663809 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -112,7 +112,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int hero = this.initHero(uid, heroCfgId) if hero != nil { // 添加图鉴 - if result, err1 := this.GetUserExpand(uid); err1 == nil { + if result, err1 := this.moduleHero.ModuleUser.GetUserExpand(uid); err1 == nil { sz := make(map[string]bool, 0) for k := range result.GetTujian() { sz[k] = true @@ -122,7 +122,8 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int initUpdate := map[string]interface{}{ "tujian": sz, } - this.ChanageUserExpand(uid, initUpdate) + + this.moduleHero.ModuleUser.ChanageUserExpand(uid, initUpdate) } } hero.SameCount = count @@ -401,26 +402,10 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) { if lvGrow == nil { return } - resonConfig, err := this.moduleHero.configure.GetHeroResonanceConfig(hero.HeroID) - if err != nil { - return - } - - // 计算玩家共鸣属性 - property := make(map[string]int32, 0) - for keyType, value := range hero.Energy { - if keyType == 1 { - property[comm.Hp] += int32(math.Floor((1.0 + float64(resonConfig.Hppro*value)/1000) * float64(hero.Property[comm.Hp]))) - } else if keyType == 2 { - property[comm.Atk] += int32(math.Floor((1.0 + float64(resonConfig.Atkpro*value)/1000) * float64(hero.Property[comm.Atk]))) - } else if keyType == 3 { - property[comm.Def] += int32(math.Floor((1.0 + float64(resonConfig.Defpro*value)/1000) * float64(hero.Property[comm.Def]))) - } - } curHp := hero.Property[comm.Hp] exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v/1000", - (curHp + lvGrow.Hp), heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg) + (curHp + lvGrow.Hp), heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp) hp, _ := mengine.ParseAndExec(exprHp) curAtk := hero.Property[comm.Atk] diff --git a/modules/notify/api_getlist.go b/modules/notify/api_getlist.go index 13e5dcf96..2de69e2c2 100644 --- a/modules/notify/api_getlist.go +++ b/modules/notify/api_getlist.go @@ -26,7 +26,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.NotifyGetListReq return } if session.GetUserId() != "" { - if userexpand, err = this.module.modelNotify.GetUserExpand(session.GetUserId()); err != nil { + if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError return } @@ -34,7 +34,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.NotifyGetListReq userexpand = &pb.DBUserExpand{} } //修改最后公告读取时间 - this.module.modelNotify.ChanageUserExpand(session.GetUserId(), map[string]interface{}{ + this.module.ModuleUser.ChanageUserExpand(session.GetUserId(), map[string]interface{}{ "lastreadnotiftime": time.Now().Unix(), }) session.SendMsg(string(this.module.GetType()), "getlist", &pb.NotifyGetListResp{LastReadTime: userexpand.Lastreadnotiftime, SysNotify: notify}) diff --git a/modules/user/api_create.go b/modules/user/api_create.go index 006000127..8eeea05ab 100644 --- a/modules/user/api_create.go +++ b/modules/user/api_create.go @@ -62,7 +62,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c initUpdate := map[string]interface{}{ "modifynameCount": 1, //修改名称1次 } - if err := this.module.modelUser.ChanageUserExpand(session.GetUserId(), initUpdate); err != nil { + if err := this.module.modelExpand.ChanageUserExpand(session.GetUserId(), initUpdate); err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/user/api_figure.go b/modules/user/api_figure.go index 6eb72fc5a..4f21c8b56 100644 --- a/modules/user/api_figure.go +++ b/modules/user/api_figure.go @@ -23,7 +23,7 @@ func (this *apiComp) Figure(session comm.IUserSession, req *pb.UserFigureReq) (c return } - expand, err := this.module.modelUser.GetUserExpand(session.GetUserId()) + expand, err := this.module.modelExpand.GetUserExpand(session.GetUserId()) if err != nil { code = pb.ErrorCode_DBError return @@ -82,7 +82,7 @@ func (this *apiComp) Figure(session comm.IUserSession, req *pb.UserFigureReq) (c update = utils.StructToMap(curFigure) - this.module.modelUser.ChanageUserExpand(session.GetUserId(), update) + this.module.modelExpand.ChanageUserExpand(session.GetUserId(), update) } if err := session.SendMsg(string(this.module.GetType()), UserSubTypeFigure, rsp); err != nil { diff --git a/modules/user/api_gettujian.go b/modules/user/api_gettujian.go index 9e48d3bc6..58cc1ce7f 100644 --- a/modules/user/api_gettujian.go +++ b/modules/user/api_gettujian.go @@ -17,7 +17,7 @@ func (this *apiComp) GetTujian(session comm.IUserSession, req *pb.UserGetTujianR } rsp := &pb.UserGetTujianResp{} - if result, err := this.module.modelUser.GetUserExpand(session.GetUserId()); err != nil { + if result, err := this.module.modelExpand.GetUserExpand(session.GetUserId()); err != nil { this.module.Errorf("err:%v", err) return } else { diff --git a/modules/user/api_modifyname.go b/modules/user/api_modifyname.go index e7332fe5b..79b7bf133 100644 --- a/modules/user/api_modifyname.go +++ b/modules/user/api_modifyname.go @@ -28,7 +28,7 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam return } - expand, err := this.module.modelUser.GetUserExpand(session.GetUserId()) + expand, err := this.module.modelExpand.GetUserExpand(session.GetUserId()) if err != nil { code = pb.ErrorCode_DBError return @@ -52,7 +52,7 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam mc := map[string]interface{}{ "modifynameCount": expand.ModifynameCount - 1, } - if err := this.module.modelUser.ChanageUserExpand(session.GetUserId(), mc); err != nil { + if err := this.module.modelExpand.ChanageUserExpand(session.GetUserId(), mc); err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/user/model_expand.go b/modules/user/model_expand.go new file mode 100644 index 000000000..f6b9d586a --- /dev/null +++ b/modules/user/model_expand.go @@ -0,0 +1,49 @@ +package user + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/modules" + "go_dreamfactory/pb" +) + +// 记录一些扩展数据 +type ModelExpand struct { + modules.MCompModel + moduleUser *User +} + +func (this *ModelExpand) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompModel.Init(service, module, comp, options) + this.TableName = "userexpand" + this.moduleUser = module.(*User) + return +} + +//获取用户 +func (this *ModelExpand) getUserSession(uid string) (cuser *pb.CacheUser) { + cuser = &pb.CacheUser{} + if err := this.Get(uid, cuser); err != nil { + log.Errorf("GetUserSession err:%v", err) + return + } + return +} + +//获取用户通过扩展表 +func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { + result = &pb.DBUserExpand{} + if err = this.moduleUser.modelExpand.Get(uid, result); err != nil { + return + } + return result, err +} + +//修改用户扩展数据 +func (this *ModelExpand) ChanageUserExpand(uid string, value map[string]interface{}) (err error) { + if len(value) == 0 { + return nil + } + return this.moduleUser.modelExpand.Change(uid, value) + +} diff --git a/modules/user/model_record.go b/modules/user/model_record.go index 19e136141..55cca24cb 100644 --- a/modules/user/model_record.go +++ b/modules/user/model_record.go @@ -7,7 +7,7 @@ import ( "go_dreamfactory/pb" ) -// 记录一些扩展数据 +// 记录一些扩展数据 图鉴 改名次数等 type ModelRecord struct { modules.MCompModel } diff --git a/modules/user/model_setting.go b/modules/user/model_setting.go index 4dcb7a05a..051129027 100644 --- a/modules/user/model_setting.go +++ b/modules/user/model_setting.go @@ -63,7 +63,7 @@ func (this *ModelSetting) UpdateSetting(uid string, data map[string]interface{}) //校验时间和初始次数 func (this *ModelSetting) checkInitCount(uid string) bool { - ue, err := this.moduleUser.modelSetting.GetUserExpand(uid) + ue, err := this.moduleUser.modelExpand.GetUserExpand(uid) if err != nil { return false } @@ -80,7 +80,7 @@ func (this *ModelSetting) checkInitCount(uid string) bool { } ue.InitdataCount++ } else { - + } } diff --git a/modules/user/model_user.go b/modules/user/model_user.go index 31dacf38f..ae23c592a 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -152,7 +152,7 @@ func (this *ModelUser) InitFigure(uid string) { update := map[string]interface{}{ "preinstall": figureMap, } - this.ChanageUserExpand(uid, update) + this.moduleUser.modelExpand.ChanageUserExpand(uid, update) } // change exp diff --git a/modules/user/module.go b/modules/user/module.go index 6cc7559a3..78031ce79 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -21,6 +21,7 @@ type User struct { modelUser *ModelUser modelSession *ModelSession modelSetting *ModelSetting + modelExpand *ModelExpand configure *modules.MCompConfigure } @@ -46,6 +47,7 @@ func (this *User) OnInstallComp() { this.modelUser = this.RegisterComp(new(ModelUser)).(*ModelUser) this.modelSession = this.RegisterComp(new(ModelSession)).(*ModelSession) this.modelSetting = this.RegisterComp(new(ModelSetting)).(*ModelSetting) + this.modelExpand = this.RegisterComp(new(ModelExpand)).(*ModelExpand) } //获取用户数据 @@ -70,6 +72,7 @@ func (this *User) GetUserSession(uid string) *pb.CacheUser { func (this *User) CleanSession(session comm.IUserSession) { this.modelSession.Del(session.GetUserId(), modules.SetDBMgoLog(false)) this.modelUser.Del(session.GetUserId(), modules.SetDBMgoLog(false)) + //this.modelExpand.Del(session.GetUserId(), modules.SetDBMgoLog(false)) // 暂时不清 } //查询用户属性值 例如 金币 经验 @@ -170,9 +173,9 @@ func (this *User) EventUserChanged(session comm.IUserSession) { } func (this *User) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { - return this.modelUser.GetUserExpand(uid) + return this.modelExpand.GetUserExpand(uid) } func (this *User) ChanageUserExpand(uid string, value map[string]interface{}) error { - return this.modelUser.ChanageUserExpand(uid, value) + return this.modelExpand.ChanageUserExpand(uid, value) }