From 4d14183d92283a0edf77ef20d6dfab9bc0da56f9 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 30 七月 2019 13:53:48 +0800
Subject: [PATCH] add taskSdkRule

---
 reqrepClient.go |   87 ++++++++++++++++++++++++++++++-------------
 1 files changed, 60 insertions(+), 27 deletions(-)

diff --git a/reqrepClient.go b/reqrepClient.go
index ff88b3b..8faf905 100644
--- a/reqrepClient.go
+++ b/reqrepClient.go
@@ -1,30 +1,63 @@
 package dbapi
 
-import (
-	"basic.com/valib/deliver.git"
-	"basic.com/pubsub/protomsg.git"
-	"encoding/json"
-	"fmt"
-)
+type ReqRepClient struct {}
 
-type ReqrepApi struct {
-
-}
-
-const (
-	ReqRep_URL = "tcp://192.168.1.11:8002"
-)
-
-func (api ReqrepApi)SendRequestAndGetReply(reqStr string) string {
-	sender := deliver.NewClient(deliver.Mode(deliver.ReqRep), ReqRep_URL)
-	var sendMsg = protomsg.SdkMessage{}
-	sendMsg.Cid = "kkkk"
-	byteArr, _ := json.Marshal(sendMsg)
-	err := sender.Send(byteArr)
-	if err !=nil {
-		fmt.Println(err)
-	}
-
-	fmt.Println("SendRequest")
-	return ""
-}
\ No newline at end of file
+//var ReqRep_URL = "tcp://192.168.1.11:8002"
+//
+////鍒濆鍖杛ply鐨勫湴鍧�
+//func InitRplyUrl(url string) {
+//	ReqRep_URL = url
+//}
+//
+//func (api ReqRepClient) DoGetRequest(url string, params map[string]string, headers map[string]string) ([]byte, error) {
+//	var reqBody RplyParamBody
+//	reqBody.Action = url
+//	var destMap map[string]interface{}
+//	for idx,val := range params {
+//		destMap[idx] = interface{}(val)
+//	}
+//	reqBody.Params = destMap
+//	return doRply(reqBody)
+//}
+//
+//func (api ReqRepClient) DoPostRequest(url string, contentType string, body map[string]interface{}, params map[string]string, headers map[string]string) ([]byte, error) {
+//	var reqBody RplyParamBody
+//	reqBody.Action = url
+//	reqBody.Params = body
+//	return doRply(reqBody)
+//}
+//
+//func (api ReqRepClient) DoPutRequest(url string, contentType string, body map[string]interface{}, headers map[string]string) ([]byte, error) {
+//	var reqBody RplyParamBody
+//	reqBody.Action = url
+//	reqBody.Params = body
+//	return doRply(reqBody)
+//}
+//
+//func (api ReqRepClient) DoDeleteRequest(url string, contentType string, body map[string]interface{}, headers map[string]string) ([]byte, error) {
+//	var reqBody RplyParamBody
+//	reqBody.Action = url
+//	reqBody.Params = body
+//	return doRply(reqBody)
+//}
+//
+//type RplyParamBody struct {
+//	Action string	`json:"action"`	//鏍规嵁action鍒ゆ柇鍋氫綍绉嶅搷搴�
+//	Params map[string]interface{}	`json:"params"`//鍙傛暟map
+//}
+//
+//func doRply(body RplyParamBody)([]byte,error){
+//	sender := deliver.NewClient(deliver.Mode(deliver.ReqRep), ReqRep_URL)
+//	bytes,err := json.Marshal(body)
+//	if err !=nil {
+//		return nil,err
+//	}
+//	err = sender.Send(bytes)
+//	if err !=nil {
+//		resMsg, _ := sender.Recv()
+//		if resMsg !=nil {
+//			return resMsg,nil
+//		}
+//	}
+//	return nil,errors.New("nng no resp")
+//}
\ No newline at end of file

--
Gitblit v1.8.0