123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace app\common\model\account;
- use think\Model;
- class Logs extends Model
- {
-
-
- // 表名
- protected $name = 'account_logs';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- protected $dateFormat = 'Y-m-d H:i:s';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'type_text',
- 'credit_type_text',
- 'inc_or_exp_text'
- ];
-
-
- public function getTypeList()
- {
- return ['1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3'), '4' => __('Type 4'), '5' => __('Type 5'), '6' => __('Type 6'), '7' => __('Type 7'), '9' => __('Type 9')];
- }
- public function getCreditTypeList()
- {
- return ['1' => __('Credit_type 1'), '2' => __('Credit_type 2'), '3' => __('Credit_type 3'), '4' => __('Credit_type 4'), '5' => __('Credit_type 5'), '9' => __('Credit_type 9')];
- }
- public function getIncOrExpList()
- {
- return ['0' => __('Inc_or_exp 0'), '1' => __('Inc_or_exp 1'), '2' => __('Inc_or_exp 2')];
- }
- public function getTypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
- $list = $this->getTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getCreditTypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['credit_type']) ? $data['credit_type'] : '');
- $list = $this->getCreditTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getIncOrExpTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['inc_or_exp']) ? $data['inc_or_exp'] : '');
- $list = $this->getIncOrExpList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- }
|