Browse Source

目录订阅判断修正

wangzq 2 years ago
parent
commit
6691651a30
1 changed files with 22 additions and 1 deletions
  1. 22 1
      app/Http/Controllers/QuickApp/Book/ChapterController.php

+ 22 - 1
app/Http/Controllers/QuickApp/Book/ChapterController.php

@@ -143,7 +143,7 @@ class ChapterController extends BaseController
                     //     }
                     //
                     // }
-                    $v->next_chapter_status = $v->is_need_charge == true ? 2:1;
+                    $v->next_chapter_status = $this->isSubscribe($v->id,$rules);
                     $v->next_price = $v->price;
 
                     //拆章
@@ -1085,4 +1085,25 @@ class ChapterController extends BaseController
             return  false;
         }
     }
+
+    /*****
+     * 是否订阅
+     * name: isSubscribe
+     * @param $cid
+     * @param $rules
+     * @return int
+     * date 2022/11/02 17:19
+     */
+    private function isSubscribe($cid,$rules): int
+    {
+        if($rules['check'] != 1){
+            return 1;
+        }
+
+        if (empty($rules['paycid']) || !in_array($cid,$rules['paycid'])){
+            return 2;
+        }else{
+            return  1;
+        }
+    }
 }