fix error in wait function

This commit is contained in:
root
2021-08-26 10:09:57 +00:00
parent b6860e373a
commit bdfee2c81b
6 changed files with 30 additions and 20 deletions
+3 -2
View File
@@ -315,7 +315,7 @@ function updateHerokuapp($HerokuappId, $apikey, $source)
$data = json_encode($tmp);
$response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
$result = json_decode( $response['body'], true );
$result['status'] = $result['id'];
$result['DplStatus'] = $result['id'];
$response['body'] = json_encode($result);
return $response;
}
@@ -345,8 +345,9 @@ function setConfigResponse($response)
return json_decode( $response['body'], true );
}
function WaitFunction($buildId) {
function WaitFunction($buildId = '') {
// GET /apps/{app_id_or_name}/builds/{build_id}
if ($buildId=='1') return true;
$response = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('HerokuappId') . '/builds/' . $buildId, '', getConfig('APIKey'));
if ($response['stat']==200) {
$result = json_decode($response['body'], true);
+9 -4
View File
@@ -187,14 +187,14 @@ function install()
return message($html, $title, 400);
} else {
/*$html = '<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var expd = new Date();
expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>';
return message($html, $title, 201, 1);*/
$data["dplId"] = $response['status'];
$data["dplId"] = $response['DplStatus'];
return output(json_encode($data), 201);
}
}
@@ -362,7 +362,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
$response = curl("POST", $url, json_encode($data), $header);
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true);
$result['status'] = $result['id'];
$result['DplStatus'] = $result['id'];
return json_encode($result);
}
@@ -444,7 +444,12 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
}
function WaitFunction($deployid) {
function WaitFunction($deployid = '') {
if ($buildId=='1') {
$tmp['stat'] = 400;
$tmp['body'] = 'id must provided.';
return $tmp;
}
$header["Authorization"] = "Bearer " . getConfig('APIKey');
$header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
+8 -3
View File
@@ -185,14 +185,14 @@ function install()
return message($html, $title, 400);
} else {
/*$html = '<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var expd = new Date();
expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>';
return message($html, $title, 201, 1);*/
$data["dplId"] = $response['status'];
$data["dplId"] = $response['DplStatus'];
return output(json_encode($data), 201);
}
}
@@ -353,7 +353,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
$response = curl("POST", $url, json_encode($data), $header);
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true);
$result['status'] = $result['id'];
$result['DplStatus'] = $result['id'];
return json_encode($result);
}
@@ -431,6 +431,11 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
}
function WaitFunction($deployid) {
if ($buildId=='1') {
$tmp['stat'] = 400;
$tmp['body'] = 'id must provided.';
return $tmp;
}
$header["Authorization"] = "Bearer " . getConfig('APIKey');
$header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;