管理后台-封禁
This commit is contained in:
@@ -226,6 +226,13 @@ class User extends adminApi
|
||||
$status = input('status', 1);
|
||||
$ban_eason = input('ban_eason', 0);
|
||||
$ban_day = input('ban_day', 0);
|
||||
if(empty($time)){
|
||||
if(!empty($ban_day)){
|
||||
$time = date('Y-m-d H:i:s', time() + $ban_day * 86400);
|
||||
}else{
|
||||
$time = "";
|
||||
}
|
||||
}
|
||||
$user_info = model('User')->where('id', $user_id)->find();
|
||||
if(!$user_info){
|
||||
return V(0, "用户不存在");
|
||||
@@ -257,10 +264,21 @@ class User extends adminApi
|
||||
'type_text' => $type_text,
|
||||
'block_time' => $block_time,
|
||||
'createtime' => time(),
|
||||
'ban_eason' => $ban_eason,
|
||||
'ban_day' => $ban_day,
|
||||
]);
|
||||
if (!$res) {
|
||||
return V(0, "添加失败");
|
||||
}
|
||||
//加推送单聊消息
|
||||
$content = "您的账号因 含有".model('Block')->getBanReason()[$ban_eason] . "内容 于".date('Y-m-d H:i:s',time())." 被封禁".model('Block')->getBanTime()[$ban_day]." ,".date('Y-m-d H:i:s',$block_time)."解封,如对处罚有异议请及时联系管理员申诉";
|
||||
$text = [
|
||||
'MsgType' => 404,
|
||||
'ToUserId' => $user_id,
|
||||
'Text' => $content
|
||||
];
|
||||
//谁发送给谁,什么消息,是否同步到发送者1是,2否,消息是否只下发给在线用户 1 是,0 否
|
||||
model('Tencent')->user_sendmsg("管理员",$user_id,json_encode($text),2,1);
|
||||
}else{
|
||||
if($type ==1) {
|
||||
$res = model('User')->where('id', $user_id)->update(['status' => 1]);
|
||||
@@ -284,6 +302,16 @@ class User extends adminApi
|
||||
TokenLib::delete($token);
|
||||
return V(1,"成功", null);
|
||||
}
|
||||
//封禁理由
|
||||
public function getBanEason(){
|
||||
$list = model('Block')->getBanReason();
|
||||
return V(1,"成功", $list);
|
||||
}
|
||||
//封禁时长
|
||||
public function getBanDay(){
|
||||
$list = model('Block')->getBanTime();
|
||||
return V(1,"成功", $list);
|
||||
}
|
||||
|
||||
/*
|
||||
* 设为官方账号
|
||||
|
||||
Reference in New Issue
Block a user