合并分支 'master-server' 到 'master'
Master server 查看合并请求 !773
正在显示
2 个修改的文件
包含
6 行增加
和
47 行删除
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * @remark : | ||
| 4 | - * @name :UpdateHeartbeat.php | ||
| 5 | - * @author :lyh | ||
| 6 | - * @method :post | ||
| 7 | - * @time :2024/8/28 15:13 | ||
| 8 | - */ | ||
| 9 | - | ||
| 10 | -namespace App\Console\Commands\Update; | ||
| 11 | - | ||
| 12 | -use App\Models\Log\OperationHeartbeat; | ||
| 13 | -use Illuminate\Console\Command; | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -class UpdateHeartbeat extends Command | ||
| 17 | -{ | ||
| 18 | - /** | ||
| 19 | - * The name and signature of the console command. | ||
| 20 | - * | ||
| 21 | - * @var string | ||
| 22 | - */ | ||
| 23 | - protected $signature = 'operation_heartbeat'; | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * The console command description. | ||
| 27 | - * | ||
| 28 | - * @var string | ||
| 29 | - */ | ||
| 30 | - protected $description = '心跳半小时未操作更新为未操作'; | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * @remark :更新半小时未操作的界面 | ||
| 35 | - * @name :handle | ||
| 36 | - * @author :lyh | ||
| 37 | - * @method :post | ||
| 38 | - * @time :2024/8/28 15:25 | ||
| 39 | - */ | ||
| 40 | - public function handle(){ | ||
| 41 | - $date = date('Y-m-d H:i:s',time() - 10 * 60); | ||
| 42 | - $operationHeartbeatModel = new OperationHeartbeat(); | ||
| 43 | - $operationHeartbeatModel->edit(['status'=>0],['updated_at'=>['<=',$date]]); | ||
| 44 | - echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 45 | - return true; | ||
| 46 | - } | ||
| 47 | -} |
| @@ -78,6 +78,12 @@ class OperationHeartbeatController extends BaseController | @@ -78,6 +78,12 @@ class OperationHeartbeatController extends BaseController | ||
| 78 | $info = $operationHeartbeatModel->read($condition,['id','status']); | 78 | $info = $operationHeartbeatModel->read($condition,['id','status']); |
| 79 | if($info === false){ | 79 | if($info === false){ |
| 80 | $info = []; | 80 | $info = []; |
| 81 | + }else{ | ||
| 82 | + $date_time = strtotime($info['updated_at']) + (90 * 60); | ||
| 83 | + if($date_time > time()){ | ||
| 84 | + $operationHeartbeatModel->edit(['status'=>0],$condition); | ||
| 85 | + $info['status'] = 0; | ||
| 86 | + } | ||
| 81 | } | 87 | } |
| 82 | $this->response('success',Code::SUCCESS,$info); | 88 | $this->response('success',Code::SUCCESS,$info); |
| 83 | } | 89 | } |
-
请 注册 或 登录 后发表评论