From 3b548381cb7c16c569b706536eaf614e8990e383 Mon Sep 17 00:00:00 2001 From: CGDF <17256673+CGDF-Github@users.noreply.github.com> Date: Tue, 11 Dec 2018 15:00:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=97=B6ssr=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/Job.php | 2 +- app/Utils/URL.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Command/Job.php b/app/Command/Job.php index 59afce51..f7ac4ae7 100644 --- a/app/Command/Job.php +++ b/app/Command/Job.php @@ -594,7 +594,7 @@ class Job } - if (strtotime($user->expire_in) < time() && $user->transfer_enable > 0 ) { + if (strtotime($user->expire_in) < time()) { $user->transfer_enable = 0; $user->u = 0; $user->d = 0; diff --git a/app/Utils/URL.php b/app/Utils/URL.php index 872aee4e..bdbc45ae 100644 --- a/app/Utils/URL.php +++ b/app/Utils/URL.php @@ -623,7 +623,7 @@ class URL if(!Config::get('mergeSub') and $is_mu == 1){ $group_name .= ' - 单端口'; } - if(strtotime($user->class_expire)>time() || strtotime($user->class_expire) > 1420041600){ + if(strtotime($user->expire_in)>time()){ $ssurl = "www.google.com:1:auth_chain_a:chacha20:tls1.2_ticket_auth:YnJlYWt3YWxs/?obfsparam=&protoparam=&remarks=".Tools::base64_url_encode("剩余流量:".number_format(($user->transfer_enable-($user->u+$user->d))/$user->transfer_enable*100,2)."% ".$user->unusedTraffic())."&group=".Tools::base64_url_encode($group_name); }else{ $ssurl = "www.google.com:1:auth_chain_a:chacha20:tls1.2_ticket_auth:YnJlYWt3YWxs/?obfsparam=&protoparam=&remarks=".Tools::base64_url_encode("账户已过期,请续费后使用")."&group=".Tools::base64_url_encode($group_name); @@ -636,7 +636,7 @@ class URL if(!Config::get('mergeSub') and $is_mu == 1){ $group_name .= ' - 单端口'; } - if(strtotime($user->class_expire)>time() || strtotime($user->class_expire) > 1420041600){ + if(strtotime($user->expire_in)>time()){ $ssurl = "www.google.com:2:auth_chain_a:chacha20:tls1.2_ticket_auth:YnJlYWt3YWxs/?obfsparam=&protoparam=&remarks=".Tools::base64_url_encode("过期时间:".$user->class_expire)."&group=".Tools::base64_url_encode($group_name); }else{ $ssurl = "www.google.com:2:auth_chain_a:chacha20:tls1.2_ticket_auth:YnJlYWt3YWxs/?obfsparam=&protoparam=&remarks=".Tools::base64_url_encode("账户已过期,请续费后使用")."&group=".Tools::base64_url_encode($group_name); From fc010bd0e570f22d9aa6c4f8dcf361953ee4e381 Mon Sep 17 00:00:00 2001 From: CGDF <17256673+CGDF-Github@users.noreply.github.com> Date: Tue, 11 Dec 2018 17:31:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E8=BD=B0=E7=82=B8=E5=92=8C=E8=B4=A6=E6=88=B7=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6ssr=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/Job.php | 11 +++++++++-- app/Utils/URL.php | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Command/Job.php b/app/Command/Job.php index f7ac4ae7..7ec47668 100644 --- a/app/Command/Job.php +++ b/app/Command/Job.php @@ -593,8 +593,7 @@ class Job Radius::Delete($user->email); } - - if (strtotime($user->expire_in) < time()) { + if (strtotime($user->expire_in) < time()&&!file_exists(BASE_PATH."/storage/".$node->id.".expire_in")) { $user->transfer_enable = 0; $user->u = 0; $user->d = 0; @@ -611,7 +610,15 @@ class Job } catch (\Exception $e) { echo $e->getMessage(); } + $myfile = fopen(BASE_PATH."/storage/".$node->id.".expire_in", "w+") or die("Unable to open file!"); + $txt = "1"; + fwrite($myfile, $txt); + fclose($myfile); } + elseif (strtotime($user->expire_in) > time()&&file_exists(BASE_PATH."/storage/".$node->id.".expire_in")) { + unlink(BASE_PATH."/storage/".$node->id.".expire_in"); + } + //余量不足检测 if(!file_exists(BASE_PATH."/storage/traffic_notified/")){ diff --git a/app/Utils/URL.php b/app/Utils/URL.php index bdbc45ae..2d4592b9 100644 --- a/app/Utils/URL.php +++ b/app/Utils/URL.php @@ -304,10 +304,11 @@ class URL } public static function getAllUrl($user, $is_mu, $is_ss = 0, $enter = 0) { $return_url = ''; - if ($user->transfer_enable >0){ - $return_url .= URL::getUserTraffic($user, $is_mu).($enter == 0 ? ' ' : "\n"); - $return_url .= URL::getUserClassExpiration($user, $is_mu).($enter == 0 ? ' ' : "\n"); - } + $return_url .= URL::getUserTraffic($user, $is_mu).($enter == 0 ? ' ' : "\n"); + $return_url .= URL::getUserClassExpiration($user, $is_mu).($enter == 0 ? ' ' : "\n"); + if(strtotime($user->expire_in)