Files
juipphp/app/api/controller/Index.php

38 lines
853 B
PHP
Raw Normal View History

2020-10-05 13:43:53 +08:00
<?php
namespace app\api\controller;
use app\api\model\Test;
use app\api\model\User;
class Index
{
public function index()
{
$test = new Test();
$list = $test->field('user,operation,record,create_time')->order('id')->limit('50')->fetchAll();
$count = $test->field('count(1) as count')->fetch();
$data = [
'Code'=>10000,
'count'=>$count['count'],
'data'=>$list
];
echo json_encode($data);
}
//获取指定页码数据
public function pageList()
{
if(!$_GET){
die;
}
$page = ($_GET['page'] - 1) * 50;
$test = new Test();
$list = $test->limit("$page,50")->fetchAll();
$data = [
'Code'=>10000,
'data'=>$list
];
echo json_encode($data);
}
}