Exemple #1
0
 public static function GetRequestedPlugin()
 {
     if (self::PLUGIN_MODULE_NAME == strtolower(Yii::$app->controller->module->id)) {
         //读取插件信息
         self::$requestedPlugin = Mplugin::GetPluginConfig(strtolower(Yii::$app->controller->id), false, null, false);
     }
 }
 public function actionGetPlugin()
 {
     SystemEvent::GetAdminMenu();
     //下载状态   1 已下载已安装  2 更新  3 未下载
     $url = Yii::app()->params['boss'] . '/admin/plugin/GetPlugin/token/' . Yii::app()->params['token'];
     $content = Curl::curlRequest($url, '');
     $plugins = json_decode($content, TRUE);
     $locals = Mplugin::GetPlugins('all', 1, 1000000);
     $localPluginId = is_array($locals['data']) ? array_keys($locals['data']) : array();
     if (is_array($plugins)) {
         foreach ($plugins as $key => $item) {
             if (in_array($item['en_code'], $localPluginId)) {
                 if ($item['version'] != $locals['data'][$item['en_code']]['config']['version']) {
                     $plugins[$key]['downloadStatus'] = 2;
                 } else {
                     $plugins[$key]['downloadStatus'] = 1;
                 }
             } else {
                 $plugins[$key]['downloadStatus'] = 3;
             }
         }
     }
     echo json_encode($plugins);
     die;
 }