add some key_required property related fix
This commit is contained in:
parent
57e578540c
commit
2b5f5f60fd
@ -269,7 +269,7 @@ class CardController extends \backend\controllers\BackendController {
|
|||||||
$i++;
|
$i++;
|
||||||
}else{
|
}else{
|
||||||
// $failed [] = $item;
|
// $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 .= " '" .$item['number'] . "'" ;
|
||||||
$sql .= " ," . Card::STATUS_ACTIVE ;
|
$sql .= " ," . Card::STATUS_ACTIVE ;
|
||||||
$sql .= " ," . Card::TYPE_RFID;
|
$sql .= " ," . Card::TYPE_RFID;
|
||||||
@ -383,7 +383,6 @@ class CardController extends \backend\controllers\BackendController {
|
|||||||
|
|
||||||
|
|
||||||
public function actionRecalculate(){
|
public function actionRecalculate(){
|
||||||
|
|
||||||
if (Yii::$app->request->isPost) {
|
if (Yii::$app->request->isPost) {
|
||||||
$connection = \Yii::$app->db;
|
$connection = \Yii::$app->db;
|
||||||
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
||||||
@ -395,14 +394,18 @@ class CardController extends \backend\controllers\BackendController {
|
|||||||
$result = $command->execute();
|
$result = $command->execute();
|
||||||
\Yii::info("Door flag cleared: " . $result );
|
\Yii::info("Door flag cleared: " . $result );
|
||||||
|
|
||||||
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
|
if ( Helper::isKeyRequired()){
|
||||||
$result = $command->execute();
|
\Yii::info("Fixing flag key " );
|
||||||
\Yii::info("Key flag fixed: " . $result );
|
$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");
|
return $this->render("recalculate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
";
|
";
|
||||||
|
|
||||||
public static $SQL_CLEAR_KEY_STATUS = "
|
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 = "
|
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user