]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Merge branch 'refs/heads/develop' into feature_fomichev_erp-443_add_canceled_orders_t...
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 25 Aug 2025 08:37:04 +0000 (11:37 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 25 Aug 2025 08:37:04 +0000 (11:37 +0300)
# Conflicts:
# erp24/api2/controllers/DataController.php
# erp24/services/MarketplaceService.php

1  2 
erp24/api2/controllers/DataController.php
erp24/api2/controllers/OrdersController.php
erp24/records/MarketplaceOrders.php
erp24/services/MarketplaceService.php

index 800ec6d4d28eba3c034c11c4bac426daf2a7994b,94eae6f6667c2a17880122df24fed2ee7b821e86..5ae91dda8ae621132e6d1f1a5fc1113e45d31302
@@@ -2482,76 -2554,15 +2556,83 @@@ class DataController extends BaseContro
                  }
  
              }
-                                    
 +            if (!empty($result['cancelled_orders'])) {
 +                foreach ($result['cancelled_orders'] as $arr) {
 +                    $marketplaceOrders = null;
 +                    $marketplaceOrdersGuidArr = [];
 +
 +                    $marketplaceOrders = MarketplaceOrders::find()->where(['guid' => $arr])->one();
 +                    $marketplaceOrdersGuidArr[] = $marketplaceOrders->guid;
 +
 +                    if (!empty($marketplaceOrders)) {
 +                        /** @var MarketplaceOrders $marketplaceOrders */
 +
 +                        if (!empty($arr["errors"]) || !empty($arr["error"]) || !empty($arr["errors_items"])) {
 +                            $errorText = '';
 +                            if (!empty($arr["errors"])) {
-                                     }                                   
++
 +
 +                                foreach ($arr["errors"] as $errorRow) {
 +                                    if (!empty($errorRow['error'])) {
 +                                        $errorText .= $errorRow['error'];
 +
 +                                        $errorText .= ' ,' . $errorRow['error_description'];
 +                                        if (!empty($errorRow['error_json'])) {
 +                                            foreach ($errorRow['error_json'] as $errorJsonRow) {
 +                                                $errorText .= ' , поле: ' . $errorJsonRow['field'];
 +                                                $errorText .= ' , ошибка: ' . $errorJsonRow['error'];
 +                                            }
 +                                        }
-                 
++                                    }
 +                                }
 +                            }
 +
 +                            if (!empty($arr["error"])) {
 +                                //"error": "Ошибка преобразования ИД документа",
 +                                //"error_description": "ИД документа 01202307-2705-1039-09bc-100015809667 уже записан в системе",
 +                                $errorText .= $arr["error"];
 +                                $errorText .= ' ,' . $arr['error_description'];
 +                            }
 +
 +                            $marketplaceOrders->status_1c = MarketplaceOrders::STATUSES_1C_ERROR_1C;
 +                            $marketplaceOrders->error_text = $errorText;
 +                            $marketplaceOrders->save();
 +                            if ($marketplaceOrders->getErrors()) {
 +                                LogService::apiErrorLog(
 +                                    json_encode(
 +                                        ["error_id" => 41, "error" => $marketplaceOrders->getErrors()],
 +                                        JSON_UNESCAPED_UNICODE
 +                                    )
 +                                );
 +                            }
 +                        } else {
 +                           $marketplaceOrder->cancelled_order_sent = MarketplaceOrders::STATUSES_1C_CANCELLED_ORDER_SENT_IN_1C;
 +                            $marketplaceOrders->save();
 +                            if ($marketplaceOrders->getErrors()) {
 +                                LogService::apiErrorLog(
 +                                    json_encode(
 +                                        ["error_id" => 41, "error" => $marketplaceOrders->getErrors()],
 +                                        JSON_UNESCAPED_UNICODE
 +                                    )
 +                                );
 +                            }
 +                        }
 +                    }
 +                }
 +
++
 +
 +            }
 +
+             $mess['line'][] = __LINE__;
          } catch (Exception $e) {
+             LogService::apiDataLogs(1, json_encode($mess, JSON_UNESCAPED_UNICODE), $requestIdText);
              file_put_contents(self::OUT_DIR . '/log_error.txt', PHP_EOL . date("d.m.Y H:i:s", time()) . $e->getMessage() . " " . $e->getLine(), FILE_APPEND);
+             Yii::error('Ошибка upload - блок catch '. json_encode($e->getMessage() . " " . $e->getLine(), JSON_UNESCAPED_UNICODE));
+             LogService::apiErrorLog(json_encode([
+                 "error_id" => 44,
+                 "error" => "Ошибка загрузки " . $e->getMessage() . " " . $e->getLine(),
+             ], JSON_UNESCAPED_UNICODE));
          } finally {
              LogService::apiDataLogs(1, json_encode($mess, JSON_UNESCAPED_UNICODE), $requestIdText);
          }
              /** @var $status MarketplaceOrderStatusTypes */
              /** @var $substatus MarketplaceOrderStatusTypes */
              $status = $statusId1C->orderStatus;
-             $substatus = $statusId1C->orderStatus;
+             $substatus = $statusId1C->orderSubstatus;
  
              if (
 -                in_array($statusId1C->status_id, ['1013', '1010']) &&
 +                in_array($statusId1C->status_id, $statuses1cToChangeYandexMarketFakeOrderId) &&
                  $marketplaceOrder->marketplace_id == 2
              ) {
                  if (!$debug) {
index 8a23af07b889e4584721f7d2e350cc08c57c7de3,20976f09b5d44c820a8169b34087ee11cf34af12..026e1a2962f1e7927f83ec09676fd8f42534372a
@@@ -134,10 -118,10 +134,10 @@@ class OrdersController extends BaseCont
              /** @var $status MarketplaceOrderStatusTypes */
              /** @var $substatus MarketplaceOrderStatusTypes */
              $status = $statusId1C->orderStatus;
-             $substatus = $statusId1C->orderStatus;
+             $substatus = $statusId1C->orderSubstatus;
  
              if (
 -                in_array($statusId1C->status_id, ['1013', '1010']) &&
 +                in_array($statusId1C->status_id, $statuses1cToChangeYandexMarketFakeOrderId) &&
                  $order->marketplace_id == 2
              ) {
                  if (!$debug) {
Simple merge
Simple merge