Skip to content

Commit

Permalink
update sync function
Browse files Browse the repository at this point in the history
  • Loading branch information
xLogic committed Aug 8, 2018
1 parent 65decb5 commit b465aff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ $DESMerchantClient->createDataExchangeRequest($testCase, 2, function ($res) use
});

// Sync
$results = $DESMerchantClient->createDataExchangeRequestSync($testCase, 2);
$res = $DESMerchantClient->createDataExchangeRequestSync($testCase, 2);
$results = $DESMerchantClient->getResultSync($res->request_id);
echo json_encode($results);
```
Expand Down
3 changes: 2 additions & 1 deletion examples/DESMerchantClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
});

// 同步调用
$results = $DESMerchantClient->createDataExchangeRequestSync($testCase, 2);
$res = $DESMerchantClient->createDataExchangeRequestSync($testCase, 2);
$results = $DESMerchantClient->getResultSync($res->request_id);
echo json_encode($results);
2 changes: 1 addition & 1 deletion src/GXChain/Client/DESMerchantClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function createDataExchangeRequestSync($params, $productId) {
$request->send_request();
$res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
$output = json_decode($res->body);
return $this->getResultSync($output->request_id);
return $output;
}

public function getResultSync($requestId, $timeout = 8000) {
Expand Down

0 comments on commit b465aff

Please sign in to comment.