封禁 强制退出
This commit is contained in:
@@ -857,6 +857,7 @@ class User extends adminApi
|
|||||||
$type = input('type', 1);
|
$type = input('type', 1);
|
||||||
$type_text = input('type_text', '');
|
$type_text = input('type_text', '');
|
||||||
$block_time = input('block_time', 0);
|
$block_time = input('block_time', 0);
|
||||||
|
$ban_eason = input('ban_eason', 0);
|
||||||
$admin_id = Session::get('admin_id');
|
$admin_id = Session::get('admin_id');
|
||||||
//插入fa_block 表
|
//插入fa_block 表
|
||||||
$res = Db::name('block')->insert([
|
$res = Db::name('block')->insert([
|
||||||
@@ -865,10 +866,27 @@ class User extends adminApi
|
|||||||
'type_text' => $type_text,
|
'type_text' => $type_text,
|
||||||
'block_time' => strtotime($block_time),
|
'block_time' => strtotime($block_time),
|
||||||
'createtime' => time(),
|
'createtime' => time(),
|
||||||
|
'ban_eason' => $ban_eason,
|
||||||
]);
|
]);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
return V(0, "添加失败");
|
return V(0, "添加失败");
|
||||||
}
|
}
|
||||||
|
//1账号, 2设备, 3ip 4禁言
|
||||||
|
if($type == 1){
|
||||||
|
$user_id = db::name('user')->where('user_code', $type_text)->value('id');
|
||||||
|
}
|
||||||
|
if($type == 2){
|
||||||
|
$user_id = db::name('user')->where('login_device', $type_text)->value('id');
|
||||||
|
}
|
||||||
|
if($type == 3){
|
||||||
|
$user_id = db::name('user')->where('loginip', $type_text)->value('id');
|
||||||
|
}
|
||||||
|
if(isset($user_id)){
|
||||||
|
$token = db::name('user_token')->where('user_id', $user_id)->value('token');
|
||||||
|
// 删除这个Token,使其失效
|
||||||
|
TokenLib::delete($token);
|
||||||
|
}
|
||||||
|
|
||||||
return V(1,"添加成功", null);
|
return V(1,"添加成功", null);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user