Bug: catch excrption request to engine fail
CR: sonhh (fake)
This commit is contained in:
@@ -172,22 +172,25 @@ class common extends \yii\db\ActiveRecord {
|
||||
}
|
||||
|
||||
public static function requestToEngine($path, $data) {
|
||||
return file_get_contents("http://localhost:2305" . $path, false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($data)
|
||||
]
|
||||
$content = @file_get_contents("http://localhost:2305" . $path, false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($data)
|
||||
]
|
||||
]));
|
||||
if ($content == false)
|
||||
return ["status" => false];
|
||||
return ["status" => true, "data" => $content];
|
||||
}
|
||||
|
||||
public static function updateFeature($datas) {
|
||||
return file_get_contents("http://localhost:2305/update-person", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($datas)
|
||||
]
|
||||
return @file_get_contents("http://localhost:2305/update-person", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($datas)
|
||||
]
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user