mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
try plugin listAllFromRemote error
This commit is contained in:
+16
-11
@@ -104,20 +104,25 @@ class PluginStore extends Model
|
|||||||
|
|
||||||
private static function listAllFromRemote()
|
private static function listAllFromRemote()
|
||||||
{
|
{
|
||||||
$response = Http::get(self::PLUGIN_LIST_API);
|
try {
|
||||||
if ($response->getStatusCode() != 200) {
|
$response = Http::get(self::PLUGIN_LIST_API);
|
||||||
do_log(sprintf("status code: %d, body: %s", $response->getStatusCode(), $response->getBody()), 'error');
|
if ($response->getStatusCode() != 200) {
|
||||||
return [];
|
do_log(sprintf("status code: %d, body: %s", $response->getStatusCode(), $response->getBody()), 'error');
|
||||||
}
|
return [];
|
||||||
$list = $response->json();
|
}
|
||||||
foreach ($list as &$row) {
|
$list = $response->json();
|
||||||
foreach ($row as $key => $value) {
|
foreach ($list as &$row) {
|
||||||
if (is_array($value)) {
|
foreach ($row as $key => $value) {
|
||||||
$row[$key] = json_encode($value);
|
if (is_array($value)) {
|
||||||
|
$row[$key] = json_encode($value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $list;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
do_log(sprintf("listAllFromRemote from: %s error: %s", self::PLUGIN_LIST_API, $e->getMessage()), 'error');
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
return $list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHasNewVersionCount(): int
|
public static function getHasNewVersionCount(): int
|
||||||
|
|||||||
Reference in New Issue
Block a user