go_dreamfactory/cmd/robot/notify.go
2022-06-17 16:59:44 +08:00

27 lines
464 B
Go

package robot
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
//统一通知处理
func (r *Robot) handleNotifyMsg(msg *pb.UserMessage) {
switch msg.SubType {
case comm.SubType_ErrorNotify:
r.handleError(msg)
default:
fmt.Printf("subType: %s not define", msg.SubType)
}
}
//处理错误
func (r *Robot) handleError(msg *pb.UserMessage) {
rsp := &pb.ErrorNotify{}
if !comm.ProtoUnmarshal(msg, rsp) {
return
}
printReply(msg, rsp)
}