离线
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\cron\controller;
|
||||
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
|
||||
class FriendEnd
|
||||
@@ -18,9 +19,67 @@ class FriendEnd
|
||||
echo "清除私密小屋过期数据开始:\n";
|
||||
$this->clear_room_end();//清除私密小屋过期数据
|
||||
echo "清除私密小屋过期数据结束 \n";
|
||||
|
||||
echo "查询在线状态:\n";
|
||||
$this->online_status();
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
//查询在线状态
|
||||
protected function online_status()
|
||||
{
|
||||
$user_list = db::name('vs_xintiao')->select();
|
||||
if($user_list){
|
||||
foreach ($user_list as &$value){
|
||||
if(time() - $value['updatetime'] >= 183){//2秒刷新一次,加上用户多 三分钟补偿3秒
|
||||
//断线
|
||||
db::name('user')->where('id',$value['user_id'])->update(['is_online'=>0]);
|
||||
//是否在房间内
|
||||
$room_id = db::name('vs_room_visitor')->where('user_id',$value['user_id'])->order('id desc')->value('room_id');
|
||||
if($room_id){
|
||||
|
||||
$text['text'] = '掉线!';
|
||||
$text['user_id'] = $value['user_id'];
|
||||
$text['type'] = 2;
|
||||
model('Chat')->sendMsg(1058,$room_id,$text);
|
||||
|
||||
//拍卖位,互娱交友过程中1-6号麦位,签约过程中签约麦位不能退出房间 则推送离线
|
||||
// $auction_user_id = Cache::get('auction_user_'.$room_id);
|
||||
// $roomInfoStep = db::name('vs_room')->where(['id' => $room_id])->value('step');
|
||||
// $room_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $value['user_id']])->find();
|
||||
// $vs_room_sign = db::name('vs_room_sign')->where(['room_id' => $room_id, 'sign_user_id' => $value['user_id'],'sign_type'=>1])->find();
|
||||
// if($auction_user_id == $value['user_id']
|
||||
// || ($roomInfoStep == 2 && in_array($room_pit['pit_number'],[1,2,3,4,5,6]))
|
||||
// || $vs_room_sign)
|
||||
// {
|
||||
//
|
||||
// }else{//其他退出房间
|
||||
// model('api/Room')->quit_room($value['user_id'],$room_id,$value['user_id']);
|
||||
// }
|
||||
}
|
||||
}else{
|
||||
$is_online = db::name('user')->where('id',$value['user_id'])->value('is_online');
|
||||
if($is_online == 1){
|
||||
//在线
|
||||
continue;
|
||||
}else{
|
||||
//在线
|
||||
db::name('user')->where('id',$value['user_id'])->update(['is_online'=>1]);
|
||||
//是否在房间内
|
||||
$room_id = db::name('vs_room_visitor')->where('user_id',$value['user_id'])->order('id desc')->value('room_id');
|
||||
if($room_id){
|
||||
$text['text'] = '重新上线!';
|
||||
$text['user_id'] = $value['user_id'];
|
||||
$text['type'] = 1;
|
||||
model('Chat')->sendMsg(1058,$room_id,$text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//清除交友房过期未结束数据
|
||||
public function clearFriendingEndRoom()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ class PerformPerSecond
|
||||
echo "系统降身价:\n";
|
||||
$this->system_downgrade();
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user