1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Postbackreferral extends Model
- {
- // 表名
- protected $table = 'referral';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
-
- // 追加属性
- protected $append = [
- 'push_text',
- 'wx_type_text',
- 'type_text',
- 'state_text',
- 'guide_sex_text'
- ];
-
-
- public function getPushList()
- {
- return ['0' => __('Push 0'),'1' => __('Push 1')];
- }
- public function getWxTypeList()
- {
- return ['1' => __('Wx_type 1'),'2' => __('Wx_type 2')];
- }
- public function getTypeList()
- {
- return ['1' => __('Type 1'),'2' => __('Type 2'),'3' => __('Type 3')];
- }
- public function getStateList()
- {
- return ['0' => __('State 0'),'1' => __('State 1')];
- }
- public function getGuideSexList()
- {
- return ['1' => __('Guide_sex 1'),'2' => __('Guide_sex 2')];
- }
- public function getPushTextAttr($value, $data)
- {
- $value = $value ? $value : $data['push'];
- $list = $this->getPushList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getWxTypeTextAttr($value, $data)
- {
- $value = $value ? $value : $data['wx_type'];
- $list = $this->getWxTypeList();
- 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] : '';
- }
- public function getStateTextAttr($value, $data)
- {
- $value = $value ? $value : $data['state'];
- $list = $this->getStateList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getGuideSexTextAttr($value, $data)
- {
- $value = $value ? $value : $data['guide_sex'];
- $list = $this->getGuideSexList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- }
|