Information.php
1.2 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/12/16
* Time: 15:30
*/
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
/**
* 农场资讯模块
*/
class Information extends Api
{
/**
* @ApiTitle (农场资讯列表)
* @ApiSummary (农场资讯列表)
* @ApiMethod (POST)
* @ApiRoute (/api/information/index)
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1553839125",
"data": {
'title'://标题,
'url': //跳转链接地址,
'form'://来源,
'look_num'://浏览量,
'thumbnail'://图片
'content'://内容,
'createtime'://创建时间
}
})
*/
public function index()
{
$data = Db::name('information')
->field('updatetime',true)
->order('id desc')
->select();
foreach ($data as $k=>$v){
$data[$k]['thumbnail'] = 'http://q2ugvq3qf.bkt.clouddn.com'.$v['thumbnail'];
$data[$k]['content'] = strip_tags($v['content']);
$data[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
}
$this->success('success',$data);
}
}