123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\admin\model\help;
- use think\Model;
- use traits\model\SoftDelete;
- class Help extends Model
- {
- use SoftDelete;
-
- // 表名
- protected $name = 'help';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = 'deletetime';
- // 追加属性
- protected $append = [
- 'isrec_text',
- 'status_text'
- ];
-
-
- public function getIsrecList()
- {
- return ['0' => __('Isrec 0'), '1' => __('Isrec 1')];
- }
- public function getStatusList()
- {
- return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')];
- }
- public function getIsrecTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['isrec']) ? $data['isrec'] : '');
- $list = $this->getIsrecList();
- 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] : '';
- }
- }
|