Пример #1
0
 /**
  * @param BaseRequest $request
  * @return array
  * @throws \cdcchen\wechat\base\RequestException
  * @throws \cdcchen\wechat\base\ResponseException
  */
 private static function fetch(BaseRequest $request)
 {
     $client = new DefaultClient();
     return $client->sendRequest($request, function (HttpResponse $response) {
         return $response->getData();
     });
 }
Пример #2
0
 /**
  * @param $ticket
  * @return array
  * @throws \cdcchen\wechat\base\RequestException
  * @throws \cdcchen\wechat\base\ResponseException
  */
 public function getInfo($ticket)
 {
     $client = new DefaultClient();
     $request = (new ShakeInfoRequest())->setTicket($ticket);
     return $client->sendRequest($request, function (HttpResponse $response) {
         $data = $response->getData();
         return $data['data'];
     });
 }