1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class CustomUrl extends Model
- {
- // 表名
- protected $table = 'custom_url';
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- // 追加属性
- protected $append = [
- 'message_type_text',
- 'type_text',
- 'official_account_type_text',
- 'push_type_text'
- ];
- // public function customurlcollect()
- // {
- // return $this->belongsTo('CustomUrlCollect', 'id')->setEagerlyType(0);
- // }
- public function getMessageTypeList()
- {
- return ['0' => __('Message_type 0'),'1' => __('Message_type 1')];
- }
- public function getTypeList()
- {
- return ['0' => __('Type 0'),'1' => __('Type 1'),'2' => __('Type 2'),'3' => __('Type 3'),'4' => __('Type 4'),'5' => __('Type 5'),'6' => __('Type 6'),'7' => __('自动签到'),'8' => __('常用链接')];
- }
- public function getOfficialAccountTypeList()
- {
- return ['0' => __('Official_account_type 0'),'1' => __('Official_account_type 1')];
- }
- public function getPushTypeList()
- {
- return ['0' => __('Push_type 0'),'1' => __('Push_type 1')];
- }
- public function getMessageTypeTextAttr($value, $data)
- {
- $value = $value ? $value : $data['message_type'];
- $list = $this->getMessageTypeList();
- 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 getOfficialAccountTypeTextAttr($value, $data)
- {
- $value = $value ? $value : $data['official_account_type'];
- $list = $this->getOfficialAccountTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getPushTypeTextAttr($value, $data)
- {
- $value = $value ? $value : $data['push_type'];
- $list = $this->getPushTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- }
|