You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
751 B
Go
50 lines
751 B
Go
package main
|
|
|
|
import (
|
|
"app/network"
|
|
"app/service/main/message/pb"
|
|
"app/service/main/msg_util"
|
|
"app/service/robot/user"
|
|
"sync"
|
|
)
|
|
|
|
func main() {
|
|
client := network.NewTcpClient(
|
|
":8888",
|
|
newParser,
|
|
newHandler)
|
|
err := client.Connect(false)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
err = client.SendMsg(&pb.Report{
|
|
Info: []*pb.ReportInfo{
|
|
{
|
|
OpenId: "1",
|
|
Score: 123,
|
|
},
|
|
{
|
|
OpenId: "2",
|
|
Score: 456,
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
wg := &sync.WaitGroup{}
|
|
wg.Add(1)
|
|
wg.Wait()
|
|
}
|
|
|
|
func newParser() network.ICodec {
|
|
return msg_util.NewProtoCodec(msg_util.NewProtoParser("message", "MSG_TYPE"), 1024*64, false)
|
|
}
|
|
|
|
func newHandler() network.INetHandler {
|
|
return user.NewUser()
|
|
}
|