47 lines
829 B
PHP
47 lines
829 B
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-12-3
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\api\models;
|
|
|
|
|
|
use app\models\UserToken;
|
|
|
|
|
|
class LogoutForm extends ApiModel
|
|
{
|
|
public $cx_mch_id;
|
|
|
|
public $user_id;
|
|
public $token_type;
|
|
|
|
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['cx_mch_id', 'user_id', 'token_type'], 'integer'],
|
|
[['cx_mch_id', 'user_id', 'token_type'], 'required'],
|
|
];
|
|
}
|
|
|
|
public function logout()
|
|
{
|
|
if(!$this->validate()){
|
|
return $this->getModelError();
|
|
}
|
|
\Yii::$app->user->logout();
|
|
UserToken::destory($this->user_id, $this->token_type, $this->cx_mch_id);
|
|
return [
|
|
'code' => 0,
|
|
'msg' => 'ok'
|
|
];
|
|
}
|
|
} |