Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
a0e7048039
@ -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
|
||||
)
|
||||
|
||||
//数据表名定义处
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
29
modules/rtimepvp/api.go
Normal file
29
modules/rtimepvp/api.go
Normal 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
|
||||
}
|
28
modules/rtimepvp/module.go
Normal file
28
modules/rtimepvp/module.go
Normal 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
|
||||
}
|
@ -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]
|
||||
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user