]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-356] debug
authorAlexander Smirnov <fredeom@mail.ru>
Fri, 7 Mar 2025 14:00:26 +0000 (17:00 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Fri, 7 Mar 2025 14:00:26 +0000 (17:00 +0300)
erp24/api2/controllers/BonusController.php
erp24/jobs/SendBonusInfoToSiteJob.php
erp24/services/SiteService.php

index b9d5f8fa66d5900f2f6cd5f0a38d5c4fbf65aa69..8a4dcef0fe2f991c7a49703d2e69826380c3e9ad 100644 (file)
@@ -964,8 +964,9 @@ class BonusController extends BaseController
             } else {
                 Yii::$app->queue->push(new SendBonusInfoToSiteJob([
                     'phone' => $phone,
-                    'bonus' => $back,
-                    'bonus_created_at' => date("Y-m-d H:i:s"),
+                    'bonusCount' => $back,
+                    'purchaseDate' => date("Y-m-d H:i:s"),
+                    'orderId' => $check_id,
                 ]));
             }
 
@@ -1021,9 +1022,10 @@ class BonusController extends BaseController
                 } else {
                     Yii::$app->queue->push(new SendBonusInfoToSiteJob([
                         'phone' => $phone,
-                        'bonus' => $back,
-                        'bonus_created_at' => date("Y-m-d H:i:s"),
-                    ]));
+                        'bonusCount' => $back,
+                        'purchaseDate' => date("Y-m-d H:i:s"),
+                        'orderId' => $check_id,
+                   ]));
                 }
                 if ($userFound->telegram_created_at == null) {
                     $userFound->telegram_created_at = date("Y-m-d H:i:s");
index 628b1c4b4922eeca2b5253f71d3e360aa0970b82..21d73ae047d1a6eb1f98f9247b6a7cb769f7b4b2 100644 (file)
@@ -10,16 +10,18 @@ use yii_app\services\SiteService;
 class SendBonusInfoToSiteJob extends \yii\base\BaseObject implements JobInterface
 {
     public $phone;
-    public $bonus;
-    public $bonus_created_at;
+    public $bonusCount;
+    public $purchaseDate;
+    public $orderId;
 
     public function execute($queue) {
         $phone = $this->phone;
-        $bonus = $this->bonus;
-        $bonus_created_at = $this->bonus_created_at;
+        $bonusCount = $this->bonusCount;
+        $purchaseDate = $this->purchaseDate;
+        $orderId = $this->orderId;
 
         try {
-            $result = SiteService::notifySiteAboutBonuses($phone, $bonus, $bonus_created_at);
+            $result = SiteService::notifySiteAboutBonuses($phone, $bonusCount, $purchaseDate, $orderId);
             if ($result == "OK") {
                 Yii::warning("Сообщение успешно отправлено на сайт", 'site');
             } else {
index 1bd5783d0657452b3f94f8ca4e8c32e1362e0d75..b1e297bff12d79feed7166d0c379203b99816dc3 100644 (file)
@@ -5,14 +5,15 @@ namespace yii_app\services;
 use GuzzleHttp\Client;
 
 class SiteService {
-    public static function notifySiteAboutBonuses($phone, $bonus, $bonus_created_at) {
+    public static function notifySiteAboutBonuses($phone, $bonusCount, $purchaseDate, $orderId) {
         $client = new Client();
         $result = null;
         try {
             $result = $client->post('http://test.api.bazacvetov24.ru/v1/order-logs', [
                 'phone' => $phone,
-                'bonus' => $bonus,
-                'created_at' => $bonus_created_at,
+                'bonusCount' => $bonusCount,
+                'purchaseDate' => $purchaseDate,
+                'orderId' => $orderId,
             ]);
             $result = $result->getBody()->getContents();
         } catch (\Exception $e) {