<?php
namespace app\controller\admin\api;
use laytp\controller\Backend;
use laytp\library\CommonFun;
class Log extends Backend
{
protected $model;
protected $hasSoftDel=0
protected $noNeedLogin = []; protected $noNeedAuth = ['index', 'info'];
public function _initialize()
{
$this->model = new \app\model\api\Log();
}
public function index(){
$where = $this->buildSearchParams();
$order = $this->buildOrder();
$allData = $this->request->param('all_data');
$data = $this->model->where($where)->order($order);
if($allData){
$data = $data->select()->toArray();
}else{
$limit = $this->request->param('limit', 10);
$data = $data->paginate($limit)->toArray();
}
return $this->success('数据获取成功', $data);
}
public function info()
{
$id = $this->request->param('id');
$info = $this->model->find($id);
return $this->success('获取成功', $info);
}
}