UpdateHeartbeat.php 1.0 KB
<?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;
    }
}