use mobiledevice as login object for mobile api
This commit is contained in:
@@ -119,15 +119,4 @@ class MobileDeviceManager extends BaseObject
|
||||
|
||||
}
|
||||
|
||||
public function isMobileDeviceActivatedByIdCard($idCard){
|
||||
if ( !isset($idCard)){
|
||||
return false;
|
||||
}
|
||||
$device = MobileDevice::find()->andWhere(['id_card' => $idCard])->one();
|
||||
if ( !isset($device)){
|
||||
return false;
|
||||
}
|
||||
return isset($device->activated_at);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\NotSupportedException;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\web\IdentityInterface;
|
||||
|
||||
/**
|
||||
* This is the model class for table "mobile_device".
|
||||
@@ -18,7 +20,7 @@ use yii\helpers\ArrayHelper;
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class MobileDevice extends \yii\db\ActiveRecord
|
||||
class MobileDevice extends \yii\db\ActiveRecord implements IdentityInterface
|
||||
{
|
||||
|
||||
const STATUS_ACTIVE = 'active';
|
||||
@@ -95,4 +97,31 @@ class MobileDevice extends \yii\db\ActiveRecord
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function findIdentity($id)
|
||||
{
|
||||
self::findOne(['id' => $id]);
|
||||
}
|
||||
|
||||
public static function findIdentityByAccessToken($token, $type = null)
|
||||
{
|
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getAuthKey()
|
||||
{
|
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||
|
||||
}
|
||||
|
||||
public function validateAuthKey($authKey)
|
||||
{
|
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user