From 707b0aae6d1647a640374a3e4b0bdfaef378aa60 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 6 Aug 2024 12:21:15 +0300 Subject: [PATCH] =?utf8?q?ERP-85=20=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?utf8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BE=D0=B1=D0=BC=D0=B5=D0=BD?= =?utf8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=201=D0=A1=20?= =?utf8?q?=D0=91=D1=83=D1=85=D0=B3=D0=B0=D0=BB=D1=82=D0=B5=D1=80=D0=B8?= =?utf8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...taBuhTestController.php => DataBuhController.php} | 12 +++++------- ... => m240805_071431_create_api_cron_buh_table.php} | 6 +++--- erp24/records/{ApiCronBuhTest.php => ApiCronBuh.php} | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) rename erp24/api2/controllers/{DataBuhTestController.php => DataBuhController.php} (89%) rename erp24/migrations/{m240805_071431_create_api_cron_buh_test_table.php => m240805_071431_create_api_cron_buh_table.php} (79%) rename erp24/records/{ApiCronBuhTest.php => ApiCronBuh.php} (95%) diff --git a/erp24/api2/controllers/DataBuhTestController.php b/erp24/api2/controllers/DataBuhController.php similarity index 89% rename from erp24/api2/controllers/DataBuhTestController.php rename to erp24/api2/controllers/DataBuhController.php index d9a77299..b37dbd7e 100644 --- a/erp24/api2/controllers/DataBuhTestController.php +++ b/erp24/api2/controllers/DataBuhController.php @@ -2,13 +2,14 @@ namespace app\api2\controllers; + use app\controllers\BaseController; use Exception; use Yii; use yii\helpers\Json; -use yii_app\records\ApiCronBuhTest; +use yii_app\records\ApiCronBuh; -class DataBuhTestController extends BaseController +class DataBuhController extends BaseController { public function actionRequest() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; @@ -31,9 +32,8 @@ class DataBuhTestController extends BaseController $json = ''; try { - $apiCronTest = ApiCronBuhTest::find() + $apiCronTest = ApiCronBuh::find() ->where(['status' => 0]) - ->andWhere(['direct_id' => 1]) ->orderBy(['date' => SORT_ASC]) ->one(); if ($apiCronTest) { @@ -74,14 +74,12 @@ class DataBuhTestController extends BaseController try { - - $apiCronTest = new ApiCronBuhTest(); + $apiCronTest = new ApiCronBuh(); $apiCronTest->date = date("Y-m-d H:i:s"); $apiCronTest->date_up = date("Y-m-d H:i:s"); $apiCronTest->status = 2; $apiCronTest->json_post = $request; $apiCronTest->request_id = $requestId; - $apiCronTest->direct_id = 2; $validate = $apiCronTest->validate(); if ($validate) { $apiCronTest->save(); diff --git a/erp24/migrations/m240805_071431_create_api_cron_buh_test_table.php b/erp24/migrations/m240805_071431_create_api_cron_buh_table.php similarity index 79% rename from erp24/migrations/m240805_071431_create_api_cron_buh_test_table.php rename to erp24/migrations/m240805_071431_create_api_cron_buh_table.php index 6d56733d..d531b5d7 100644 --- a/erp24/migrations/m240805_071431_create_api_cron_buh_test_table.php +++ b/erp24/migrations/m240805_071431_create_api_cron_buh_table.php @@ -5,14 +5,14 @@ use yii\db\Migration; /** * Handles the creation of table `{{%api_cron_buh_test}}`. */ -class m240805_071431_create_api_cron_buh_test_table extends Migration +class m240805_071431_create_api_cron_buh_table extends Migration { /** * {@inheritdoc} */ public function safeUp() { - $this->createTable('{{%api_cron_buh_test}}', [ + $this->createTable('{{%erp24.api_cron_buh}}', [ 'id' => $this->primaryKey(), 'date' => $this->dateTime()->notNull(), 'date_up' => $this->dateTime()->notNull(), @@ -27,6 +27,6 @@ class m240805_071431_create_api_cron_buh_test_table extends Migration */ public function safeDown() { - $this->dropTable('{{%api_cron_buh_test}}'); + $this->dropTable('{{%erp24.api_cron_buh}}'); } } diff --git a/erp24/records/ApiCronBuhTest.php b/erp24/records/ApiCronBuh.php similarity index 95% rename from erp24/records/ApiCronBuhTest.php rename to erp24/records/ApiCronBuh.php index 48eb2504..cc77bec6 100644 --- a/erp24/records/ApiCronBuhTest.php +++ b/erp24/records/ApiCronBuh.php @@ -14,7 +14,7 @@ use Yii; * @property string|null $json_post Тело запроса * @property string $request_id id запроса */ -class ApiCronBuhTest extends \yii\db\ActiveRecord +class ApiCronBuh extends \yii\db\ActiveRecord { /** * {@inheritdoc} -- 2.39.5