wangzq 2 năm trước cách đây
mục cha
commit
ea82777255

+ 1 - 1
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -288,7 +288,7 @@ class BookController extends BaseController
     private function getCheckBooks($bid_list,$channel,$package,$is_author)
     {
         $hidden_cp = getHiddenCp();
-        if($package !== 'com.beidao.kuaiying.zsy'){
+        if(!is_public_package($package)){
             $hidden_cp = array_merge($hidden_cp,['lianshang']);
         }
         //获取书本数量

+ 47 - 1
app/Libs/Helpers.php

@@ -881,11 +881,57 @@ if(!function_exists("is_public_package")){
         if (empty($packageName)){
             return false;
         }
-        $publicPackageName = config("package.package_name");
+        $publicPackageName = get_public_packages();
         if (in_array($packageName,$publicPackageName)){
             return  true;
         }
 
         return  false;
     }
+}
+
+/**
+ *  判断包是否是公共包站点id
+ * name: is_public_package
+ * @param string $packageName
+ * @return bool
+ * date 2022/09/22 16:53
+ */
+if(!function_exists("is_public_package_channel_id")){
+    function is_public_package_channel_id($channelId = 0)
+    {
+        if (empty($$channelId)){
+            return false;
+        }
+        $publicPackageName = get_public_package_channel_ids();
+        if (in_array($channelId,$publicPackageName)){
+            return  true;
+        }
+
+        return  false;
+    }
+}
+
+/**
+ *  所有获取公共包
+ * name: get_public_packages
+ * @return \Illuminate\Config\Repository|\Illuminate\Foundation\Application|mixed
+ * date 2022/09/22 17:24
+ */
+if(!function_exists('get_public_packages')){
+    function  get_public_packages(){
+        return config("package.package_name");
+    }
+}
+
+/**
+ *  所有获取公共包站点id
+ * name: get_public_packages
+ * @return \Illuminate\Config\Repository|\Illuminate\Foundation\Application|mixed
+ * date 2022/09/22 17:24
+ */
+if(!function_exists('get_public_package_channel_ids')){
+    function  get_public_package_channel_ids(){
+        return config("package.channel_id");
+    }
 }

+ 2 - 2
app/Modules/Book/Models/BookConfig.php

@@ -165,7 +165,7 @@ class BookConfig extends Model
                 }
             }
         }
-        if(isset($where['channel_id']) && $where['channel_id'] == 7477){
+        if(isset($where['channel_id']) &&  is_public_package_channel_id($where['channel_id'])){
             $res->whereNotIn('book_configs.cp_source',getHiddenCp());
         }else{
             $res->whereNotIn('book_configs.cp_source',array_merge(getHiddenCp(),['lianshang']));
@@ -294,7 +294,7 @@ class BookConfig extends Model
             $field = 'bid,' . $str;
             $res->orderBy(DB::raw('field(' . $field . ')'));
         }
-        if(isset($where['channel_id']) && $where['channel_id'] == 7477){
+        if(isset($where['channel_id']) && is_public_package_channel_id($where['channel_id'])){
             $res->whereNotIn('book_configs.cp_source',getHiddenCp());
         }else{
             $res->whereNotIn('book_configs.cp_source',array_merge(getHiddenCp(),['lianshang']));

+ 5 - 0
config/package.php

@@ -18,4 +18,9 @@ return [
         7477,
         13131,
     ],
+    // 最新默认
+    'default' => [
+        'package_name' =>  "com.beidao.kuaiying.qingmang",
+        'channel_id' => 13131,
+    ],
 ];