上传gm接口代码
This commit is contained in:
parent
77e141ec29
commit
b9650a5ea6
@ -48,7 +48,7 @@ const (
|
|||||||
|
|
||||||
//RPC服务接口定义处
|
//RPC服务接口定义处
|
||||||
const ( //Rpc
|
const ( //Rpc
|
||||||
//Gateway
|
//Gateway 网关消息
|
||||||
Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由
|
Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由
|
||||||
Rpc_GatewayAgentBind core.Rpc_Key = "Rpc_GatewayAgentBind" //代理绑定 绑定用户Id
|
Rpc_GatewayAgentBind core.Rpc_Key = "Rpc_GatewayAgentBind" //代理绑定 绑定用户Id
|
||||||
Rpc_GatewayAgentUnBind core.Rpc_Key = "Rpc_GatewayAgentUnBind" //代理解绑 解绑用户Id
|
Rpc_GatewayAgentUnBind core.Rpc_Key = "Rpc_GatewayAgentUnBind" //代理解绑 解绑用户Id
|
||||||
@ -57,8 +57,8 @@ const ( //Rpc
|
|||||||
Rpc_GatewaySendRadioMsg core.Rpc_Key = "Rpc_GatewaySendRadioMsg" //广播消息
|
Rpc_GatewaySendRadioMsg core.Rpc_Key = "Rpc_GatewaySendRadioMsg" //广播消息
|
||||||
Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接
|
Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接
|
||||||
Rpc_GatewayNoticeUserClose core.Rpc_Key = "Rpc_NoticeUserClose" //通知用户离线
|
Rpc_GatewayNoticeUserClose core.Rpc_Key = "Rpc_NoticeUserClose" //通知用户离线
|
||||||
//Chat
|
//GM 后台消息
|
||||||
Rpc_ReleaseSystemMessage core.Rpc_Key = "Rpc_ReleaseSystemMessage" //发布系统消息
|
Rpc_GMReleaseChatSystemMessage core.Rpc_Key = "Rpc_GMChatReleaseSystemMessage" //发布聊天系统消息
|
||||||
)
|
)
|
||||||
|
|
||||||
//事件类型定义处
|
//事件类型定义处
|
||||||
|
@ -13,11 +13,11 @@ type CreateNotifyReq struct {
|
|||||||
Sign string `json:"sign"`
|
Sign string `json:"sign"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//服务列表
|
//创建公告
|
||||||
func (this *Api_Comp) CreateNotify(c *engine.Context) {
|
func (this *Api_Comp) CreateNotify(c *engine.Context) {
|
||||||
req := &CreateNotifyReq{}
|
req := &CreateNotifyReq{}
|
||||||
err := c.BindJSON(&req)
|
err := c.BindJSON(&req)
|
||||||
log.Debugf("CreateNotify:%+v err:%v", req, err)
|
this.module.Debugf("CreateNotify:%+v err:%v", req, err)
|
||||||
var (
|
var (
|
||||||
code pb.ErrorCode
|
code pb.ErrorCode
|
||||||
msg string
|
msg string
|
||||||
|
@ -9,9 +9,10 @@ import (
|
|||||||
|
|
||||||
//模拟账户注册
|
//模拟账户注册
|
||||||
func (this *Api_Comp) Register(c *engine.Context) {
|
func (this *Api_Comp) Register(c *engine.Context) {
|
||||||
var req pb.UserRegisterReq
|
|
||||||
rsp := &pb.UserRegisterResp{}
|
rsp := &pb.UserRegisterResp{}
|
||||||
|
req := pb.UserRegisterReq{}
|
||||||
err := c.BindJSON(&req)
|
err := c.BindJSON(&req)
|
||||||
|
this.module.Debugf("Register:%+v err:%v", req, err)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err := this.module.modelUser.User_Create(&pb.DBUser{
|
err := this.module.modelUser.User_Create(&pb.DBUser{
|
||||||
Binduid: req.Account,
|
Binduid: req.Account,
|
||||||
|
@ -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)
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
package gm
|
package gm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
@ -49,3 +50,35 @@ func (this *GM) OnInstallComp() {
|
|||||||
this.modelNotify = this.RegisterComp(new(modelNotifyComp)).(*modelNotifyComp)
|
this.modelNotify = this.RegisterComp(new(modelNotifyComp)).(*modelNotifyComp)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
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...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user