liuxiaolong
2019-06-26 73000facfdc05d2c72d418aa4b7b2cc9c078d695
service/FaceSdkService.go
@@ -6,6 +6,9 @@
   "encoding/json"
   "fmt"
   "github.com/gogo/protobuf/proto"
   "github.com/satori/go.uuid"
   "io/ioutil"
   "time"
)
const (
@@ -13,6 +16,26 @@
   Url_Service_PULL = "tcp:///tmp///webserver-1.ipc"
)
var imgPushChan chan protomsg.Recvmsg
func TestPushImgMsg() {
   InitService()
   imgData := readImgFile()
   for {
      PushImgMsg(protomsg.Recvmsg{
         Id:uuid.NewV4().String(),
         Addr:"",
         Picdata:imgData,
      })
      time.Sleep(5*time.Second)
   }
}
func readImgFile() []byte{
   filePath := "/home/user/workspace/timg.jpg"
   bytes, _ := ioutil.ReadFile(filePath)
   return bytes
}
func PushImgMsg(is protomsg.Recvmsg){
   imgPushChan <- is
@@ -42,7 +65,7 @@
      }
      rMsg := protomsg.SdkMessage{}
      if err := proto.Unmarshal(resultBytes, &rMsg);err !=nil{
         fmt.Println(rMsg)
         fmt.Println("recv MSG:",rMsg)
         resultMap[rMsg.Cid] = rMsg
      }