Files
amb_wechatapp/application/admin/model/app/msgpush/Log.php
T

68 lines
1.3 KiB
PHP

<?php
namespace app\admin\model\app\msgpush;
use think\Model;
class Log extends Model
{
// 表名
protected $name = 'app_msg_push_log';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'status_text',
'msg_type_text',
];
public function getStatusList()
{
return ['1' => __('Status 1'), '0' => __('Status 0'), '2' => __('Status 2')];
}
public function getMsgTypeList()
{
$options = config('message_push_options');
$list = [];
foreach ($options as $index => $item){
$list[$index] = $item['name'];
}
return $list;
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getMsgTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['msg_type']) ? $data['msg_type'] : '');
$list = $this->getMsgTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
}