Browse Source

修复职业信息

tbphp 1 year ago
parent
commit
822d300858
2 changed files with 3 additions and 3 deletions
  1. 2 2
      application/admin/model/Member.php
  2. 1 1
      application/common.php

+ 2 - 2
application/admin/model/Member.php

@@ -73,7 +73,7 @@ class Member extends Model
             $codes = array_merge(array_column($data, 'provice'), array_column($data, 'city'));
             $adds  = Address::where(['code' => ['in', $codes]])->column('name', 'code');
 
-            $pf = Profession::where(['is_del' => 'n'])->column('name');
+            $pf = Profession::where(['is_del' => 'n'])->column('name,sort', 'id');
 
             foreach ($data as &$d) {
                 $d['city_name']    = $adds[$d['city']] ?? '-';
@@ -81,7 +81,7 @@ class Member extends Model
 
                 // 职业
                 if ($d['profession']) {
-                    $d['profession'] = $pf[$d['profession']];
+                    $d['profession'] = $pf[$d['profession']]['name'] ?? '';
                 } else {
                     $d['profession'] = '-';
                 }

+ 1 - 1
application/common.php

@@ -152,7 +152,7 @@ function alias($type, $arttype = 1)
     $atype = config('art_type');
     $name  = '';
     if ($type == 2) {
-        $name = $atype[$type][$arttype];
+        $name = $atype[$type][$arttype] ?? '';
     }
     $name .= $atype[$type]['name'];
     return $name;