mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-11 23:19:05 +00:00
自动化任务修改
去除 中转节点每小时/每日流量统计; 添加 中转节点状态检测; 添加 人工支付订单未处理自动关闭;
This commit is contained in:
@@ -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')) {
|
||||
|
||||
@@ -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')])));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -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', // 节点近期负载
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
@if($days !== 0)
|
||||
<li class="list-group-item">{{trans('common.available_date').':'.$days.trans_choice('validation.attributes.day', 1)}}</li>
|
||||
@endif
|
||||
<li class="list-group-item"> {!! trans('user.payment.close_tips', ['minutes' => config('tasks.close.order')]) !!}</li>
|
||||
<li class="list-group-item"> {!! trans('user.payment.close_tips', ['minutes' => config('tasks.close.orders')]) !!}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-auto mx-auto">
|
||||
|
||||
Reference in New Issue
Block a user