54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\app\exchange;
|
|
|
|
use app\common\controller\Api;
|
|
|
|
/**
|
|
* 兑换记录
|
|
*/
|
|
class UseLog extends Api
|
|
{
|
|
|
|
protected $noNeedLogin = [];
|
|
// 无需鉴权的接口,*表示全部
|
|
protected $noNeedRight = ['*'];
|
|
|
|
protected $model;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
|
|
$this->model = new \app\api\model\app\exchange\UseLog;
|
|
}
|
|
|
|
/**
|
|
* 查看
|
|
*/
|
|
public function getLog()
|
|
{
|
|
$limit = input('limit',10);
|
|
$page = input('page',1);
|
|
|
|
$where = [
|
|
'user_id'=>$this->auth->id
|
|
];
|
|
$list = $this->model
|
|
->with(['batch','course'])
|
|
->where($where)
|
|
->limit($limit)
|
|
->page($page)
|
|
->order('createtime','desc')
|
|
->select();
|
|
|
|
if(!empty($list)){
|
|
foreach ($list as $item){
|
|
$item->batch->visible(['name']);
|
|
$item->course->visible(['name','type']);
|
|
}
|
|
}
|
|
|
|
$this->success('获取成功', $list);
|
|
}
|
|
} |