上传gm接口代码

This commit is contained in:
liwei1dao 2022-07-22 17:05:28 +08:00
parent 77e141ec29
commit b9650a5ea6
5 changed files with 40 additions and 19 deletions

View File

@ -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" //发布聊天系统消息
)
//事件类型定义处

View File

@ -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

View File

@ -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,

View File

@ -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)
}

View File

@ -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...)
}
}