add some key_required property related fix
This commit is contained in:
parent
57e578540c
commit
2b5f5f60fd
@ -130,7 +130,7 @@ class CardController extends \backend\controllers\BackendController {
|
||||
] );
|
||||
}
|
||||
} else {
|
||||
return $this->render ( 'create', [
|
||||
return $this->render ( 'create', [
|
||||
'model' => $model
|
||||
] );
|
||||
}
|
||||
@ -269,7 +269,7 @@ class CardController extends \backend\controllers\BackendController {
|
||||
$i++;
|
||||
}else{
|
||||
// $failed [] = $item;
|
||||
$sql = "insert into card (number,status,type,created_at,updated_at, rfid_key) values(";
|
||||
$sql = "insert into card (number,status,type,created_at,updated_at, rfid_key) values( ";
|
||||
$sql .= " '" .$item['number'] . "'" ;
|
||||
$sql .= " ," . Card::STATUS_ACTIVE ;
|
||||
$sql .= " ," . Card::TYPE_RFID;
|
||||
@ -383,7 +383,6 @@ class CardController extends \backend\controllers\BackendController {
|
||||
|
||||
|
||||
public function actionRecalculate(){
|
||||
|
||||
if (Yii::$app->request->isPost) {
|
||||
$connection = \Yii::$app->db;
|
||||
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
||||
@ -395,14 +394,18 @@ class CardController extends \backend\controllers\BackendController {
|
||||
$result = $command->execute();
|
||||
\Yii::info("Door flag cleared: " . $result );
|
||||
|
||||
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
|
||||
$result = $command->execute();
|
||||
\Yii::info("Key flag fixed: " . $result );
|
||||
|
||||
|
||||
|
||||
if ( Helper::isKeyRequired()){
|
||||
\Yii::info("Fixing flag key " );
|
||||
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
|
||||
$result = $command->execute();
|
||||
\Yii::info("Fixing flag key ready: " . $result );
|
||||
}else{
|
||||
\Yii::info("Clearing flag key " );
|
||||
$command = $connection->createCommand( Card::$SQL_CLEAR_KEY_STATUS );
|
||||
$result = $command->execute();
|
||||
\Yii::info("Clearing flag key ready: " . $result );
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render("recalculate");
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
";
|
||||
|
||||
public static $SQL_CLEAR_KEY_STATUS = "
|
||||
UPDATE card set flag = ( flag & ~(1 << 2 ) ) WHERE card.type <> 50 and card.id_card = :id
|
||||
UPDATE card set flag = ( flag & ~(1 << 2 ) ) WHERE card.type <> 50
|
||||
";
|
||||
|
||||
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
||||
|
||||
Loading…
Reference in New Issue
Block a user