Feedback.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
55
<?php
namespace app\api\controller\wanlshop;
use app\common\controller\Api;
/**
* WanlShop 反馈接口
*/
class Feedback extends Api
{
protected $noNeedLogin = [];
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\api\model\wanlshop\Feedback;
}
/**
* 反馈列表
*/
public function lists()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
$list = $this->model
->where('user_id', $this->auth->id)
->order('createtime desc')
->paginate();
$this->success('ok',$list);
}
/**
* 反馈新增、读取
*/
public function add()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isPost()) {
$params = $this->request->post();
$params['user_id'] = $this->auth->id;
$data = $this->model->allowField(true)->save($params);
$data? $this->success('ok',$data) : $this->error(__('服务器繁忙'));
}
$list = $this->model
->where('user_id', $this->auth->id)
->order('createtime desc')
->paginate();
$this->success('ok',$list);
}
}