fix bug, cant save config

pull/397/merge
qkqpttgf 2021-08-19 01:27:03 +00:00 committed by GitHub
parent 3d67d57ded
commit dc58b15913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -314,8 +314,8 @@ function setVercelConfig($envs, $appId, $token)
foreach ($result["envs"] as $key => $value) { foreach ($result["envs"] as $key => $value) {
$existEnvs[$value["key"]] = $value["id"]; $existEnvs[$value["key"]] = $value["id"];
} }
$response = null;
foreach ($envs as $key => $value) { foreach ($envs as $key => $value) {
$response = null;
$tmp = null; $tmp = null;
$tmp["type"] = "encrypted"; $tmp["type"] = "encrypted";
$tmp["key"] = $key; $tmp["key"] = $key;
@ -327,8 +327,8 @@ function setVercelConfig($envs, $appId, $token)
} else { } else {
if ($value) $response = curl("POST", $url, json_encode($tmp), $header); if ($value) $response = curl("POST", $url, json_encode($tmp), $header);
} }
//echo $key . " = " . $value . ", <br>" . json_encode($response, JSON_PRETTY_PRINT) . "<br>"; //echo $key . " = " . $value . ", <br>" . $response . json_encode($response, JSON_PRETTY_PRINT) . "<br>";
if ($response['stat']!=200) return $response['body']; if (!!$response && $response['stat']!=200) return $response['body'];
} }
return VercelUpdate($appId, $token); return VercelUpdate($appId, $token);
} }
@ -351,6 +351,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
//echo json_encode($data, JSON_PRETTY_PRINT) . " ,data<br>"; //echo json_encode($data, JSON_PRETTY_PRINT) . " ,data<br>";
$response = curl("POST", $url, json_encode($data), $header); $response = curl("POST", $url, json_encode($data), $header);
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true); $result = json_decode($response["body"], true);
$result['status'] = $result['id']; $result['status'] = $result['id'];
return json_encode($result); return json_encode($result);