This commit is contained in:
meixiongfeng 2023-01-31 18:33:51 +08:00
commit d29c62f0ee
21 changed files with 448 additions and 270 deletions

View File

@ -7,12 +7,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -33,12 +33,12 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -59,12 +59,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -85,12 +85,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -111,12 +111,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -137,12 +137,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -163,12 +163,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -189,12 +189,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -215,12 +215,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -241,12 +241,12 @@
},
"main": [
{
"key": "platlv",
"param": 2
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -267,12 +267,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -293,12 +293,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -319,12 +319,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -345,12 +345,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -371,12 +371,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -397,12 +397,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -423,12 +423,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -449,12 +449,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -475,12 +475,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -501,12 +501,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -527,12 +527,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -553,12 +553,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -579,12 +579,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -605,12 +605,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -631,12 +631,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -657,12 +657,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -683,12 +683,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -709,12 +709,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -735,7 +735,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -757,12 +757,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -783,12 +783,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -809,12 +809,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -835,12 +835,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -861,12 +861,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -887,12 +887,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -913,12 +913,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -939,12 +939,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -965,12 +965,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -991,12 +991,12 @@
},
"main": [
{
"key": "platlv",
"param": 999
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1017,12 +1017,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1043,12 +1043,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1069,12 +1069,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1095,12 +1095,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1121,12 +1121,12 @@
},
"main": [
{
"key": "platlv",
"param": 20
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1147,12 +1147,12 @@
},
"main": [
{
"key": "platlv",
"param": 3
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1173,12 +1173,12 @@
},
"main": [
{
"key": "platlv",
"param": 13
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1199,12 +1199,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1225,7 +1225,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -1247,7 +1247,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -1269,7 +1269,7 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
}
],
@ -1291,12 +1291,12 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1317,12 +1317,12 @@
},
"main": [
{
"key": "platlv",
"param": 4
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1343,12 +1343,12 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1369,12 +1369,12 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1395,12 +1395,12 @@
},
"main": [
{
"key": "platlv",
"param": 5
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1421,12 +1421,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1447,12 +1447,12 @@
},
"main": [
{
"key": "platlv",
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1473,12 +1473,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1499,12 +1499,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1525,12 +1525,12 @@
},
"main": [
{
"key": "platlv",
"param": 10
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1551,12 +1551,12 @@
},
"main": [
{
"key": "platlv",
"param": 30
"key": 1,
"param": 1
},
{
"key": "maxmapid",
"param": 1
"key": 2,
"param": 1100101
}
],
"optional": "",
@ -1577,8 +1577,8 @@
},
"main": [
{
"key": "worldtaskid",
"param": 20050
"key": 3,
"param": 20010
}
],
"optional": "",
@ -1599,8 +1599,8 @@
},
"main": [
{
"key": "worldtaskid",
"param": 20050
"key": 3,
"param": 20010
}
],
"optional": "",
@ -1621,8 +1621,8 @@
},
"main": [
{
"key": "worldtaskid",
"param": 20050
"key": 3,
"param": 20010
}
],
"optional": "",

View File

@ -78,6 +78,7 @@ const (
ModuleEnchant core.M_Modules = "enchant" //附魔
ModuleAutoBattle core.M_Modules = "autobattle" //自动战斗
ModuleMline core.M_Modules = "mline" //主线模块
ModuleRTimePVP core.M_Modules = "rtimepvp" //实时pvp
)
//数据表名定义处

View File

@ -2,6 +2,7 @@ package comm
import (
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
type (
@ -17,6 +18,7 @@ type (
type (
ISys interface {
IsAccess(funcName string, uid string) (code pb.ErrorCode)
ValidCond(uid string, conf *cfg.GameOpencondData) string
}
//邮件业务模块对外接口定义 提供给其他模块使用的

View File

@ -10,6 +10,7 @@ import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
type ModelFriend struct {
@ -21,6 +22,10 @@ func (this *ModelFriend) Init(service core.IService, module core.IModule, comp c
this.TableName = comm.TableFriend
err = this.MCompModel.Init(service, module, comp, options)
this.moduleFriend = module.(*Friend)
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}

View File

@ -195,6 +195,7 @@ func (this *ModelItemsComp) QueryUserPackItemsAmount(uId string, itemid ...strin
itmes []*pb.DB_UserItemData
err error
)
if itmes, err = this.QueryUserPack(uId); err != nil {
this.module.Errorf("err:%v", err)
return

View File

@ -81,9 +81,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
// if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
// cd = pb.ErrorCode_CacheReadError
// }
if cd = this.module.CheckRes(session, boss.PsConsume); cd != pb.ErrorCode_Success {
return
}
// if umfantasy.Ticket < this.module.configure.GetGlobalConf().DreamlandCos {
// cd = pb.ErrorCode_MoonfantasyNotEnoughbattles
// }
@ -92,6 +90,12 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
cd = pb.ErrorCode_ConfigNoFound
return
}
if cd = this.module.ModuleItems.RecoverTicket(session); cd != pb.ErrorCode_Success {
return
}
if cd = this.module.CheckRes(session, boss.PsConsume); cd != pb.ErrorCode_Success {
return
}
if len(mdata.Join) >= int(mdata.Numup) {
cd = pb.ErrorCode_MoonfantasyJoinUp

View File

@ -25,11 +25,12 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.MoonfantasyGetLi
code = pb.ErrorCode_CacheReadError
return
}
this.module.modelUserMF.recoverTicket(session, info)
if err = this.module.modelUserMF.updateUserInfo(info); err != nil {
code = pb.ErrorCode_DBError
return
}
// this.module.modelUserMF.recoverTicket(session, info)
// if err = this.module.modelUserMF.updateUserInfo(info); err != nil {
// code = pb.ErrorCode_DBError
// return
// }
this.module.ModuleItems.RecoverTicket(session)
mfantasys, err = this.module.modelDream.querymfantasys(session.GetUserId())
session.SendMsg(string(this.module.GetType()), "getlist", &pb.MoonfantasyGetListResp{
// BattleNum: info.Ticket,

View File

@ -63,8 +63,7 @@ func (this *modelUserMF) queryUsermfantasy(uId string) (info *pb.DBUserMFantasy,
///保存用户竞技场信息
func (this *modelUserMF) updateUserInfo(info *pb.DBUserMFantasy) (err error) {
this.Change(info.Uid, map[string]interface{}{
"triggerNum": info.TriggerNum,
// "ticket": info.Ticket,
"triggerNum": info.TriggerNum,
"buyNum": info.BuyNum,
"lastTrigger": info.LastTrigger,
"lastrtickettime": info.Lastrtickettime,

View File

@ -9,6 +9,7 @@ import (
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
type ModelRtaskRecord struct {
@ -22,6 +23,10 @@ func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, c
err = this.MCompModel.Init(service, module, comp, options)
this.moduleRtask = module.(*ModuleRtask)
this.service = service
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}

29
modules/rtimepvp/api.go Normal file
View File

@ -0,0 +1,29 @@
package rtimepvp
import (
"go_dreamfactory/modules"
"go_dreamfactory/lego/core"
)
/*
装备模块 API
*/
type apiComp struct {
modules.MCompGate
service core.IService
module *RTimePVP
}
//组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options)
this.module = module.(*RTimePVP)
this.service = service
return
}
func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start()
return
}

View File

@ -0,0 +1,28 @@
package rtimepvp
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
/*
模块名:实时PVP
描述:同步战斗模块
开发:李伟
*/
func NewModule() core.IModule {
m := new(RTimePVP)
return m
}
type RTimePVP struct {
modules.ModuleBase
service base.IRPCXService
}
//模块名
func (this *RTimePVP) GetType() core.M_Modules {
return comm.ModuleRTimePVP
}

View File

@ -49,6 +49,9 @@ func (this *ModelSociaty) Init(service core.IService, module core.IModule, comp
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "_id", Value: bsonx.Int32(1)}},
})
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "name", Value: bsonx.Int32(1)}},
})
this.module = module.(*Sociaty)
this.service = service
this.EventApp = event_v2.NewApp()

View File

@ -25,13 +25,9 @@ func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq)
if len(req.Keys) == 0 {
confList := this.moduleSys.configure.getOpencondList()
for _, v := range confList {
// 返回未开启的功能列表
for _, conf := range v.Main {
// 校验玩家等级
if conf.Key == "platlv" && user.Lv >= conf.Param {
funcList = append(funcList, v.Id)
continue
}
id := this.moduleSys.modelSys.validCond(session.GetUserId(), v)
if id != "" {
funcList = append(funcList, id)
}
}
} else {
@ -41,12 +37,9 @@ func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq)
continue
}
if conf, ok := opencfg.GetDataMap()[key]; ok {
for _, main := range conf.Main {
// 校验玩家等级
if main.Key == "platlv" && user.Lv >= main.Param {
funcList = append(funcList, key)
continue
}
id := this.moduleSys.modelSys.validCond(session.GetUserId(), conf)
if id != "" {
funcList = append(funcList, id)
}
}
}

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
type ModelSys struct {
@ -27,14 +28,73 @@ func (this *ModelSys) IsAccess(funName string, uid string) (code pb.ErrorCode) {
if user != nil {
conf := this.moduleSys.configure.getFuncCfg(funName)
if conf != nil {
for _, v := range conf.Main {
if v.Key == "platlv" && user.Lv < v.Param {
code = pb.ErrorCode_NoOpened
return
}
}
this.validCond(uid, conf)
}
}
return
}
func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) string {
var flag bool
for _, conf := range condData.Main {
switch conf.Key {
case 1: //等级
iuser := this.moduleSys.ModuleUser
user := iuser.GetUser(uid)
if user == nil {
flag = false
return ""
}
if user.Lv >= conf.Param {
flag = true
}else{
flag = false
}
case 2: //关卡ID
iuser := this.moduleSys.ModuleUser
ex, err := iuser.GetUserExpand(uid)
if err != nil {
flag = false
return ""
}
if ex.Uid == "" {
flag = false
return ""
}
if v, ok := ex.Mline[1]; ok {
if v >= conf.Param {
flag = true
}else{
flag = false
}
}else{
flag = false
}
case 3: //世界任务ID
module, err := this.service.GetModule(comm.ModuleWorldtask)
if err != nil {
this.moduleSys.Debugln(err)
flag = false
return ""
}
if i, ok := module.(comm.IWorldtask); ok {
d := i.GetMyWorldtask(uid)
if _, ok := d.LastTaskIds[conf.Param]; ok {
flag = true
}else{
flag = false
}
}else{
flag = false
}
}
}
if flag {
return condData.Id
}
return ""
}

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
var _ comm.ISys = (*ModuleSys)(nil)
@ -40,3 +41,7 @@ func (this *ModuleSys) GetType() core.M_Modules {
func (this *ModuleSys) IsAccess(funcName string, userId string) (code pb.ErrorCode) {
return this.modelSys.IsAccess(funcName, userId)
}
func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string {
return this.modelSys.validCond(uid, conf)
}

View File

@ -68,6 +68,20 @@ func (this *configureComp) LoadSignData() {
return
}
func (this *configureComp) GetOpenCondList() []*cfg.GameOpencondData {
if v, err := this.GetConfigure(gameOpencond); err != nil {
return nil
} else {
data, ok := v.(*cfg.GameOpencond)
if !ok {
err = fmt.Errorf("%T no is *cfg.GameOpencond", v)
return nil
}
return data.GetDataList()
}
return nil
}
func (this *configureComp) FindFunc(lv int32) (funcIds []string) {
if v, err := this.GetConfigure(gameOpencond); err != nil {
return nil
@ -79,7 +93,7 @@ func (this *configureComp) FindFunc(lv int32) (funcIds []string) {
}
for _, d := range data.GetDataList() {
for _, v := range d.Main {
if v.Key == "platlv" && v.Param == lv {
if v.Key == 1 && v.Param == lv {
funcIds = append(funcIds, d.Id)
continue
}

View File

@ -273,7 +273,20 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{
)
return
}
et.TriggerEvent(comm.EventOpenCond, ul.session.GetUserId(), this.module.configure.FindFunc(curLv))
module, err2 := this.module.service.GetModule(comm.ModuleSys)
if err2 == nil {
if isys, ok := module.(comm.ISys); ok {
var funcList []string
for _, conf := range this.module.configure.GetOpenCondList() {
id := isys.ValidCond(ul.session.GetUserId(), conf)
if id != "" {
funcList = append(funcList, id)
}
}
et.TriggerEvent(comm.EventOpenCond, ul.session.GetUserId(), funcList)
}
}
if err := ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
&pb.UserLvChangedPush{Uid: ul.session.GetUserId(), Exp: curExp, Lv: curLv}); err != nil {
this.module.Error("玩家等级变化 UserSubTypeLvChangedPush推送失败",

View File

@ -8,7 +8,6 @@ import (
"go_dreamfactory/sys/configure"
"go_dreamfactory/sys/db"
"reflect"
"runtime"
"sync"
"time"
@ -119,15 +118,15 @@ func (this *SCompGateRoute) RegisterRoute(methodName string, comp reflect.Value,
//Rpc_GatewayRoute服务接口的接收函数
func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessage, reply *pb.RPCMessageReply) (err error) {
method := fmt.Sprintf("%s.%s", args.MainType, args.SubType)
defer func() { //程序异常 收集异常信息传递给前端显示
if r := recover(); r != nil {
buf := make([]byte, 4096)
l := runtime.Stack(buf, false)
reply.Code = pb.ErrorCode_Exception
reply.ErrorMessage = fmt.Sprintf("%v: %s", r, buf[:l])
log.Errorf("[Handle Api] m:%s reply:%s", method, reply)
}
}()
// defer func() { //程序异常 收集异常信息传递给前端显示
// if r := recover(); r != nil {
// buf := make([]byte, 4096)
// l := runtime.Stack(buf, false)
// reply.Code = pb.ErrorCode_Exception
// reply.ErrorMessage = fmt.Sprintf("%v: %s", r, buf[:l])
// log.Errorf("[Handle Api] m:%s reply:%s", method, reply)
// }
// }()
//获取用户消息处理函数
this.mrlock.RLock()
msghandle, ok := this.msghandles[method]

View File

@ -0,0 +1,16 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
const (
GameOpencondType_None = 0
GameOpencondType_Platlv = 1
GameOpencondType_Maxmapid = 2
GameOpencondType_Worldtaskid = 3
)

View File

@ -11,7 +11,7 @@ package cfg
import "errors"
type GameOpenedCond struct {
Key string
Key int32
Param int32
}
@ -22,7 +22,7 @@ func (*GameOpenedCond) GetTypeId() int32 {
}
func (_v *GameOpenedCond)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.Key, _ok_ = _buf["key"].(string); !_ok_ { err = errors.New("key error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["param"].(float64); !_ok_ { err = errors.New("param error"); return }; _v.Param = int32(_tempNum_) }
return
}

View File

@ -441,7 +441,7 @@ func (this *DBModel) GetList(uid string, data interface{}) (err error) {
buf := make([]byte, 4096)
l := runtime.Stack(buf, false)
err = fmt.Errorf("%v: %s", r, buf[:l])
log.Errorf("[DB GetList] TableName:%s uid:%s", this.TableName, uid)
log.Errorf("[DB GetList] TableName:%s uid:%s err:%v", this.TableName, uid, err)
}
}()
var (