作者 李宇航

合并分支 'master-server' 到 'master'

Master server



查看合并请求 !773
<?php
/**
* @remark :
* @name :UpdateHeartbeat.php
* @author :lyh
* @method :post
* @time :2024/8/28 15:13
*/
namespace App\Console\Commands\Update;
use App\Models\Log\OperationHeartbeat;
use Illuminate\Console\Command;
class UpdateHeartbeat extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'operation_heartbeat';
/**
* The console command description.
*
* @var string
*/
protected $description = '心跳半小时未操作更新为未操作';
/**
* @remark :更新半小时未操作的界面
* @name :handle
* @author :lyh
* @method :post
* @time :2024/8/28 15:25
*/
public function handle(){
$date = date('Y-m-d H:i:s',time() - 10 * 60);
$operationHeartbeatModel = new OperationHeartbeat();
$operationHeartbeatModel->edit(['status'=>0],['updated_at'=>['<=',$date]]);
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
return true;
}
}
... ... @@ -78,6 +78,12 @@ class OperationHeartbeatController extends BaseController
$info = $operationHeartbeatModel->read($condition,['id','status']);
if($info === false){
$info = [];
}else{
$date_time = strtotime($info['updated_at']) + (90 * 60);
if($date_time > time()){
$operationHeartbeatModel->edit(['status'=>0],$condition);
$info['status'] = 0;
}
}
$this->response('success',Code::SUCCESS,$info);
}
... ...