}
}
-
+ 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) {