]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
menu loading without api2
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 21 Feb 2024 11:11:59 +0000 (14:11 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 21 Feb 2024 11:11:59 +0000 (14:11 +0300)
erp24/controllers/SiteController.php

index 490b67a19025776969f49da257accd57137acb3a..ad1c3a98e2279dd08f77a38ca01cb8a257a20b69 100644 (file)
@@ -9,6 +9,7 @@ use yii\web\Response;
 use yii\filters\VerbFilter;
 use app\models\LoginForm;
 use app\models\ContactForm;
+use yii_app\records\CrmMenu;
 
 class SiteController extends Controller
 {
@@ -122,8 +123,9 @@ class SiteController extends Controller
     }
 
     public function actionMenuTree() {
-        $client = new Client(['base_uri' => Yii::$app->params['API2_URL']]);
-        $response = $client->request('GET', '/site/menu-tree?user_id=' . Yii::$app->user->id . '&key=' . Yii::$app->params['API2_TOKEN']);
-        return $this->asJson(json_decode($response->getBody(), true));
+//        $client = new Client(['base_uri' => Yii::$app->params['API2_URL']]);
+//        $response = $client->request('GET', '/site/menu-tree?user_id=' . Yii::$app->user->id . '&key=' . Yii::$app->params['API2_TOKEN']);
+//        return $this->asJson(json_decode($response->getBody(), true));
+        return $this->asJson(CrmMenu::getTreeByUserId(Yii::$app->user->id));
     }
 }