123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\admin\model\csmadmin;
- use think\Model;
- class Loginlog extends Model
- {
-
-
- // 表名
- protected $name = 'csmadmin_loginlog';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'logintype_text',
- 'status_text'
- ];
-
-
- public function getLogintypeList()
- {
- return ['A' => __('Logintype a'), 'M' => __('Logintype m'), 'E' => __('Logintype e'), 'W' => __('Logintype w'), 'D' => __('Logintype d')];
- }
- public function getStatusList()
- {
- return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
- }
- public function getLogintypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['logintype']) ? $data['logintype'] : '');
- $list = $this->getLogintypeList();
- 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] : '';
- }
- }
|