get_tick($requestParam); $client = HttpClient::NewRequest(); return $client->get($this->temporary_url, ['ticket' => $tick]); } /** * @param $scene_id * @return array|mixed|\common\Result * @throws \Exception */ public function permanent_qr_code($scene_id) { $requestParam['action_name'] = 'QR_LIMIT_SCENE'; $requestParam['action_info[scene][scene_id]'] = $scene_id; $tick = $this->get_tick($requestParam); $client = HttpClient::NewRequest(); return $client->get($this->permanent_qr_code_url, ['ticket' => $tick]); } /** * @param $requestParam * @return mixed * @throws \Exception * tick */ private function get_tick($requestParam) { $request = HttpClient::NewRequest(); $request->setCallback(function ($body) { if (is_array($body)) { $param = ['code' => $body['errcode'], 'message' => $body['errmsg'], 'data' => $body]; } else { $param = ['code' => 0, 'data' => json_decode($body, true)]; } return new Result($param); }); $data = $request->post($this->tick_url . $this->config->getAccessToken(), json_encode($requestParam)); if (!$data->isResultsOK()) { throw new \Exception($data->getMessage()); } return $data->getData('ticket'); } }