]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавлена миграция и крон команда
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 19 Jun 2025 15:11:24 +0000 (18:11 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 19 Jun 2025 15:11:24 +0000 (18:11 +0300)
erp24/commands/CronController.php
erp24/migrations/m250619_150158_add_seller_id_and_number_columns_to_marketplace_orders_table.php [new file with mode: 0644]

index 1b09d23bb4f01ccb4b9104fde695c7fc942fc6ce..480b37897896d9d4dc7902fe3b4fa8cbb5f4220c 100644 (file)
@@ -176,6 +176,19 @@ class CronController extends Controller
         return 'ok';
     }
 
+    //cron/marketplace-orders-one-c-cron
+    public function actionMarketplaceOrdersOneCCron()
+    {
+        $req_id = time();
+
+        //заказы за 2 дня назад прогружаем
+        $json_post = '{"request_id": "' . $req_id . '", "marketplace_orders":{"start_time":"' . date("Y-m-d", time() - 86400 * 2) . ' 00:00:00","end_time":"' . date("Y-m-d", time()) . ' 23:59:59"}}';
+
+        $this->setApiCron($req_id, $json_post);
+
+        return 'ok';
+    }
+
     //cron/one-c-cron-self-cost-day
     public function actionOneCCronSelfCostDay()
     {
diff --git a/erp24/migrations/m250619_150158_add_seller_id_and_number_columns_to_marketplace_orders_table.php b/erp24/migrations/m250619_150158_add_seller_id_and_number_columns_to_marketplace_orders_table.php
new file mode 100644 (file)
index 0000000..c6137ad
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles adding columns to table `{{%marketplace_orders}}`.
+ */
+class m250619_150158_add_seller_id_and_number_columns_to_marketplace_orders_table extends Migration
+{
+    const TABLE_NAME = 'erp24.marketplace_orders';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
+        if ($table === null) {
+            return;
+        }
+
+        if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('seller_id')) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'seller_id',
+                $this->string()->null()->comment('ID продавца'),
+            );
+        }
+        if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('number_1c')) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'number_1c',
+                $this->string()->null()->comment('Номер заказа в 1С'),
+            );
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('seller_id')) {
+            $this->dropColumn(self::TABLE_NAME, 'seller_id');
+        }
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('number_1c')) {
+            $this->dropColumn(self::TABLE_NAME, 'number_1c');
+        }
+    }
+}