管理后台-封禁

This commit is contained in:
2026-01-26 19:29:09 +08:00
parent cbf3eaf788
commit fc60a58a9c
2 changed files with 29 additions and 1 deletions

View File

@@ -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);
}
/*
* 设为官方账号

View File

@@ -33,7 +33,7 @@ class Test
// $this->task_coin_count();
// $this->createGuildSubsidyDataNew();
// $this->repair_guild_room_data();
$this->check_guild_room_data();
// $this->check_guild_room_data();
}