清除全部魅力

This commit is contained in:
2025-09-11 15:31:28 +08:00
parent a1d2c4b24f
commit 81e9dfcca0
2 changed files with 14 additions and 13 deletions

View File

@@ -1704,18 +1704,19 @@ class Room extends Model
}
if($uid <= 0){
db::name('vs_room_user_charm')->where(['room_id' => $room_id])->update(['charm' => 0,'clear_time' => time()]);
//获取房间内所有用户
$list = db::name('vs_room_visitor')->field('user_id')->where(['room_id' => $room_id])->select();
//循环清除用户魅力值
if($list){
foreach ($list as $v){
//清除有魅力值的用户
if(db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $v['user_id']])->find()){
db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $v['user_id']])->update(['charm' => 0,'clear_time' => time()]);
}
}
}
// $list = db::name('vs_room_visitor')->field('user_id')->where(['room_id' => $room_id])->select();
//
// //循环清除用户魅力值
// if($list){
// foreach ($list as $v){
// //清除有魅力值的用户
// if(db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $v['user_id']])->find()){
// db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $v['user_id']])->update(['charm' => 0,'clear_time' => time()]);
// }
// }
// }
//发送消息
$text['text'] = '清除魅力成功';
model('Chat')->sendMsg(1021,$room_id,$text);

View File

@@ -937,9 +937,9 @@ class Tencent extends Model
}elseif ($action == 'Logout'){
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
$text['text'] = '重新上线!';
$text['text'] = '线!';
$text['user_id'] = $uid;
$text['type'] = 0;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$room,$text);
}
return true;