From 921f74c93e10932e3021da4cd6911903410e2322 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sun, 12 Jun 2022 22:14:16 +0800 Subject: [PATCH] add alert when full site in promotion --- app/Console/Commands/Test.php | 10 ++++++---- include/functions.php | 4 ++++ lang/chs/lang_functions.php | 1 + lang/cht/lang_functions.php | 1 + lang/en/lang_functions.php | 2 ++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 6720fd7f..4deb41ca 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -77,10 +77,12 @@ class Test extends Command */ public function handle() { - $end = Carbon::parse('2022-06-06 14:10'); - $begin = Carbon::parse('2022-06-06 03:10'); - $r = $end->diffInHours($begin); - dd($r); + $a = []; + if ($a) { + echo 'Bad'; + } else { + echo 'OK'; + } } diff --git a/include/functions.php b/include/functions.php index b0bea094..a17eb75e 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2669,6 +2669,10 @@ else { } if ($msgalert) { + $spStateGlobal = get_global_sp_state(); + if ($spStateGlobal != \App\Models\Torrent::PROMOTION_NORMAL) { + msgalert("torrents.php", sprintf($lang_functions['full_site_promotion_in_effect'], \App\Models\Torrent::$promotionTypes[$spStateGlobal]['text']), "green"); + } if($CURUSER['leechwarn'] == 'yes') { $kicktimeout = gettime($CURUSER['leechwarnuntil'], false, false, true); diff --git a/lang/chs/lang_functions.php b/lang/chs/lang_functions.php index c020dde3..d6afc155 100644 --- a/lang/chs/lang_functions.php +++ b/lang/chs/lang_functions.php @@ -319,6 +319,7 @@ $lang_functions = array 'menu_claim' => '认领: ', 'text_complains' => '有%s%u个待处理的申诉%s', 'text_contactstaff' => '联系管理组', + 'full_site_promotion_in_effect' => '全站 [%s] 生效中!', ); ?> diff --git a/lang/cht/lang_functions.php b/lang/cht/lang_functions.php index 71d6c396..4523fbee 100644 --- a/lang/cht/lang_functions.php +++ b/lang/cht/lang_functions.php @@ -326,6 +326,7 @@ $lang_functions = array 'menu_claim' => '認領: ', 'text_complains' => '有%s%u個待處理的申诉%s', 'text_contactstaff' => '聯系管理組', + 'full_site_promotion_in_effect' => '全站 [%s] 生效中!', ); ?> diff --git a/lang/en/lang_functions.php b/lang/en/lang_functions.php index bc345744..b9e5c43f 100644 --- a/lang/en/lang_functions.php +++ b/lang/en/lang_functions.php @@ -327,6 +327,8 @@ $lang_functions = array 'menu_claim' => 'Claim: ', 'text_complains' => 'There %s %u pending complaint%s.', 'text_contactstaff' => 'Contact staff', + 'full_site_promotion_in_effect' => 'Full site [%s] in effect!', + ); ?>