diff --git a/comm/const.go b/comm/const.go index cd50fa6b2..25e6e1114 100644 --- a/comm/const.go +++ b/comm/const.go @@ -48,7 +48,7 @@ const ( //RPC服务接口定义处 const ( //Rpc - //Gateway + //Gateway 网关消息 Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由 Rpc_GatewayAgentBind core.Rpc_Key = "Rpc_GatewayAgentBind" //代理绑定 绑定用户Id Rpc_GatewayAgentUnBind core.Rpc_Key = "Rpc_GatewayAgentUnBind" //代理解绑 解绑用户Id @@ -57,8 +57,8 @@ const ( //Rpc Rpc_GatewaySendRadioMsg core.Rpc_Key = "Rpc_GatewaySendRadioMsg" //广播消息 Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接 Rpc_GatewayNoticeUserClose core.Rpc_Key = "Rpc_NoticeUserClose" //通知用户离线 - //Chat - Rpc_ReleaseSystemMessage core.Rpc_Key = "Rpc_ReleaseSystemMessage" //发布系统消息 + //GM 后台消息 + Rpc_GMReleaseChatSystemMessage core.Rpc_Key = "Rpc_GMChatReleaseSystemMessage" //发布聊天系统消息 ) //事件类型定义处 diff --git a/modules/gm/api_createnotify.go b/modules/gm/api_createnotify.go index 2c6d4b859..c4045b4e6 100644 --- a/modules/gm/api_createnotify.go +++ b/modules/gm/api_createnotify.go @@ -13,11 +13,11 @@ type CreateNotifyReq struct { Sign string `json:"sign"` } -//服务列表 +//创建公告 func (this *Api_Comp) CreateNotify(c *engine.Context) { req := &CreateNotifyReq{} err := c.BindJSON(&req) - log.Debugf("CreateNotify:%+v err:%v", req, err) + this.module.Debugf("CreateNotify:%+v err:%v", req, err) var ( code pb.ErrorCode msg string diff --git a/modules/gm/api_register.go b/modules/gm/api_register.go index 424d72c9b..85641b0fa 100644 --- a/modules/gm/api_register.go +++ b/modules/gm/api_register.go @@ -9,9 +9,10 @@ import ( //模拟账户注册 func (this *Api_Comp) Register(c *engine.Context) { - var req pb.UserRegisterReq rsp := &pb.UserRegisterResp{} + req := pb.UserRegisterReq{} err := c.BindJSON(&req) + this.module.Debugf("Register:%+v err:%v", req, err) if err == nil { err := this.module.modelUser.User_Create(&pb.DBUser{ Binduid: req.Account, diff --git a/modules/gm/api_srvlist.go b/modules/gm/api_srvlist.go deleted file mode 100644 index b4be53916..000000000 --- a/modules/gm/api_srvlist.go +++ /dev/null @@ -1,13 +0,0 @@ -package gm - -import ( - "go_dreamfactory/lego/sys/gin/engine" - "net/http" -) - -//服务列表 -func (this *Api_Comp) ServerList(c *engine.Context) { - conf := this.module.configure.getServerListConf() - - c.JSON(http.StatusOK, conf) -} diff --git a/modules/gm/module.go b/modules/gm/module.go index 45e6d84fe..85c1329c9 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -1,6 +1,7 @@ package gm import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" @@ -49,3 +50,35 @@ func (this *GM) OnInstallComp() { this.modelNotify = this.RegisterComp(new(modelNotifyComp)).(*modelNotifyComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } + +//日志 +func (this *GM) Debugf(format string, a ...interface{}) { + if this.options.GetDebug() { + this.options.GetLog().Debugf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) + } +} +func (this *GM) Infof(format string, a ...interface{}) { + if this.options.GetDebug() { + this.options.GetLog().Infof(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) + } +} +func (this *GM) Warnf(format string, a ...interface{}) { + if this.options.Debug { + this.options.GetLog().Warnf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) + } +} +func (this *GM) Errorf(format string, a ...interface{}) { + if this.options.GetLog() != nil { + this.options.GetLog().Errorf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) + } +} +func (this *GM) Panicf(format string, a ...interface{}) { + if this.options.GetLog() != nil { + this.options.GetLog().Panicf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) + } +} +func (this *GM) Fatalf(format string, a ...interface{}) { + if this.options.GetLog() != nil { + this.options.GetLog().Fatalf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) + } +}