上传编辑器模块代码

This commit is contained in:
liwei1dao 2022-11-25 23:27:52 +08:00
parent f3327b05ad
commit 33f54010b0
2 changed files with 37 additions and 1 deletions

View File

@ -17,6 +17,8 @@ import (
"go_dreamfactory/sys/configure"
"go_dreamfactory/sys/db"
"os"
"os/signal"
"syscall"
"testing"
"time"
@ -97,7 +99,27 @@ func Test_Comment(t *testing.T) {
fmt.Println(err)
return
} else {
defer connect.Close()
go func() {
var (
data []byte
msg *pb.BattleRpcMessage = &pb.BattleRpcMessage{}
err error
)
locp:
for {
if _, data, err = connect.ReadMessage(); err != nil {
fmt.Println(err)
break locp
}
if err = proto.Unmarshal(data, msg); err != nil {
fmt.Println(err)
break locp
}
fmt.Println(msg)
}
}()
msg := &pb.BattleRpcMessage{
Rid: 1,
Method: "test",
@ -105,5 +127,18 @@ func Test_Comment(t *testing.T) {
msg.Data, _ = anypb.New(&pb.BattleTestMessage{})
data, _ := proto.Marshal(msg)
connect.WriteMessage(websocket.BinaryMessage, data)
//监听外部关闭服务信号
c := make(chan os.Signal, 1)
//添加进程结束信号
signal.Notify(c,
os.Interrupt, //退出信号 ctrl+c退出
syscall.SIGHUP, //终端控制进程结束(终端连接断开)
syscall.SIGINT, //用户发送INTR字符(Ctrl+C)触发
syscall.SIGTERM, //结束程序(可以被捕获、阻塞或忽略)
syscall.SIGQUIT) //用户发送QUIT字符(Ctrl+/)触发
select {
case sig := <-c:
fmt.Printf("signal = %v\n", sig)
}
}
}

View File

@ -58,6 +58,7 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
}
this.module.DispenseRes(session, manster.Award, true)
pass = true
for _, v := range level.Passdroplist {
ispass := false
for _, v1 := range info.Passdrop {