123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\admin\model\csmadmin;
- use think\Model;
- class Msgtplchannel extends Model
- {
-
-
- // 表名
- protected $name = 'csmadmin_msgtplchannel';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'channel_text',
- 'status_text'
- ];
-
-
- public function getChannelList()
- {
- return ['web' => __('Channel web'), 'email' => __('Channel email'), 'sms' => __('Channel sms'), 'dingtalk' => __('Channel dingtalk')];
- }
- public function getStatusList()
- {
- return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
- }
- public function getChannelTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['channel']) ? $data['channel'] : '');
- $list = $this->getChannelList();
- 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] : '';
- }
- }
|