]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-327] api return count of new orders
authorAlexander Smirnov <fredeom@mail.ru>
Tue, 11 Mar 2025 07:58:12 +0000 (10:58 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Tue, 11 Mar 2025 07:58:12 +0000 (10:58 +0300)
erp24/api2/controllers/MarketplaceController.php

index 11773d84f71fd3b514f0680be1ad3531a2e46dd2..f65bb1fde65a6d1e3299570a8f9052a09da875d7 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace app\controllers;
 
+use yii_app\records\MarketplaceOrders;
 use yii_app\records\MarketplaceStatus;
 
 class MarketplaceController extends BaseController
@@ -10,4 +11,19 @@ class MarketplaceController extends BaseController
         $this->response->format = \yii\web\Response::FORMAT_JSON;
         return ['response' => MarketplaceStatus::find()->asArray()->all()];
     }
+
+    public function actionGetNewOrderCount() {
+        return ['response' => MarketplaceOrders::find()
+            ->where([
+                'status_1c' => 1,
+                'status_id' => 1,
+            ])->andWhere([
+                'between',
+                'creation_date',
+                date('Y-m-d 00:00:00', strtotime('-3 days', time())),
+                date('Y-m-d 23:59:59', time())
+            ])
+            ->count()
+        ];
+    }
 }
\ No newline at end of file