add coronavirus activate/inactivate
This commit is contained in:
@@ -20,13 +20,15 @@ use common\components\Helper;
|
||||
* @property int flag_out
|
||||
* @property \common\models\Customer $customer relation
|
||||
* @property mixed validity
|
||||
* @property string inactivated_at
|
||||
*/
|
||||
class Card extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
const STATUS_DELETED = 0;
|
||||
const STATUS_ACTIVE = 10;
|
||||
|
||||
const STATUS_INACTIVE = 20;
|
||||
|
||||
const TYPE_RFID = 10;
|
||||
const TYPE_QRCODE = 20;
|
||||
const TYPE_BARCODE = 30;
|
||||
@@ -75,6 +77,11 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
}
|
||||
|
||||
|
||||
public static $SQL_UPDATE_FLAG_STATUS_ACTIVE = '
|
||||
update card set flag = CASE WHEN status = 20 then (flag | 1 << 3) else ( flag & ~(1 << 3 ) ) end
|
||||
';
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -128,8 +135,9 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
static function statuses() {
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
return [
|
||||
self::STATUS_ACTIVE => Yii::t('common/card', 'Active'),
|
||||
self::STATUS_DELETED => Yii::t('common/card', 'Inactive'),
|
||||
self::STATUS_ACTIVE => 'Aktív',
|
||||
self::STATUS_DELETED => 'Törölve',
|
||||
self::STATUS_INACTIVE => 'Inaktív',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -305,4 +313,8 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
return Helper::isBitOn($this->flag,Card::$FLAG_DOOR_ALLOWED);
|
||||
}
|
||||
|
||||
public static function updateFlagStatus(){
|
||||
\Yii::$app->db->createCommand(self::$SQL_UPDATE_FLAG_STATUS_ACTIVE)->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user