lizhen_gitee 3 years ago
parent
commit
4e696a8d0d
1 changed files with 49 additions and 0 deletions
  1. 49 0
      application/admin/model/Gifttype.php

+ 49 - 0
application/admin/model/Gifttype.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Gifttype extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'gift_type';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = false;
+
+    // 定义时间戳字段名
+    protected $createTime = false;
+    protected $updateTime = false;
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'is_show_text'
+    ];
+    
+
+    
+    public function getIsShowList()
+    {
+        return ['1' => __('Is_show 1'), '0' => __('Is_show 0')];
+    }
+
+
+    public function getIsShowTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['is_show']) ? $data['is_show'] : '');
+        $list = $this->getIsShowList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+
+
+}