瀏覽代碼

Merge branch 'master' of http://59.57.98.130:3000/jjhc/jucai

linwu 3 月之前
父節點
當前提交
050dc9ec91
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      app/Models/Company.php

+ 7 - 3
app/Models/Company.php

@@ -224,9 +224,13 @@ class Company extends User
     public function toSearchableArray()
     {
         $arr=$this->load(['membersSetmeal'])->toArray();
-        $arr['district'] = string_to_array('.', $arr['district']);
-        $arr['district_cn'] = string_to_array('/', $arr['district_cn']);
-        $arr['trade_cn'] = get_category($arr['trade']);
+        if(array_key_exists('district',$arr) && $arr['district'] != 0){
+            $arr['district'] = string_to_array('.', $arr['district']);
+            $arr['district_cn'] = string_to_array('/', $arr['district_cn']);
+        }
+        if(array_key_exists('trade',$arr) && $arr['trade'] > 0){
+            $arr['trade_cn'] = get_category($arr['trade']);
+        }
         foreach ($arr['tag'] as $key => $val) {
             $arr['tag'][$key] = (int)$val;
         }