add feature enable/disable reception door log
This commit is contained in:
@@ -1,39 +1,21 @@
|
||||
<?php
|
||||
namespace console\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models;
|
||||
use /** @noinspection PhpUnusedAliasInspection */
|
||||
Yii;
|
||||
use yii\console\Controller;
|
||||
use common\models\Ticket;
|
||||
use common\models\DoorLog;
|
||||
use yii\helpers\VarDumper;
|
||||
use common\models\Customer;
|
||||
use common\models\Log;
|
||||
|
||||
class DoorlogController extends Controller{
|
||||
|
||||
|
||||
public $ticket;
|
||||
|
||||
|
||||
// public function options($actionID)
|
||||
// {
|
||||
// return ['ticket'];
|
||||
// }
|
||||
|
||||
// public function optionAliases()
|
||||
// {
|
||||
// return ['t' => 'ticket'];
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public function actionIn($ticket)
|
||||
{
|
||||
|
||||
$log = new DoorLog();
|
||||
//5559 9719
|
||||
|
||||
$log->id_card = 9719;
|
||||
$log->id_customer = 5559;
|
||||
$log->id_ticket_current = $ticket;
|
||||
@@ -44,9 +26,6 @@ class DoorlogController extends Controller{
|
||||
$log->id_account = null;
|
||||
$log->card_flag = 0;
|
||||
$log->flag_out= 0;
|
||||
|
||||
|
||||
|
||||
$log->save(false);
|
||||
}
|
||||
|
||||
@@ -92,12 +71,12 @@ class DoorlogController extends Controller{
|
||||
public function actionFixmissing(){
|
||||
|
||||
$tickets = Ticket::find()->andWhere(['in','id_ticket_type' ,[54,55,56,57]])->all();
|
||||
|
||||
|
||||
|
||||
foreach ($tickets as $ticket){
|
||||
|
||||
|
||||
/** @var /common/models/Ticket $ticket */
|
||||
foreach ($tickets as $ticket){
|
||||
$cache = [];
|
||||
|
||||
|
||||
$doorlogs = DoorLog::find()->andWhere( [ 'id_ticket_current' => $ticket->id_ticket, 'direction' => 7 ])->all();
|
||||
|
||||
|
||||
@@ -129,23 +108,17 @@ class DoorlogController extends Controller{
|
||||
}
|
||||
|
||||
if ( count($cache) > 0 ){
|
||||
|
||||
foreach ($cache as $item){
|
||||
|
||||
echo $item['id'];
|
||||
echo "/";
|
||||
echo $item['count'];
|
||||
echo "\r\n";
|
||||
|
||||
$t = Ticket::findOne($ticket->id_ticket);
|
||||
|
||||
|
||||
$elotte = $t->usage_count;
|
||||
$t->usage_count = $t->usage_count + 1;
|
||||
$t->count_move_out = $t->usage_count;
|
||||
|
||||
$t->save(false);
|
||||
|
||||
$log = new Log();
|
||||
$log->type = 30;
|
||||
$log->id_ticket = $ticket->id_ticket;
|
||||
@@ -153,18 +126,17 @@ class DoorlogController extends Controller{
|
||||
$log->id_door_log = $item['id'];
|
||||
$log->message = "FixMissing: Bérlet használat (elotte: " . $elotte ." > utana: " . $t->usage_count . " max: ". $t->max_usage_count .")";
|
||||
$log->save(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function actionDeleteOld(){
|
||||
$sql = "DELETE FROM door_log WHERE created_at < DATE_SUB(NOW(), INTERVAL 3 MONTH);";
|
||||
$cmd = \Yii::$app->db->createCommand($sql);
|
||||
$count = $cmd->execute();
|
||||
\Yii::info("Door logs deleted: " . $count );
|
||||
}
|
||||
|
||||
}
|
||||
2
console/runtime/.gitignore
vendored
2
console/runtime/.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
!.gitignore
|
||||
|
||||
Reference in New Issue
Block a user