1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\common\model;
- use think\Model;
- class WechatSubscribeConfig extends BaseRwModel
- {
- // 表名
- protected $table = 'wechat_subscribe_config';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
-
- // 追加属性
- protected $append = [
- 'type_text',
- 'status_text'
- ];
-
-
- public function getTypeList()
- {
- return ['default' => __('Type default'),'text' => __('Type text'),'news' => __('Type news')];
- }
- public function getStatusList()
- {
- return ['normal' => __('Status normal'),'hidden' => __('Status hidden')];
- }
- public function getTypeTextAttr($value, $data)
- {
- $value = $value ? $value : $data['type'];
- $list = $this->getTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getStatusTextAttr($value, $data)
- {
- $value = $value ? $value : $data['status'];
- $list = $this->getStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- }
|