| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | 
							- <?php
 
- namespace app\admin\model\applys;
 
- use think\Model;
 
- class Eyemargin extends Model
 
- {
 
-     
 
-     
 
-     // 表名
 
-     protected $name = 'eyemargin';
 
-     
 
-     // 自动写入时间戳字段
 
-     protected $autoWriteTimestamp = 'int';
 
-     // 定义时间戳字段名
 
-     protected $createTime = 'createtime';
 
-     protected $updateTime = false;
 
-     protected $deleteTime = false;
 
-     // 追加属性
 
-     protected $append = [
 
-         'eye_type_text',
 
-         'is_main_text',
 
-         'status_text'
 
-     ];
 
-     
 
-     
 
-     public function getEyeTypeList()
 
-     {
 
-         return ['1' => __('Eye_type 1'), '2' => __('Eye_type 2')];
 
-     }
 
-     public function getIsMainList()
 
-     {
 
-         return ['1' => __('Is_main 1'), '0' => __('Is_main 0')];
 
-     }
 
-     public function getStatusList()
 
-     {
 
-         return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1')];
 
-     }
 
-     public function getEyeTypeTextAttr($value, $data)
 
-     {
 
-         $value = $value ? $value : (isset($data['eye_type']) ? $data['eye_type'] : '');
 
-         $list = $this->getEyeTypeList();
 
-         return isset($list[$value]) ? $list[$value] : '';
 
-     }
 
-     public function getIsMainTextAttr($value, $data)
 
-     {
 
-         $value = $value ? $value : (isset($data['is_main']) ? $data['is_main'] : '');
 
-         $list = $this->getIsMainList();
 
-         return isset($list[$value]) ? $list[$value] : '';
 
-     }
 
-     public function getStatusTextAttr($value, $data)
 
-     {
 
-         $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
 
-         $list = $this->getStatusList();
 
-         return isset($list[$value]) ? $list[$value] : '';
 
-     }
 
-     public function user()
 
-     {
 
-         return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
 
-     }
 
- }
 
 
  |