public final function onHttpFinished($serv, $task_id, $data, $response)
{
$fd = $data["fd"];
$guid = $data["guid"];
//if the guid not exists .it's mean the api no need return result
if (!isset($this->taskInfo[$fd][$guid])) {
return true;
}
//get the api key
$key = $this->taskInfo[$fd][$guid]["taskkey"][$task_id];
//save the result
$this->taskInfo[$fd][$guid]["result"][$key] = $data["result"];
//remove the used taskid
unset($this->taskInfo[$fd][$guid]["taskkey"][$task_id]);
switch ($data["type"]) {
case DoraConst::SW_MODE_WAITRESULT_MULTI:
//all task finished
if (count($this->taskInfo[$fd][$guid]["taskkey"]) == 0) {
$packet = Packet::packFormat("OK", 0, $this->taskInfo[$fd][$guid]["result"]);
$packet["guid"] = $guid;
$packet = Packet::packEncode($packet, $data["protocol"]);
unset($this->taskInfo[$fd][$guid]);
$response->end($packet);
return true;
} else {
//multi call task
//not finished
//waiting other result
return true;
}
break;
default:
return true;
break;
}
}