ActivityNews.php
972 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Created by PhpStorm.
* auther: sgj
* Date: 2020/9/26
* Time: 17:40
*/
namespace api\common\model;
use think\Model;
class ActivityNews extends Model
{
protected $name = 'activity_news';
/**
* 通过类型获取新闻
* @param $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getNewsByType($type){
$map['activity_type']=$type;
$list=$this->where($map)->select()->order('weight desc')->toArray();
return $list;
}
public function getInfo($id){
$info=$this::find($id);
$info['content']=cmf_replace_content_file_url(htmlspecialchars_decode($info['content']));
$info['create_time']=date('Y-m-d',$info['create_time']);
$info['thumbnail']=cmf_get_image_url($info['thumbnail']);
return $info;
}
}