Forráskód Böngészése

到期前30天提醒

shish 7 hónapja
szülő
commit
48819d4b86
1 módosított fájl, 8 hozzáadás és 5 törlés
  1. 8 5
      app-ghs/controllers/ConsoleController.php

+ 8 - 5
app-ghs/controllers/ConsoleController.php

@@ -151,16 +151,19 @@ class ConsoleController extends BaseController
         $notice = [];
         $shop = $this->shop;
         if (!empty($shop)) {
-            //到期前10天提醒
+            //到期前30天提醒
             $deadline = $shop->deadline;
             $currentTime = time();
-            $currentTime = $currentTime + 864000;
             $deadTime = strtotime($deadline);
-            if ($currentTime > $deadTime) {
-                if (time() > $deadTime) {
+            $remainingSeconds = $deadTime - $currentTime;
+            $remainingDays = ceil($remainingSeconds / 86400);
+            
+            // 30天 = 2592000秒
+            if ($remainingSeconds <= 2592000) {
+                if ($remainingSeconds <= 0) {
                     $notice[] = ['title' => '系统已到期', 'action' => '查看', 'page' => '/admin/shop/renew'];
                 } else {
-                    $notice[] = ['title' => '系统即将到期,请及时续费', 'action' => '查看', 'page' => '/admin/shop/renew'];
+                    $notice[] = ['title' => "系统{$remainingDays}天后到期,请及时续费", 'action' => '查看', 'page' => '/admin/shop/renew'];
                 }
             }
         }