diff --git a/app/Console/Commands/AutoJob.php b/app/Console/Commands/AutoJob.php index 6bbbed06..29b83aab 100644 --- a/app/Console/Commands/AutoJob.php +++ b/app/Console/Commands/AutoJob.php @@ -28,6 +28,11 @@ class AutoJob extends Command Order::recentUnPay()->chunk(config('tasks.chunk'), function ($orders) { $orders->each->close(); }); // 关闭超时未支付本地订单 + + Order::whereStatus(1)->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-'.config('tasks.close.confirmation_orders').' hours')))->chunk(config('tasks.chunk'), function ($orders) { + $orders->each->close(); + }); // 关闭未处理的人工支付订单 + $this->expireCode(); //过期验证码、优惠券、邀请码无效化 if (sysConfig('is_subscribe_ban')) { diff --git a/app/Console/Commands/DailyJob.php b/app/Console/Commands/DailyJob.php index 98583815..1a5fe549 100644 --- a/app/Console/Commands/DailyJob.php +++ b/app/Console/Commands/DailyJob.php @@ -82,12 +82,12 @@ class DailyJob extends Command $q->where('admin_id', '<>', null); }) ->has('reply') - ->where('updated_at', '<=', date('Y-m-d', strtotime('-'.config('tasks.close.ticket').' hours'))) + ->where('updated_at', '<=', date('Y-m-d', strtotime('-'.config('tasks.close.tickets').' hours'))) ->chunk(config('tasks.chunk'), function ($tickets) { foreach ($tickets as $ticket) { if ($ticket->close()) { $ticket->user->notify(new TicketClosed($ticket->id, $ticket->title, route('replyTicket', ['id' => $ticket->id]), - __('You have not responded this ticket in :num hours, System has closed your ticket.', ['num' => config('tasks.close.ticket')]))); + __('You have not responded this ticket in :num hours, System has closed your ticket.', ['num' => config('tasks.close.tickets')]))); } } }); diff --git a/app/Console/Commands/NodeDailyTrafficStatistics.php b/app/Console/Commands/NodeDailyTrafficStatistics.php index 2c60912b..8577a860 100644 --- a/app/Console/Commands/NodeDailyTrafficStatistics.php +++ b/app/Console/Commands/NodeDailyTrafficStatistics.php @@ -15,7 +15,7 @@ class NodeDailyTrafficStatistics extends Command { $jobTime = microtime(true); - foreach (Node::whereStatus(1)->orderBy('id')->with('userDataFlowLogs')->whereHas('userDataFlowLogs')->get() as $node) { + foreach (Node::whereRelayNodeId(null)->whereStatus(1)->orderBy('id')->with('userDataFlowLogs')->whereHas('userDataFlowLogs')->get() as $node) { $this->statisticsByNode($node); } diff --git a/app/Console/Commands/NodeHourlyTrafficStatistics.php b/app/Console/Commands/NodeHourlyTrafficStatistics.php index b2841e45..87d083c4 100644 --- a/app/Console/Commands/NodeHourlyTrafficStatistics.php +++ b/app/Console/Commands/NodeHourlyTrafficStatistics.php @@ -10,13 +10,12 @@ class NodeHourlyTrafficStatistics extends Command { protected $signature = 'nodeHourlyTrafficStatistics'; protected $description = '节点每小时流量统计'; - protected $guarded = []; public function handle() { $jobTime = microtime(true); - foreach (Node::whereStatus(1)->orderBy('id')->with('userDataFlowLogs')->whereHas('userDataFlowLogs')->get() as $node) { + foreach (Node::whereRelayNodeId(null)->whereStatus(1)->orderBy('id')->with('userDataFlowLogs')->whereHas('userDataFlowLogs')->get() as $node) { $this->statisticsByNode($node); } diff --git a/app/Console/Commands/NodeStatusDetection.php b/app/Console/Commands/NodeStatusDetection.php index 463a5fb2..8aea8f70 100644 --- a/app/Console/Commands/NodeStatusDetection.php +++ b/app/Console/Commands/NodeStatusDetection.php @@ -74,7 +74,7 @@ class NodeStatusDetection extends Command { $detectionCheckTimes = sysConfig('detection_check_times'); - foreach (Node::whereRelayNodeId(null)->whereStatus(1)->where('detection_type', '<>', 0)->get() as $node) { + foreach (Node::whereStatus(1)->where('detection_type', '<>', 0)->get() as $node) { $node_id = $node->id; // 使用DDNS的node先通过gethostbyname获取ipv4地址 foreach ($node->ips() as $ip) { diff --git a/app/Models/Order.php b/app/Models/Order.php index e8417d66..c40f158c 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -48,7 +48,7 @@ class Order extends Model public function scopeRecentUnPay($query, int $minutes = 0) { if (! $minutes) { - $minutes = config('tasks.close.order'); + $minutes = config('tasks.close.orders'); } return $query->whereStatus(0)->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-'.$minutes.' minutes'))); diff --git a/config/tasks.php b/config/tasks.php index 3933e07e..577fc54b 100644 --- a/config/tasks.php +++ b/config/tasks.php @@ -20,9 +20,10 @@ return [ 'traffic_logs' => '-3 days', // 清除用户流量日志 ], 'close' => [ - 'ticket' => 72, // 自动关闭工单,单位:小时 - 'order' => 15, // 自动关闭订单,单位:分钟 - 'verify' => 15, // 自动失效验证码,单位:分钟 + 'tickets' => 72, // 自动关闭工单,单位:小时 + 'confirmation_orders' => 12, // 自动关闭人工支付订单,单位:小时 + 'orders' => 15, // 自动关闭订单,单位:分钟 + 'verify' => 15, // 自动失效验证码,单位:分钟 ], 'release_port' => 30, // 端口自动释放,单位:天 'recently_heartbeat' => '-10 minutes', // 节点近期负载 diff --git a/resources/views/user/components/payment/default.blade.php b/resources/views/user/components/payment/default.blade.php index d1a248b4..fb3b0717 100644 --- a/resources/views/user/components/payment/default.blade.php +++ b/resources/views/user/components/payment/default.blade.php @@ -19,7 +19,7 @@ @if($days !== 0)
  • {{trans('common.available_date').':'.$days.trans_choice('validation.attributes.day', 1)}}
  • @endif -
  • {!! trans('user.payment.close_tips', ['minutes' => config('tasks.close.order')]) !!}
  • +
  • {!! trans('user.payment.close_tips', ['minutes' => config('tasks.close.orders')]) !!}