} 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,
]));
}
} 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");
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 {
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) {