v.2.24
1. POSTBonus in/out 2. POSTPresale in/out 3. Переработана форма гостя
This commit is contained in:
51
commands/GETClientLog.php
Normal file
51
commands/GETClientLog.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsActions;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientLog extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientlog';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$logs = ClientsActions::where('user_id', $client_guid)->orderByDesc('created')->get();
|
||||
$info = [];
|
||||
foreach ($logs as $log) {
|
||||
$info[] = array(
|
||||
'action' => $log['action'],
|
||||
'value' => round($log['action_value'], 2),
|
||||
'who' => Staff::getName($log['who']),
|
||||
'time' => $log['created'],
|
||||
'type' => $log['action_type']
|
||||
);
|
||||
}
|
||||
$result = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'info' => $info
|
||||
);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'client' => $result,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user