xielin 5 anos atrás
pai
commit
c57235bd97
1 arquivos alterados com 6 adições e 6 exclusões
  1. 6 6
      app/Transformers/Circle/DetailTransformer.php

+ 6 - 6
app/Transformers/Circle/DetailTransformer.php

@@ -33,7 +33,7 @@ class DetailTransformer extends TransformerAbstract
             'is_join' => $this->isJoin($this->uid, $interestCircle['id']),
         ];
         $funs = $this->getFunction($interestCircle);
-        return array_merge($row,$funs);
+        return array_merge($row, $funs);
     }
 
     //判读当前用户是否加入圈子
@@ -52,22 +52,22 @@ class DetailTransformer extends TransformerAbstract
     {
         $functions = json_decode($interestCircle['contains_function'], true);
         $info['members'] = ['is_open' => 1, 'extra' => (string)$interestCircle['join_count']];
+        $info['pictures'] = ['is_open' => 0, 'extra' => '0'];
+        $info['chatroom'] = ['is_open' => 0, 'extra' => '0'];
+        if (empty($functions)) {
+            return $info;
+        }
         foreach ($functions as &$func) {
             if ('pictures' == $func['function']) {
                 if (1 == $func['is_open']) {
                     $info['pictures'] = ['is_open' => 1, 'extra' => (string)$interestCircle['picture_count']];
-                } else {
-                    $info['pictures'] = ['is_open' => 0, 'extra' => '0'];
                 }
 
             }
             if ('chatroom' == $func['function']) {
                 if (1 == $func['is_open']) {
                     $info['chatroom'] = ['is_open' => 1, 'extra' => (string)$interestCircle['relate_id']];
-                } else {
-                    $info['chatroom'] = ['is_open' => 0, 'extra' => '0'];
                 }
-
             }
         }
         return $info;