]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-325] api2 /marketplace/status
authorAlexander Smirnov <fredeom@mail.ru>
Fri, 21 Feb 2025 14:11:22 +0000 (17:11 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Fri, 21 Feb 2025 14:11:22 +0000 (17:11 +0300)
erp24/api2/controllers/MarketplaceController.php [new file with mode: 0644]
erp24/records/AmoStatus.php [new file with mode: 0644]

diff --git a/erp24/api2/controllers/MarketplaceController.php b/erp24/api2/controllers/MarketplaceController.php
new file mode 100644 (file)
index 0000000..3436c46
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace app\controllers;
+
+use yii_app\records\AmoStatus;
+
+class MarketplaceController extends BaseController
+{
+    public function actionStatuses() {
+        $this->response->format = \yii\web\Response::FORMAT_JSON;
+        return ['response' => AmoStatus::find()->asArray()->all()];
+    }
+}
\ No newline at end of file
diff --git a/erp24/records/AmoStatus.php b/erp24/records/AmoStatus.php
new file mode 100644 (file)
index 0000000..37219a7
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "amo_status".
+ *
+ * @property int $id
+ * @property string $alias alias статуса
+ * @property string $name наименование статуса на русском
+ */
+class AmoStatus extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'amo_status';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['alias', 'name'], 'required'],
+            [['alias', 'name'], 'string', 'max' => 100],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'alias' => 'Alias',
+            'name' => 'Name',
+        ];
+    }
+}