wangzq 2 lat temu
rodzic
commit
f617e3d2fa

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

@@ -641,7 +641,7 @@ class BookController extends BaseController
     {
         $release_type = $request->get('release_type','');
         $distribution_id = $this->distribution_channel_id;
-        if(empty($release_type)){
+        if(is_empty($release_type)){
             //默认原banner
             // $recom_banner_type =  ['FEMALE', 'PUBLIC'] :  ['FEMALE', 'PUBLIC'];
             $banner = $this->getDefaultBanner(['FEMALE','PUBLIC']);
@@ -915,7 +915,7 @@ class BookController extends BaseController
         }
 
         $list = ChannelRecommendBooksService::getRecommendBooks($distribution_id,$bid);
-        if(!$list->isEmpty()){
+        if(!is_empty($list)){
             foreach($list as $key => $item){
                 $this->incrRecommendNum($distribution_id,$item->bid);
             }

+ 8 - 7
app/Libs/Helpers.php

@@ -1044,14 +1044,15 @@ if(!function_exists('get_rejcet_cp_by_package_name')){
     }
 }
 
-/**
- * 判断数据是否为空
- * name: is_empty
- * @param $data
- * @return bool 空返回true 非空返回false
- * date 2022/11/18 11:39
- */
+
 if (!function_exists('is_empty')){
+    /**
+     * 判断数据是否为空
+     * name: is_empty
+     * @param $data
+     * @return bool 空返回true 非空返回false
+     * date 2022/11/18 11:39
+     */
     function is_empty($data): bool
     {
         if (is_object($data)){

+ 6 - 1
readme.md

@@ -37,4 +37,9 @@
     git checkout master   
     git checkout stabble
     
-## 其他常用、实用的命令,共享到此
+## 其他常用、实用的命令,共享到此
+
+# 公共函数
+空数据判断
+is_empty
+示例: is_empty($data); 空返回true 非空返回false