"/var/www/erp24/api2/json_buh";
// "/var/www/www-root/data/www/api.bazacvetov24.ru/data/json";
- public function actionRequest() {
+ public function actionRequest()
+ {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
\Yii::$app->response->headers->set('firm', 'IP_Belov');
}
- public function actionUpload() {
+ public function actionUpload()
+ {
set_time_limit(600);
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
} catch (Exception $ex) {
return $this->asJson(['error' => ['code' => 400, 'message' => 'Json body invalid']]);
}
-// if (empty($result)) {
-// file_put_contents(self::OUT_DIR . '/error_buh_upload.txt',
-// PHP_EOL . 'result empty', FILE_APPEND);
-// return $this->asJson(['error' => ['code' => 400, 'message' => 'result empty']]);
-// }
$requestId = '';
if (!empty($result["request_id"])) {
} else {
$fl = time();
}
-// InfoLogService::setInfoLog(__FILE__, __LINE__, 'upload_' . $fl . '.json' , 'info_id_25_1');
-//
-// file_put_contents(self::OUT_DIR . '/upload_' . $fl . '.json', PHP_EOL . $request);
try {
$apiCronTest->date_up = date("Y-m-d H:i:s");
$apiCronTest->status = 2;
$apiCronTest->json_post = $request;
- $apiCronTest->request_id = $requestId;
- $validate = $apiCronTest->validate();
- if ($validate) {
- $apiCronTest->save();
- }
+ $apiCronTest->request_id = strval($requestId);
+ $apiCronTest->save();
} catch (Exception $e) {
file_put_contents(self::OUT_DIR . '/error_buh_upload.txt', PHP_EOL . 'result empty', FILE_APPEND);