Files
admin-php-module/commands/POSTBonus.php
miroman-afk d24bba305f v.2.24
1. POSTBonus in/out
2. POSTPresale in/out
3. Переработана форма гостя
2022-12-14 12:42:39 +03:00

34 lines
1.1 KiB
PHP

<?php
namespace App\Commands;
use App\Component\Models\ClientsBonus;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
use Illuminate\Support\Facades\Log;
class POSTBonus extends HRCCommand implements HRCCommandInterface
{
protected $signature = 'postbonus';
public function command($input, $output = null)
{
$client_guid = $input['client_id'];
$bonus_amount = $input['amount'];
$staff_id = $input['who'];
$bonus_time = $input['date_transaction'];
ClientsBonus::bonusReg($client_guid, $bonus_amount);
ClientsBonus::bonusLog($client_guid, $bonus_amount, $bonus_time, $staff_id);
if ($bonus_amount > 0) {
$message = 'Начислено ' . $bonus_amount . ' бонусов';
} else {
$message = 'Списано ' . abs($bonus_amount) . ' бонусов';
}
$bonus_result = ClientsBonus::getBonus($client_guid);
return [
'status' => 'success',
'message' => $message,
'result' => $bonus_result
];
}
}