1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\common\model;
- use think\Model;
- class Postbackrules extends Model
- {
- // 表名
- protected $table = 'postback_rules';
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- // 追加属性
- protected $append = [
- 'state_text',
- 'type_text'
- ];
- public function getStateList()
- {
- return ['show' => __('State show'), 'hide' => __('State hide')];
- }
- public function getTypeList()
- {
- return ['tout' => __('Type tout'), 'guangdt' => __('Type guangdt'), 'uc' => "uc"];
- }
- public function getStateTextAttr($value, $data)
- {
- $value = $value ? $value : $data['state'];
- $list = $this->getStateList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getTypeTextAttr($value, $data)
- {
- $value = $value ? $value : $data['type'];
- $list = $this->getTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- }
|