fly преди 4 години
родител
ревизия
8b643b9f85
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      app/Modules/Book/Services/BookConfigService.php

+ 4 - 1
app/Modules/Book/Services/BookConfigService.php

@@ -474,7 +474,10 @@ class BookConfigService
      */
     public static function findFreeBookConfig(int $sex)
     {
-        return FreeBookConfig::where(['sex' => $sex, 'is_enabled' => 1])->orderBy('end_time')->first();
+        return FreeBookConfig::where(['sex' => $sex, 'is_enabled' => 1])
+            ->where('end_time', '>=', now())
+            ->orderBy('end_time')
+            ->first();
     }
 
     /**