65 lines
1.3 KiB
PHP
65 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\common\model\user;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class Message extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'message';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
|
|
|
|
/**
|
|
* 获取课程列表
|
|
* @param $userId 分组ID
|
|
* @param $params 分页信息 page页码 limit获取数量
|
|
* @return array
|
|
*/
|
|
public function getList($params = []){
|
|
|
|
$where = [
|
|
'status'=>1
|
|
];
|
|
|
|
|
|
$list = self::where($where)
|
|
->limit($params['limit'])->page($params['page'])
|
|
->field(['views','uniacid'],true)
|
|
->order('createtime','desc')
|
|
->select();
|
|
|
|
if(!empty($list)){
|
|
|
|
//增加浏览
|
|
foreach ($list as &$item){
|
|
self::where([
|
|
'id'=>$item['id']
|
|
])->setInc('views');
|
|
|
|
$item['link'] = json_decode($item['link']);
|
|
$item['content'] = \addons\alivod\library\Alivod::parseContentAliovdTag($item['content']);
|
|
}
|
|
}
|
|
|
|
return $list;
|
|
}
|
|
|
|
|
|
}
|