浏览代码

Merge branch 'quickapp_fly' of iqiyoo:zhuishuyun_wap into kuaiyingyon_0820

onlinetest 4 年之前
父节点
当前提交
dc835b26a3
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      app/Modules/Book/Services/BookConfigService.php

+ 8 - 6
app/Modules/Book/Services/BookConfigService.php

@@ -521,14 +521,16 @@ class BookConfigService
      */
      */
     public static function judgeBookIsFree(int $bid)
     public static function judgeBookIsFree(int $bid)
     {
     {
-        $free_book = FreeBook::where('bid', $bid)
-            ->where('is_enabled', 1)->first();
-        if ($free_book) {
-            $config = self::findFreeBookConfig($free_book->sex);
+        $config = self::findFreeBookConfig(1);
+        $ids = [];
+        foreach ([1, 2] as $sex) {
+            $config = self::findFreeBookConfig($sex);
             if ($config) {
             if ($config) {
-                return $free_book->config_id == $config->id;
+                $ids[] = $config->id;
             }
             }
         }
         }
-        return false;
+        return FreeBook::where('bid', $bid)
+            ->where('config_id', $ids)
+            ->where('is_enabled', 1)->exists();
     }
     }
 }
 }