修复配置中心 启动接口被多次执行的bug

This commit is contained in:
liwei1dao 2022-08-25 11:15:43 +08:00
parent b5c5636fb6
commit 24885902af
6 changed files with 14 additions and 6 deletions

View File

@ -9,6 +9,9 @@ import (
//参数校验 //参数校验
func (this *apiComp) ChanageChannelCheck(session comm.IUserSession, req *pb.ChatChanageChannelReq) (code pb.ErrorCode) { func (this *apiComp) ChanageChannelCheck(session comm.IUserSession, req *pb.ChatChanageChannelReq) (code pb.ErrorCode) {
if req.ChannelId < 0 {
code = pb.ErrorCode_ReqParameterError
}
return return
} }

View File

@ -19,6 +19,9 @@ func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossCh
channel int32 channel int32
err error err error
) )
if code = this.CrossChannelCheck(session, req); code != pb.ErrorCode_Success {
return
}
if channel, err = this.module.modelChat.AddCrossChannelMember(session); err != nil { if channel, err = this.module.modelChat.AddCrossChannelMember(session); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return

View File

@ -22,6 +22,11 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
result *pb.DBUserExpand result *pb.DBUserExpand
list []*pb.DBChat list []*pb.DBChat
) )
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
return
}
switch req.Channel { switch req.Channel {
case pb.ChatChannel_World: case pb.ChatChannel_World:
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {

View File

@ -16,7 +16,6 @@ import (
func (this *apiComp) UpgradeCheck(session comm.IUserSession, req *pb.EquipmentUpgradeReq) (code pb.ErrorCode) { func (this *apiComp) UpgradeCheck(session comm.IUserSession, req *pb.EquipmentUpgradeReq) (code pb.ErrorCode) {
if req.EquipmentId == "" { if req.EquipmentId == "" {
this.module.Errorf("Upgrade 请求参数错误 req:%v", req)
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }

View File

@ -8,7 +8,6 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"github.com/smallnest/rpcx/log"
) )
/* /*
@ -68,7 +67,7 @@ func (this *Equipment) EventUserOffline(session comm.IUserSession) {
func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) { func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) {
var err error var err error
if uid == "" || id == "" { if uid == "" || id == "" {
log.Errorf("请求参数错误 uid:%s Id:%s", uid, id) this.Errorf("请求参数错误 uid:%s Id:%s", uid, id)
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }
@ -95,7 +94,7 @@ func (this *Equipment) AddNewEquipments(source *comm.ModuleCallSource, session c
change []*pb.DB_Equipment change []*pb.DB_Equipment
) )
if change, err = this.modelEquipment.AddEquipments(session.GetUserId(), cIds); err != nil { if change, err = this.modelEquipment.AddEquipments(session.GetUserId(), cIds); err != nil {
log.Errorf("err%v", err) this.Errorf("err%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
} }

View File

@ -31,7 +31,6 @@ func newSys(options Options) (sys *Configure, err error) {
configure: make(map[string]interface{}), configure: make(map[string]interface{}),
fileinfos: make(map[string]*FileInfo), fileinfos: make(map[string]*FileInfo),
} }
sys.Start()
return return
} }
@ -193,7 +192,7 @@ func (this *Configure) checkConfigure() {
} }
for _, v := range handle.events { for _, v := range handle.events {
if v != nil { if v != nil {
v() go v()
} }
} }
} }