|
@@ -44,15 +44,14 @@ class recylerobots extends Command
|
|
{
|
|
{
|
|
//注册地址
|
|
//注册地址
|
|
Gateway::$registerAddress = '127.0.0.1:1238';
|
|
Gateway::$registerAddress = '127.0.0.1:1238';
|
|
- echo Gateway::isOnline("7f0000010b5700000cb6");exit;
|
|
|
|
-
|
|
|
|
|
|
+ echo Gateway::isUidOnline(3);exit;
|
|
while(1){
|
|
while(1){
|
|
//获取所有机器人
|
|
//获取所有机器人
|
|
$robots = User::where("is_login", 1)->where("is_robot", 1)->get();
|
|
$robots = User::where("is_login", 1)->where("is_robot", 1)->get();
|
|
if($robots){
|
|
if($robots){
|
|
foreach ($robots as $robot) {
|
|
foreach ($robots as $robot) {
|
|
//检测是否在线
|
|
//检测是否在线
|
|
- if(Gateway::isUidOnline($robot->user_id)){
|
|
|
|
|
|
+ if(Gateway::isOnline($robot->client_id)){
|
|
//检测游戏是否结束
|
|
//检测游戏是否结束
|
|
$has_game = RoomUser::where("user_id", $robot->user_id)->where("state", 1)->count();
|
|
$has_game = RoomUser::where("user_id", $robot->user_id)->where("state", 1)->count();
|
|
if(!$has_game){
|
|
if(!$has_game){
|
|
@@ -61,12 +60,11 @@ class recylerobots extends Command
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
$update_data["is_login"] = 0;
|
|
$update_data["is_login"] = 0;
|
|
- $update_data["client_id"] = '';
|
|
|
|
User::where("user_id", $robot->user_id)->update($update_data);
|
|
User::where("user_id", $robot->user_id)->update($update_data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- sleep(10);
|
|
|
|
|
|
+ sleep(5);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|