application/index/controller/ConfigController.php
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace app\index\controller;
use http\Params;
use think\Cache;
use think\Controller;
use think\Db;
use think\Request;
use think\Session;
class ConfigController extends CommonController
{
public function __construct()
{
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
header('Access-Control-Allow-Headers:Origin,Content-Type,Accept,token,X-Requested-With,device');
}
public $columData = [
'id','name','value'
];
/**
* 分页接口 GET
* $page 当前页
* $limit 每页记录的长度
* $sort 排序字段
* $order 升序(默认asc)或者降序(desc)
* */
public function page(){
$token = $this->token();
if (Cache::get($token) == false) return json(['code'=>500,'msg'=>"您还没有登陆。"]);
$userid = Cache::get($token);
$base = json_decode(base64_decode($token,true),true);
$tabnames = $base['tablename'];
$page = isset($_GET['page'])?input('get.page'):"1";
$limt = isset($_GET['limit'])?input('get.limit'):"10";
$sort = isset($_GET['sort'])?input('get.sort'):"id";
$order = isset($_GET['order'])?input('get.order'):"asc";
$where = [];//判断条件
$count = Db::table('config')->where($where)->count();
// 取整函数(ceil,floor,round)
$page_count = ceil($count/$limt);//页数
$result = Db::table('config')->where($where)->limit(($page-1)*10,$limt)->order($sort." ".$order)->select();
return json([
'code' => 0,
'data' => [
"total" => $count,
"pageSize" => $limt,
"totalPage" => $page_count,
"currPage" => $page,
"list" => $result
]
]);
}
/**
* 分页接口 GET
* $page 当前页
* $limit 每页记录的长度
* $sort 排序字段
* $order 升序(默认asc)或者降序(desc)
后面还有 96 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
