} else {
$fl = time();
}
-// InfoLogService::setInfoLog(__FILE__, __LINE__, 'upload_' . $fl . '.json' , 'info_id_25_1');
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . "requestId: " . $requestId, FILE_APPEND);
+ //InfoLogService::setInfoLog(__FILE__, __LINE__, 'upload_' . $fl . '.json' , 'info_id_25_1');
file_put_contents(self::OUT_DIR . '/upload_' . $fl . '.json', PHP_EOL . $request);
$mess["result"] = true;
$checks_dell = "";
$request_id = time();
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . "request_id: " . $request_id, FILE_APPEND);
if (array_key_exists("request_id", $result) && !empty($result["request_id"])) {
$request_id = $result["request_id"];
}
$type_price = "Розничная цена";
-
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . "request_id 2: " . $request_id, FILE_APPEND);
if (!empty($request_id)) {
$apiCron = ApiCron::find()->select(['json_post'])->where(['request_id' => $request_id])->one();
if ($apiCron) {
$end_time = $jsn["checks"]["end_time"] ?? date('Y-m-d 00:00:00', time());
$checks_dell = $jsn["checks_dell"] ?? "";
$type_price = $jsn["prices"]["type_price"] ?? "Розничная цена";
-
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . "start_time: " . $start_time, FILE_APPEND);
ApiCron::updateAll(['status' => 1, 'date_up' => date('Y-m-d H:i:s')],
['and', ['status' => 0], ['request_id' => $request_id]]);
}
}
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . $update , FILE_APPEND);
+
if (!empty($result['write_offs'])) {
if (!empty($start_time) and !empty($end_time)) {
if ($update) {
if (!empty($result['checks'])) {
$matrixProductsIds = SalaryHelper::getMatrixProductsIds();
}
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . count($result['checks']) , FILE_APPEND);
+ if (!empty($result['checks']) && count($result['checks']) < 200) {
- if (!empty($result['checks']) && count($result['checks']) < 1000) {
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . "if" , FILE_APPEND);
foreach ($result["checks"] as $arr) {
$check_id = $arr["id"];
}
}
} elseif (!empty($result['checks'])) {
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . "elseif" , FILE_APPEND);
$dataArrayValues = $this->getSalesDate($result["checks"], $update);
foreach ($dataArrayValues as $keyMethodName => $rowValue) {
-
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . $keyMethodName , FILE_APPEND);
try {
$this->$keyMethodName($rowValue, $update);
} catch (Exception $e) {
'guid' => $arr2["id"],
'date_up' => date('Y-m-d H:i:s'),
'name' => $arr2["name"],
- 'held' => isset($arr2["held"]) ? (bool)$arr2["held"] : false
+ 'held' => isset($arr2["held"]) ? $arr2["held"] : 0
], ['check_id' => $arr2["id"]]);
// $createChecks3 = CreateChecks::find()->where(['check_id' => $arr2["id"]])->orderBy(['id' => SORT_DESC])->one();
// if ($createChecks3) {
'terminal_id' => $arr["terminal_id"] ?? '', // terminal_id,
'skidka' => $arr["discount"] ?? 0, // skidka
'date_up' => $date_up, // date_up
- 'held' => false,
+ 'held' => 0,
];
}
foreach ($chunkValues as $key => $rows) {
// Преобразование значений в $rows перед вставкой
- foreach ($rows as &$row) {
- if (isset($row['held'])) {
+ // foreach ($rows as &$row) {
+ // if (isset($row['held'])) {
// Приведение значений к булевому типу
- $row['held'] = (bool)$row['held'];
- }
- }
+ // $row['held'] = (bool)$row['held'];
+ // }
+ // }
try {
$transaction = \Yii::$app->db->beginTransaction();
Yii::$app->db->createCommand()->batchInsert($tableName, $columns, $rows)->execute();
$transaction->commit();
} catch (Exception $e) {
- $transaction->rollBack();
$errorString = substr($e->getMessage(), 0, 2000);
+ file_put_contents(self::OUT_DIR . '/error_upload.txt',
+ PHP_EOL . $errorString, FILE_APPEND);
+ $transaction->rollBack();
InfoLogService::setInfoLog(__FILE__, __LINE__, $tableName , 'error_id_25');
InfoLogService::setInfoLog(__FILE__, __LINE__, $errorString , 'error_id_25_22');
LogService::apiErrorLog(json_encode(["error_id" => 25, "error" => $errorString], JSON_UNESCAPED_UNICODE));