Kirin hace 2 años
padre
commit
c0b8abf75d
Se han modificado 2 ficheros con 14 adiciones y 3 borrados
  1. 2 2
      app/admin/view/user/user_cert/index.php
  2. 12 1
      app/models/user/Cert.php

+ 2 - 2
app/admin/view/user/user_cert/index.php

@@ -33,11 +33,11 @@
         return [
             {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%'},
             {field: 'name', title: '姓名', width: '8%'},
-            {field: 'gender', title: '性别', width: '5%'},
+            {field: 'gender_name', title: '性别', width: '5%'},
             {field: 'idcard', title: '身份证号码', width: '15%'},
             {field: 'job', title: '职业', width: '7%'},
             {field: 'photo', title: '照片', width: '7%'},
-            {field: 'level_text', title: '等级', width: '5%'},
+            {field: 'level_name', title: '等级', width: '5%'},
             {field: 'code', title: '编码'},
             {field: 'add_time', title: '提交时间', width: '12%'},
             {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '10%'},

+ 12 - 1
app/models/user/Cert.php

@@ -36,9 +36,15 @@ class Cert extends BaseModel
         4 => '特级',
     ];
 
+    public static $gender = [
+        0 => '男',
+        1 => '女',
+    ];
+
 
     protected $append = [
-        'level_name'
+        'level_name',
+        'gender_name',
     ];
 
 
@@ -50,6 +56,11 @@ class Cert extends BaseModel
         return self::$level[$data['status']];
     }
 
+    public function getGenderNameAttr($value, $data)
+    {
+        return self::$gender[$data['gender']];
+    }
+
 
     public static function getList($where)
     {