]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Merge branch 'develop' into feature_smirnov_erp-372_mp_instruction_dictionary
authorAlexander Smirnov <fredeom@mail.ru>
Tue, 25 Mar 2025 06:34:42 +0000 (09:34 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Tue, 25 Mar 2025 06:34:42 +0000 (09:34 +0300)
# Conflicts:
# erp24/api2/controllers/MarketplaceController.php

1  2 
erp24/api2/controllers/MarketplaceController.php

index f39e7f5457ca6e3f11ba50d7d1bcd01be4e9269d,82b7c9290328368ffe591e0295fda035ab28b3fb..3705d109d31a1b4c756a15252286014f67efc651
@@@ -3,8 -3,8 +3,9 @@@
  namespace app\controllers;
  
  use Yii;
 -use yii_app\records\ExportImportTable;
 +use yii_app\records\MarketplaceOrder1cStatuses;
  use yii_app\records\MarketplaceOrders;
++use yii_app\records\ExportImportTable;
  use yii_app\records\MarketplaceStatus;
  
  class MarketplaceController extends BaseController
          return ['response' => MarketplaceStatus::find()->asArray()->all()];
      }
  
 -}
+     public function actionGetNewOrderCount() {
+         $eit = ExportImportTable::find()->select(['entity_id'])->where(['entity' => 'city_store', 'export_id' => 1,
+             'export_val' => Yii::$app->request->post('store_guid')])->one();
+         if (!$eit) {
+             return ['error' => 'Не найден магазин по store_guid'];
+         }
+         $storeId = $eit->entity_id;
+         return ['response' => MarketplaceOrders::find()
+             ->where([
+                 'status_1c' => 1,
+                 'status_id' => 1,
+                 'store_id' => $storeId,
+             ])->andWhere([
+                 'between',
+                 'creation_date',
+                 date('Y-m-d 00:00:00', strtotime('-3 days', time())),
+                 date('Y-m-d 23:59:59', time())
+             ])
+             ->count()
+         ];
+     }
++
 +    public function actionInstructionDictionary() {
 +        $this->response->format = \yii\web\Response::FORMAT_JSON;
 +        $marketplaceGuid = Yii::$app->request->post('guid');
 +        $marketplaceOrder = MarketplaceOrders::find()->where(['guid' => $marketplaceGuid])->one();
 +        /** @var $marketplaceOrder MarketplaceOrders */
 +        $statuses = MarketplaceOrder1cStatuses::find()->where(['marketplace_id' => $marketplaceOrder->marketplace_id])->orderBy(['posit' => SORT_ASC])->all();
 +        $data = [];
 +        foreach ($statuses as $status) {
 +            /* @var $status MarketplaceOrder1cStatuses */
 +            $data []= [
 +                'marketplace' => [1 => "ФлауВау", 2 => "ЯндексМаркет"][$status->marketplace_id],
 +                'status' => $status->status,
 +                'status_instruction' => $status->status_instruction
 +            ];
 +        }
 +        return ['response' => $data];
 +    }
 +}