diff --git a/platformapi/fnpsapi/fn_test.go b/platformapi/fnpsapi/fn_test.go index 9ca0689b..ef58a6a7 100644 --- a/platformapi/fnpsapi/fn_test.go +++ b/platformapi/fnpsapi/fn_test.go @@ -4,6 +4,7 @@ import ( "fmt" "git.rosy.net.cn/baseapi" "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/globals" "go.uber.org/zap" "testing" @@ -28,12 +29,16 @@ func init() { func TestQueryOneStore(t *testing.T) { api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "51658", "") //token, err := api.GetAccessToken() - api.accessToken = "45c49b75-d47e-4145-b38d-fda8b5ebf3a9" - data, err := api.GetStore("668668") + api.accessToken = "8cffab79-4dab-4a9a-a609-c1ff6b14109b" + data, err := api.GetStore("20002") fmt.Println(data) fmt.Println(err) } +func TestHttpToGuoYuanFN(t *testing.T) { + HttpToGuoYuanFN(map[string]interface{}{"token": "c21e7a3b-e51e-4fe6-a02a-a751a011f5ee_1111", "refresh_token": "72227d0d-42eb-452e-abc6-80a30ac6f410"}, "token", model.ServerTypeFruits) +} + // 正式下单 func TestCreateOrder(t *testing.T) { api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "") diff --git a/platformapi/fnpsapi/store.go b/platformapi/fnpsapi/store.go index 10a016ee..546fc453 100644 --- a/platformapi/fnpsapi/store.go +++ b/platformapi/fnpsapi/store.go @@ -141,13 +141,8 @@ const ( // HttpToGuoYuanFN 订单消息推送果园 func HttpToGuoYuanFN(param map[string]interface{}, requestType string, serverType string) (*http.Response, error) { - //var paramData []byte - //var err error - //paramData, err = json.Marshal(param) - //if err != nil { - // return nil, err - //} - //body := strings.NewReader(string(paramData)) + //cl := http.Client{} + url := "" if serverType == "prod" { switch requestType { @@ -175,15 +170,18 @@ func HttpToGuoYuanFN(param map[string]interface{}, requestType string, serverTyp return nil, nil } - httpReq, err := http.NewRequest(http.MethodPost, url, strings.NewReader(utils.Map2URLValues(param).Encode())) + byteParam, _ := json.Marshal(param) + httpReq, err := http.NewRequest(http.MethodPost, url, strings.NewReader(string(byteParam))) if err != nil { return nil, err } - - httpReq.Header.Set("Content-Type", "application/json") - httpReq.Header.Set("accept", "application/json, text/plain, */*") + httpReq.Header.Add("content-type", "application/json") httpRes, err := http.DefaultClient.Do(httpReq) + defer httpRes.Body.Close() + if err != nil { + return nil, err + } return httpRes, err } diff --git a/platformapi/jdapi/store_sku_test.go b/platformapi/jdapi/store_sku_test.go index b1752b4b..40eb6af9 100644 --- a/platformapi/jdapi/store_sku_test.go +++ b/platformapi/jdapi/store_sku_test.go @@ -34,16 +34,6 @@ func TestDelVipPrice(t *testing.T) { //t.Log(utils.Format4Output(result, false)) } -func TestName1(t *testing.T) { - aa := (32 & 16) != 0 - fmt.Println(aa) - //for i := 0; i < 100; i++ { - // if (i & 16) != 0 { - // fmt.Println(i) - // } - //} -} - //func TestQueryOpenUseable(t *testing.T) { // result, err := api.QueryOpenUseable([]*BaseStockCenterRequest{ // &BaseStockCenterRequest{