$value) { $local_plugin[$key]['install'] = true; } return $local_plugin; } // 获取未安装插件 public static function getUninstall(array $app_plugin = [], array $local_plugin = []): array { $uninstall_plugin = []; $install = []; foreach ($local_plugin as $e_val) { $install[] = $e_val['platform']; } foreach ($app_plugin as $i_val) { if (in_array($i_val['platform'], $install)) { continue; } $val = $i_val; $val['install'] = false; $uninstall_plugin[] = $val; } return $uninstall_plugin; } // 获取平台所有支持插件 public static function getAllPlugin(): array { $app_plugin = cache('app_plugin'); if ($app_plugin) { return json_decode($app_plugin, true); } $app_plugin = self::getHttpResponse(self::$siteUrl . '/mpay/getplugins'); cache('app_plugin', $app_plugin, 36000); return json_decode($app_plugin, true); } // 获取通知消息 public static function getNotifyMessage(): array { $message = cache('message'); if ($message) { return json_decode($message, true); } $message = self::getHttpResponse(self::$siteUrl . '/mpay/message'); cache('message', $message, 36000); return json_decode($message, true); } // 请求外部资源 private static function getHttpResponse($url, $header = [], $post = null, $timeout = 10) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); if ($header) { curl_setopt($ch, CURLOPT_HTTPHEADER, $header); } else { $httpheader[] = "Accept: */*"; $httpheader[] = "Accept-Language: zh-CN,zh;q=0.9"; $httpheader[] = "Connection: close"; curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); } curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if ($post) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } $response = curl_exec($ch); curl_close($ch); return $response; } }