增加获取图片的接口

This commit is contained in:
wisp-x
2019-10-31 11:37:18 +08:00
parent cfadf14e44
commit 2a9ac60b85
3 changed files with 48 additions and 2 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* Created by WispX.
* User: WispX <1591788658@qq.com>
* Date: 2019/10/31
* Time: 11:10 上午
* Link: https://github.com/wisp-x
*/
namespace app\api\controller;
use app\common\model\Images;
class Image extends Base
{
private $model;
public function initialize()
{
parent::initialize();
$this->model = new Images();
$this->model = $this->model->where('user_id', $this->user->id);
}
public function find()
{
$id = $this->param('id');
$image = $this->model->where(['id' => $id])->find();
$this->response('success', $image);
}
public function items()
{
$page = $this->param('page', 1);
$rows = $this->param('rows', 20);
$images = $this->model->paginate(null, false, [
'page' => $page,
'list_rows' => $rows,
]);
$this->response('success', $images);
}
}